summaryrefslogtreecommitdiff
path: root/addons/mrp_account
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2020-04-27 11:56:02 +0200
committerSimon Lejeune <sle@openerp.com>2020-06-15 16:59:41 +0200
commit0e2765f5fd0ca0079f1f024ec3a1448b6d2ea3db (patch)
tree90ea03d1aca1bf87a080775e7db07977b645c5cc /addons/mrp_account
parent1b6421285c6bc4c61be3242cea30c2813251cbc7 (diff)
[REF] mrp: no more produce wizard
Use a view similar as the pickings one. task-2241471
Diffstat (limited to 'addons/mrp_account')
-rw-r--r--addons/mrp_account/tests/test_mrp_account.py10
-rw-r--r--addons/mrp_account/tests/test_valuation_layers.py18
-rw-r--r--addons/mrp_account/views/mrp_production_views.xml2
3 files changed, 13 insertions, 17 deletions
diff --git a/addons/mrp_account/tests/test_mrp_account.py b/addons/mrp_account/tests/test_mrp_account.py
index 7f1660f3170..bd9adba0a5c 100644
--- a/addons/mrp_account/tests/test_mrp_account.py
+++ b/addons/mrp_account/tests/test_mrp_account.py
@@ -75,13 +75,9 @@ class TestMrpAccount(TestWorkOrderProcessCommon):
production_table.extra_cost = 20
production_table.action_confirm()
- produce_form = Form(self.env['mrp.product.produce'].with_context({
- 'active_id': production_table.id,
- 'active_ids': [production_table.id],
- }))
- produce_form.qty_producing = 1.0
- produce_wizard = produce_form.save()
- produce_wizard.do_produce()
+ mo_form = Form(production_table)
+ mo_form.qty_producing = 1
+ production_table = mo_form.save()
production_table.post_inventory()
move_value = production_table.move_finished_ids.filtered(lambda x: x.state == "done").stock_valuation_layer_ids.value
diff --git a/addons/mrp_account/tests/test_valuation_layers.py b/addons/mrp_account/tests/test_valuation_layers.py
index bf50edf042b..a116995a0c4 100644
--- a/addons/mrp_account/tests/test_valuation_layers.py
+++ b/addons/mrp_account/tests/test_valuation_layers.py
@@ -39,14 +39,11 @@ class TestMrpValuationCommon(TestStockValuationCommon):
return mo
def _produce(self, mo, quantity=0):
- produce_form = Form(self.env['mrp.product.produce'].with_context({
- 'active_id': mo.id,
- 'active_ids': [mo.id],
- }))
- if quantity:
- produce_form.qty_producing = quantity
- product_produce = produce_form.save()
- product_produce.do_produce()
+ mo_form = Form(mo)
+ if not quantity:
+ quantity = mo.product_qty - mo.qty_produced
+ mo_form.qty_producing += quantity
+ mo = mo_form.save()
class TestMrpValuationStandard(TestMrpValuationCommon):
@@ -94,7 +91,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_close_mo()
+ 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)
diff --git a/addons/mrp_account/views/mrp_production_views.xml b/addons/mrp_account/views/mrp_production_views.xml
index 69652e0d26a..4b693206991 100644
--- a/addons/mrp_account/views/mrp_production_views.xml
+++ b/addons/mrp_account/views/mrp_production_views.xml
@@ -5,7 +5,7 @@
<field name="inherit_id" ref="mrp.mrp_production_form_view" />
<field name="groups_id" eval="[(4, ref('stock.group_stock_manager'))]"/>
<field name="arch" type="xml">
- <xpath expr="//field[@name='finished_move_line_ids']" position="before">
+ <xpath expr="//field[@name='product_id']" position="before">
<field name="show_valuation" invisible="1"/>
</xpath>
<xpath expr="//button[@name='action_view_mrp_production_sources']" position="after">