diff --git a/custom_mrp_descarga/data/ir_sequence.xml b/custom_mrp_descarga/data/ir_sequence.xml index 0092c2f4d..12532e592 100644 --- a/custom_mrp_descarga/data/ir_sequence.xml +++ b/custom_mrp_descarga/data/ir_sequence.xml @@ -1,4 +1,3 @@ - Secuencia para órdenes de producción de despiece diff --git a/custom_mrp_descarga/data/mrp_bom_category.xml b/custom_mrp_descarga/data/mrp_bom_category.xml index 5a23d0839..a731ca59c 100644 --- a/custom_mrp_descarga/data/mrp_bom_category.xml +++ b/custom_mrp_descarga/data/mrp_bom_category.xml @@ -1,4 +1,3 @@ - Despiece diff --git a/custom_mrp_descarga/data/quartering_product.xml b/custom_mrp_descarga/data/quartering_product.xml index 9d3c57998..95c2023e0 100644 --- a/custom_mrp_descarga/data/quartering_product.xml +++ b/custom_mrp_descarga/data/quartering_product.xml @@ -1,4 +1,3 @@ - Despiece diff --git a/custom_mrp_descarga/models/mrp_bom.py b/custom_mrp_descarga/models/mrp_bom.py index aeba76507..267ef3cfd 100644 --- a/custom_mrp_descarga/models/mrp_bom.py +++ b/custom_mrp_descarga/models/mrp_bom.py @@ -19,8 +19,10 @@ def _compute_quartering(self): for line in self: quartering = False try: - quartering = self.env.ref("custom_mrp_descarga.quartering_category") - if line.category_id == quartering: + quartering_type = self.env.ref( + "custom_mrp_descarga.quartering_category" + ) + if line.category_id == quartering_type: quartering = True except Exception: quartering = False diff --git a/custom_mrp_descarga/models/stock_move_line.py b/custom_mrp_descarga/models/stock_move_line.py index 9910924f6..b7deed47a 100644 --- a/custom_mrp_descarga/models/stock_move_line.py +++ b/custom_mrp_descarga/models/stock_move_line.py @@ -175,4 +175,15 @@ def write(self, values): if line.move_id.state == "cancel" and values.get("qty_done") != 0: line.move_id.state = "done" line.state = "done" + if "qty_done" or "amount" or "state" in values: + for line in self: + if line.lot_id and line.company_id.paasa: + quartering = line.lot_id.move_line_ids.filtered( + lambda c: c.production_id + and c.production_id.quartering + and (c.location_id == c.production_id.location_src_id) + ) + for record in quartering: + if record.standard_price != line.lot_id.average_price: + record.standard_price = line.lot_id.average_price return result diff --git a/custom_mrp_descarga/models/stock_production_lot.py b/custom_mrp_descarga/models/stock_production_lot.py index 3deacb182..e962af2dd 100644 --- a/custom_mrp_descarga/models/stock_production_lot.py +++ b/custom_mrp_descarga/models/stock_production_lot.py @@ -22,21 +22,12 @@ def _compute_average_price(self): clasified = line.move_line_ids.filtered( lambda c: c.state == "done" and (c.location_dest_id.usage == "internal") ) - quartering = line.move_line_ids.filtered( - lambda c: c.production_id - and c.production_id.quartering - and (c.location_id == c.production_id.location_src_id) - ) if clasified: amount_total = sum(clasified.mapped("amount")) qty_done = sum(clasified.mapped("qty_done")) if qty_done != 0: average_price = amount_total / qty_done line.average_price = average_price - if line.company_id.paasa and average_price: - for record in quartering: - if record.standard_price != line.average_price: - record.standard_price = line.average_price def action_view_move_lines(self): context = self.env.context.copy() diff --git a/custom_mrp_descarga/views/mrp_bom_view.xml b/custom_mrp_descarga/views/mrp_bom_view.xml index 4751c2bf8..99ef7c2e7 100644 --- a/custom_mrp_descarga/views/mrp_bom_view.xml +++ b/custom_mrp_descarga/views/mrp_bom_view.xml @@ -5,7 +5,7 @@ - + diff --git a/custom_mrp_descarga/views/mrp_production_view.xml b/custom_mrp_descarga/views/mrp_production_view.xml index 21e1f29a4..4d7f39cac 100644 --- a/custom_mrp_descarga/views/mrp_production_view.xml +++ b/custom_mrp_descarga/views/mrp_production_view.xml @@ -100,10 +100,12 @@ mrp.production - primary - + + 1 + + mrp.production -