diff options
| author | Rémy Voet (ryv) <ryv@odoo.com> | 2020-07-01 12:50:04 +0000 |
|---|---|---|
| committer | Rémy Voet (ryv) <ryv@odoo.com> | 2020-07-30 12:09:10 +0000 |
| commit | e7fd2ba5c88eda06363389339eb651cc541fc4dd (patch) | |
| tree | 532ad6f86a82ac56bdfdf362134f9e1a1054178b /addons/mrp_subcontracting/views | |
| parent | 2458098f606931a845b5acbe0aa9ede89a6a94c3 (diff) | |
[FIX] mrp_subcontracting: fix flow with tracked component
After the odoo/odoo#52949 , the registering of tracked component,
in case of subcontracting, was broken. Fix and try to mimic
the same flow than before. The produce wizard has been replaced
by a clean MO form to register component and use backorder mechanisme
of MO to manage tracked finished product + tracked component.
task-2278147
closes odoo/odoo#54994
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/mrp_subcontracting/views')
| -rw-r--r-- | addons/mrp_subcontracting/views/mrp_production_views.xml | 54 | ||||
| -rw-r--r-- | addons/mrp_subcontracting/views/stock_move_views.xml | 104 |
2 files changed, 140 insertions, 18 deletions
diff --git a/addons/mrp_subcontracting/views/mrp_production_views.xml b/addons/mrp_subcontracting/views/mrp_production_views.xml new file mode 100644 index 00000000000..657bcaaf7e1 --- /dev/null +++ b/addons/mrp_subcontracting/views/mrp_production_views.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="mrp_production_subcontracting_form_view" model="ir.ui.view"> + <field name="name">mrp.production.subcontracting.form.view</field> + <field name="model">mrp.production</field> + <field name="mode">primary</field> + <field name="priority">1000</field> + <field name="inherit_id" ref="mrp.mrp_production_form_view" /> + <field name="arch" type="xml"> + <xpath expr="//header" position="replace"> + <field name="state" invisible="1"/> + </xpath> + <xpath expr="//div[@name='button_box']" position="replace"/> + <xpath expr="//group[@name='group_extra_info']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> + <xpath expr="//page[@name='operations']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> + <xpath expr="//field[@name='lot_producing_id']" position="attributes"> + <attribute name="attrs">{'invisible': [('product_tracking', 'in', ('none', False))], 'required': [('product_tracking', 'not in', ('none', False))]}</attribute> + </xpath> + <xpath expr="//page[@name='miscellaneous']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> + <xpath expr="//field[@name='name']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> + <xpath expr="//field[@name='bom_id']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> + <xpath expr="//button[@name='action_generate_serial']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> + <xpath expr="//field[@name='move_raw_ids']" position="attributes"> + <attribute name="invisible">1</attribute> + <attribute name="readonly">1</attribute> + </xpath> + <xpath expr="//field[@name='move_raw_ids']" position="after"> + <field name="move_line_raw_ids" force_save="1" + context="{'tree_view_ref': 'mrp_subcontracting.mrp_subcontracting_stock_move_line_tree_view', 'default_company_id': company_id, 'default_location_id': location_src_id, 'default_location_dest_id': production_location_id}" + /> + </xpath> + <xpath expr="//sheet" position="inside"> + <footer> + <button name="subcontracting_record_component" attrs="{'invisible': ['|', ('state', '=', 'to_close'), ('qty_producing', '<', 0.001)]}" string="Continue" type="object" class="oe_highlight"/> + <button name="subcontracting_record_component" attrs="{'invisible': [('state', '!=', 'to_close')]}" string="Record Production" type="object" class="oe_highlight"/> + <button string="Discard" special="cancel" /> + </footer> + </xpath> + </field> + </record> +</odoo> + diff --git a/addons/mrp_subcontracting/views/stock_move_views.xml b/addons/mrp_subcontracting/views/stock_move_views.xml index 58159cc81c9..e2c52941da4 100644 --- a/addons/mrp_subcontracting/views/stock_move_views.xml +++ b/addons/mrp_subcontracting/views/stock_move_views.xml @@ -1,41 +1,109 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> + + <record id="mrp_subcontracting_stock_move_line_tree_view" model="ir.ui.view"> + <field name="name">mrp.subcontracting.stock.move.line.tree.view</field> + <field name="model">stock.move.line</field> + <field name="priority">1000</field> + <field name="arch" type="xml"> + <tree editable="bottom"> + <field name="company_id" invisible="1"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="owner_id" invisible="1"/> + <field name="tracking" invisible="1"/> + <field name="package_id" invisible="1"/> + <field name="result_package_id" invisible="1"/> + <field name="location_id" invisible="1"/> + <field name="location_dest_id" invisible="1"/> + <field name="state" invisible="1"/> + <!-- Don't put move_id here to avoid that the framework send falsy move_id --> + <field name="id" invisible="1"/> + <field name="product_id" required="1"/> + <field name="lot_id" + attrs="{'invisible': [('tracking', 'not in', ('serial', 'lot'))], 'required': [('tracking', 'in', ('serial', 'lot'))]}" + context="{'default_product_id': product_id, 'default_company_id': company_id}"/> + <field name="product_uom_qty" readonly="1" force_save="1"/> + <field name="qty_done"/> + <field name="product_uom_id" groups="uom.group_uom"/> + </tree> + </field> + </record> <record id="mrp_subcontracting_move_form_view" model="ir.ui.view"> <field name="name">mrp.subcontracting.move.form.view</field> <field name="model">stock.move</field> <field name="priority">1000</field> <field name="arch" type="xml"> <form create="0" delete="0"> + <header> + <field name="state" widget="statusbar"/> + </header> <sheet> + <field name="product_uom_category_id" invisible="1"/> <field name="company_id" invisible="1"/> <field name="product_id" invisible="1"/> - <field name="finished_lots_exist" invisible="1"/> - <field name="state" invisible="1"/> - <field name="move_line_ids" context="{'default_product_id': product_id}" attrs="{'readonly': [('state', 'in', ['done', 'cancel'])]}"> + <field name="sequence" invisible="1"/> + <field name="location_id" invisible="1"/> + <field name="picking_id" invisible="1"/> + <field name="location_dest_id" invisible="1"/> + <field name="has_tracking" invisible="1"/> + <field name="product_uom_qty" invisible="1"/> + <group> + <field name="order_finished_lot_ids" widget="many2many_tags"/> + <field name="product_uom" groups="uom.group_uom"/> + <field name="quantity_done" string="Total Consumed" readonly="1"/> + </group> + <field name="move_line_ids" + attrs="{'readonly': [('state', 'in', ['done', 'cancel'])]}" + context="{'default_product_uom_id': product_uom, 'default_picking_id': picking_id, 'default_move_id': id, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_company_id': company_id}"> <tree editable="bottom" decoration-muted="state in ('done', 'cancel')"> <field name="company_id" invisible="1"/> <field name="state" invisible="1"/> <field name="tracking" invisible="1"/> - <field name="product_id" readonly="1"/> + <field name="product_uom_id" invisible="1"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="picking_id" invisible="1"/> + <field name="move_id" invisible="1"/> + <field name="location_id" invisible="1"/> + <field name="location_dest_id" invisible="1"/> + <field name="product_id" readonly="1" force_save="1"/> <field name="qty_done"/> - <field name="lot_id" context="{'default_product_id': product_id}"/> + <field name="lot_id" attrs="{'column_invisible':[('parent.has_tracking', 'not in', ('serial', 'lot'))], 'required': [('tracking', 'in', ('serial', 'lot'))]}" context="{'default_product_id': product_id, 'default_company_id': company_id}"/> </tree> </field> </sheet> </form> </field> </record> - <!-- <record id="mrp_subcontracting_move_tree_view" model="ir.ui.view"> --> - <!-- <field name="name">mrp.subcontracting.move.tree.view</field> --> - <!-- <field name="model">stock.move</field> --> - <!-- <field name="priority">1000</field> --> - <!-- <field name="mode">primary</field> --> - <!-- <field name="inherit_id" ref="mrp.view_stock_move_raw_tree"/> --> - <!-- <field name="arch" type="xml"> --> - <!-- <xpath expr="//tree" position="attributes"> --> - <!-- <attribute name="create">0</attribute> --> - <!-- <attribute name="delete">0</attribute> --> - <!-- </xpath> --> - <!-- </field> --> - <!-- </record> --> + <record id="mrp_subcontracting_move_tree_view" model="ir.ui.view"> + <field name="name">mrp.subcontracting.move.tree.view</field> + <field name="model">stock.move</field> + <field name="priority">1000</field> + <field name="arch" type="xml"> + <tree delete="0" create="0" decoration-muted="is_done" decoration-warning="quantity_done - product_uom_qty > 0.0001" decoration-success="not is_done and quantity_done - product_uom_qty < 0.0001"> + <field name="company_id" invisible="1"/> + <field name="sequence" invisible="1"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="name" invisible="1"/> + <field name="unit_factor" invisible="1"/> + <field name="date" invisible="1"/> + <field name="date_expected" invisible="1"/> + <field name="picking_type_id" invisible="1"/> + <field name="has_tracking" invisible="1"/> + <field name="operation_id" invisible="1"/> + <field name="is_done" invisible="1"/> + <field name="bom_line_id" invisible="1"/> + <field name="location_id" invisible="1"/> + <field name="warehouse_id" invisible="1"/> + <field name="product_uom_qty" invisible="1"/> + <field name="location_dest_id" invisible="1"/> + <field name="state" invisible="1" force_save="1"/> + <field name="raw_material_production_id" invisible="1"/> + <field name="product_id" required="1"/> + <field name="order_finished_lot_ids" widget="many2many_tags"/> + <field name="reserved_availability" attrs="{'invisible': [('is_done', '=', True)]}" string="Reserved"/> + <field name="quantity_done" string="Consumed" readonly="1"/> + <field name="product_uom" groups="uom.group_uom"/> + </tree> + </field> + </record> </odoo> |
