[IMP] mrp: new prepare move line finished vals to write custom values before the post_inventory
closes odoo/odoo#146526 X-original-commit: 6f5519105787ead32d27658ac291ef18dac51698 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
committed by
William Henrotin
parent
ce1eb19d4b
commit
58d2429c48
@@ -1657,8 +1657,9 @@ class MrpProduction(models.Model):
|
||||
# the finish move can already be completed by the workorder.
|
||||
for move in finish_moves:
|
||||
move.quantity = float_round(order.qty_producing - order.qty_produced, precision_rounding=order.product_uom_id.rounding, rounding_method='HALF-UP')
|
||||
if move.has_tracking != 'none' and order.lot_producing_id:
|
||||
move.move_line_ids.lot_id = order.lot_producing_id
|
||||
extra_vals = order._prepare_finished_extra_vals()
|
||||
if extra_vals:
|
||||
move.move_line_ids.write(extra_vals)
|
||||
# workorder duration need to be set to calculate the price of the product
|
||||
for workorder in order.workorder_ids:
|
||||
if workorder.state not in ('done', 'cancel'):
|
||||
@@ -2712,6 +2713,12 @@ class MrpProduction(models.Model):
|
||||
clean_action(action, self.env)
|
||||
return action
|
||||
|
||||
def _prepare_finished_extra_vals(self):
|
||||
self.ensure_one()
|
||||
if self.lot_producing_id:
|
||||
return {'lot_id' : self.lot_producing_id.id}
|
||||
return {}
|
||||
|
||||
def action_open_label_layout(self):
|
||||
view = self.env.ref('stock.product_label_layout_form_picking')
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user