diff --git a/invoice_stock_move/__manifest__.py b/invoice_stock_move/__manifest__.py index b05ca4238..8bde628bd 100755 --- a/invoice_stock_move/__manifest__.py +++ b/invoice_stock_move/__manifest__.py @@ -21,7 +21,7 @@ ################################################################################ { 'name': "Stock Picking From Invoice", - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Accounting', 'summary': """Stock Picking From Customer/Supplier Invoice""", 'description': """This Module Enables To Create Stocks Picking From diff --git a/invoice_stock_move/doc/RELEASE_NOTES.md b/invoice_stock_move/doc/RELEASE_NOTES.md index 48299820f..80af0805b 100755 --- a/invoice_stock_move/doc/RELEASE_NOTES.md +++ b/invoice_stock_move/doc/RELEASE_NOTES.md @@ -5,3 +5,8 @@ #### ADD Initial Commit for Stock Picking From Invoice + +#### 12.09.2024 +#### Version 17.0.1.0.1 +#### Bugfix +-An issue was mentioned that picking type value is missing , updated the code diff --git a/invoice_stock_move/models/account_move.py b/invoice_stock_move/models/account_move.py index 4bf8ad729..0bdad71d6 100755 --- a/invoice_stock_move/models/account_move.py +++ b/invoice_stock_move/models/account_move.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ -from odoo import fields, models, _ +from odoo import fields, models, _, api from odoo.exceptions import UserError @@ -27,30 +27,33 @@ class AccountMove(models.Model): """Inherits 'account move' to show stock picking in invoice""" _inherit = 'account.move' - def _get_stock_type_ids(self): - """Fetch the move types and return to 'picking_type_id' field""" - data = self.env['stock.picking.type'].search([]) - if self._context.get('default_move_type') == 'out_invoice': - for line in data: - if line.code == 'outgoing': - return line - if self._context.get('default_move_type') == 'in_invoice': - for line in data: - if line.code == 'incoming': - return line + picking_count = fields.Integer(string="Count", copy=False, + help="Count of the created picking") - picking_count = fields.Integer(string="Count", copy=False, help="Count of " - "the " - "created " - "picking") invoice_picking_id = fields.Many2one(comodel_name='stock.picking', string="Picking Id", copy=False, - help="corresponding picking") + help="Corresponding picking") + picking_type_id = fields.Many2one(comodel_name='stock.picking.type', string='Picking Type', - default=_get_stock_type_ids, - help="This will determine picking " - "type of incoming shipment") + compute='compute_stock_type', + help="This will determine the picking type " + "of incoming/outgoing shipment") + @api.depends('move_type') + def compute_stock_type(self): + for rec in self: + type = '' + data = self.env['stock.picking.type'].search([]) + print('self._context.get', self._context.get('default_move_type')) + if self._context.get('default_move_type') == 'out_invoice': + for line in data: + if line.code == 'outgoing': + type = line + if self._context.get('default_move_type') == 'in_invoice': + for line in data: + if line.code == 'incoming': + type = line + rec.picking_type_id = type def action_stock_move(self): """Function to create transfer from invoice""" diff --git a/invoice_stock_move/views/account_move_views.xml b/invoice_stock_move/views/account_move_views.xml index 20e212dcc..768187737 100755 --- a/invoice_stock_move/views/account_move_views.xml +++ b/invoice_stock_move/views/account_move_views.xml @@ -13,7 +13,7 @@ invisible="state == 'draft' or picking_count == 1"/> - +