diff options
| author | Rémy Voet (ryv) <ryv@odoo.com> | 2020-05-05 15:17:06 +0200 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2020-06-15 16:59:41 +0200 |
| commit | 5011ec520c48cab4117e6e11cc91c1d551bbf648 (patch) | |
| tree | b819fa1515aa896dbd0c04dee098e42ad8e8bb56 /addons/mrp_account | |
| parent | 0e2765f5fd0ca0079f1f024ec3a1448b6d2ea3db (diff) | |
[REF] mrp: review consumption allowing
Now, by default, a Bill of Material have a flexible
consumption instead of strict consumption. Also
add new consumption choice: a flexible consumption
but with a warning when the bom isn't respected.
Also, now, the strict (a new warning option) consumption
is checked only when we try to mark as done the MO.
task-2241471
Diffstat (limited to 'addons/mrp_account')
| -rw-r--r-- | addons/mrp_account/models/mrp_production.py | 1 | ||||
| -rw-r--r-- | addons/mrp_account/tests/test_mrp_account.py | 2 | ||||
| -rw-r--r-- | addons/mrp_account/tests/test_valuation_layers.py | 15 |
3 files changed, 10 insertions, 8 deletions
diff --git a/addons/mrp_account/models/mrp_production.py b/addons/mrp_account/models/mrp_production.py index 3a10fdacf1f..4bd0c337594 100644 --- a/addons/mrp_account/models/mrp_production.py +++ b/addons/mrp_account/models/mrp_production.py @@ -71,7 +71,6 @@ class MrpProduction(models.Model): AccountAnalyticLine.create(vals) def button_mark_done(self): - self.ensure_one() res = super(MrpProduction, self).button_mark_done() for order in self: order._costs_generate() diff --git a/addons/mrp_account/tests/test_mrp_account.py b/addons/mrp_account/tests/test_mrp_account.py index bd9adba0a5c..f77dbfc3c6e 100644 --- a/addons/mrp_account/tests/test_mrp_account.py +++ b/addons/mrp_account/tests/test_mrp_account.py @@ -78,7 +78,7 @@ class TestMrpAccount(TestWorkOrderProcessCommon): mo_form = Form(production_table) mo_form.qty_producing = 1 production_table = mo_form.save() - production_table.post_inventory() + production_table._post_inventory() move_value = production_table.move_finished_ids.filtered(lambda x: x.state == "done").stock_valuation_layer_ids.value # 1 table head at 20 + 4 table leg at 15 + 4 bolt at 10 + 10 screw at 10 + 1*20 (extra cost) diff --git a/addons/mrp_account/tests/test_valuation_layers.py b/addons/mrp_account/tests/test_valuation_layers.py index a116995a0c4..df03cc163de 100644 --- a/addons/mrp_account/tests/test_valuation_layers.py +++ b/addons/mrp_account/tests/test_valuation_layers.py @@ -55,7 +55,10 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self._make_in_move(self.component, 1, 20) mo = self._make_mo(self.bom, 2) self._produce(mo, 1) - mo.post_inventory() + action = mo.button_mark_done() + backorder = Form(self.env['mrp.production.backorder'].with_context(**action['context'])) + backorder.save().action_backorder() + mo = mo.procurement_group_id.mrp_production_ids[-1] self.assertEqual(self.component.value_svl, 20) self.assertEqual(self.product1.value_svl, 10) self.assertEqual(self.component.quantity_svl, 1) @@ -93,7 +96,7 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self._produce(mo, 1) action = mo.button_mark_done() backorder = Form(self.env['mrp.production.backorder'].with_context(**action['context'])) - backorder.save().action_close_mo() + backorder.save().action_backorder() mo = mo.procurement_group_id.mrp_production_ids[-1] self.assertEqual(self.component.value_svl, 20) self.assertEqual(self.product1.value_svl, 10) @@ -131,7 +134,7 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self._make_in_move(self.component, 1, 20) mo = self._make_mo(self.bom, 2) self._produce(mo, 1) - mo.post_inventory() + mo._post_inventory() self.assertEqual(self.component.value_svl, 20) self.assertEqual(self.product1.value_svl, 8.8) self.assertEqual(self.component.quantity_svl, 1) @@ -169,7 +172,7 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self._make_in_move(self.component, 1) mo = self._make_mo(self.bom, 2) self._produce(mo, 1) - mo.post_inventory() + mo._post_inventory() self.assertEqual(self.component.value_svl, 8.8) self.assertEqual(self.product1.value_svl, 8.8) self.assertEqual(self.component.quantity_svl, 1) @@ -208,7 +211,7 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self._make_in_move(self.component, 1) mo = self._make_mo(self.bom, 2) self._produce(mo, 1) - mo.post_inventory() + mo._post_inventory() self.assertEqual(self.component.value_svl, 8.8) self.assertEqual(self.product1.value_svl, 7.2) self.assertEqual(self.component.quantity_svl, 1) @@ -246,7 +249,7 @@ class TestMrpValuationStandard(TestMrpValuationCommon): self._make_in_move(self.component, 1, 20) mo = self._make_mo(self.bom, 2) self._produce(mo, 1) - mo.post_inventory() + mo._post_inventory() self.assertEqual(self.component.value_svl, 15) self.assertEqual(self.product1.value_svl, 15) self.assertEqual(self.component.quantity_svl, 1) |
