diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/mrp/views | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/mrp/views')
| -rw-r--r-- | addons/mrp/views/ir_attachment_view.xml | 95 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_bom_views.xml | 276 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_production_views.xml | 593 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_routing_views.xml | 86 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_templates.xml | 69 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_unbuild_views.xml | 213 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_views_menus.xml | 31 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_workcenter_views.xml | 606 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_workorder_views.xml | 496 | ||||
| -rw-r--r-- | addons/mrp/views/product_views.xml | 138 | ||||
| -rw-r--r-- | addons/mrp/views/res_config_settings_views.xml | 133 | ||||
| -rw-r--r-- | addons/mrp/views/stock_move_views.xml | 61 | ||||
| -rw-r--r-- | addons/mrp/views/stock_orderpoint_views.xml | 14 | ||||
| -rw-r--r-- | addons/mrp/views/stock_picking_views.xml | 116 | ||||
| -rw-r--r-- | addons/mrp/views/stock_scrap_views.xml | 25 | ||||
| -rw-r--r-- | addons/mrp/views/stock_warehouse_views.xml | 29 |
16 files changed, 2981 insertions, 0 deletions
diff --git a/addons/mrp/views/ir_attachment_view.xml b/addons/mrp/views/ir_attachment_view.xml new file mode 100644 index 00000000..cfc01b1f --- /dev/null +++ b/addons/mrp/views/ir_attachment_view.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Files --> + <record model="ir.ui.view" id="view_document_file_kanban_mrp"> + <field name="name">mrp.document kanban.mrp</field> + <field name="model">mrp.document</field> + <field name="arch" type="xml"> + <kanban js_class="mrp_documents_kanban" create="false"> + <field name="ir_attachment_id"/> + <field name="mimetype"/> + <field name="type"/> + <field name="name"/> + <field name="priority"/> + <field name="create_uid"/> + <templates> + <t t-name="kanban-box"> + <div class="oe_kanban_global_area o_kanban_attachment oe_kanban_global_click"> + <div class="o_kanban_image"> + <t t-set="binaryPreviewable" + t-value="new RegExp('(image|video|application/pdf|text)').test(record.mimetype.value) && record.type.raw_value === 'binary'"/> + <div t-attf-class="o_kanban_image_wrapper #{(webimage or binaryPreviewable) ? 'o_kanban_previewer' : ''}"> + <t t-set="webimage" t-value="new RegExp('image.*(gif|jpeg|jpg|png)').test(record.mimetype.value)"/> + <div t-if="record.type.raw_value == 'url'" class="o_url_image fa fa-link fa-3x text-muted" aria-label="Image is a link"/> + <img t-elif="webimage" t-attf-src="/web/image/#{record.ir_attachment_id.raw_value}" width="100" height="100" alt="Document" class="o_attachment_image"/> + <div t-else="" class="o_image o_image_thumbnail" t-att-data-mimetype="record.mimetype.value"/> + </div> + </div> + <div class="o_kanban_details"> + <div class="o_kanban_details_wrapper"> + <div class="o_kanban_record_title"> + <field name="name" class="o_text_overflow"/> + </div> + <div class="o_kanban_record_body"> + <field name="url" widget="url" attrs="{'invisible':[('type','=','binary')]}"/> + </div> + <div class="o_kanban_record_bottom"> + <span class="oe_kanban_bottom_left"> + <field name="priority" widget="priority"/> + </span> + <div class="oe_kanban_bottom_right"> + <field name="create_uid" widget="many2one_avatar_user"/> + </div> + </div> + <div class="o_dropdown_kanban dropdown" tabindex="-1"> + <a class="dropdown-toggle o-no-caret btn" data-toggle="dropdown" href="#" role="button" aria-label="Dropdown menu" title="Dropdown menu"> + <span class="fa fa-ellipsis-v"/> + </a> + <div class="dropdown-menu" role="menu" aria-labelledby="dLabel"> + <a t-if="widget.editable" type="edit" class="dropdown-item">Edit</a> + <a t-if="widget.deletable" type="delete" class="dropdown-item">Delete</a> + <a class="dropdown-item o_mrp_download">Download</a> + </div> + </div> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="view_mrp_document_form" model="ir.ui.view"> + <field name="name">mrp.document.form</field> + <field name="model">mrp.document</field> + <field name="arch" type="xml"> + <form string="Attachments"> + <sheet> + <label for="name" class="oe_edit_only"/> + <h1> + <field name="name"/> + </h1> + <group> + <group> + <field name="type"/> + <field name="datas" filename="name" attrs="{'invisible':[('type','=','url')]}"/> + <field name="url" widget="url" attrs="{'invisible':[('type','=','binary')]}"/> + </group> + <group string="Attached To" groups="base.group_no_one"> + <field name="res_name"/> + <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> + </group> + <group string="History" groups="base.group_no_one" attrs="{'invisible':[('create_date','=',False)]}"> + <label for="create_uid" string="Creation"/> + <div name="creation_div"> + <field name="create_uid" readonly="1" class="oe_inline"/> on + <field name="create_date" readonly="1" class="oe_inline"/> + </div> + </group> + </group> + </sheet> + </form> + </field> + </record> +</odoo> diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml new file mode 100644 index 00000000..142a4cc7 --- /dev/null +++ b/addons/mrp/views/mrp_bom_views.xml @@ -0,0 +1,276 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <!-- Bill of Materials --> + <record id="action_report_mrp_bom" model="ir.actions.client"> + <field name="name">BoM Structure & Cost</field> + <field name="tag">mrp_bom_report</field> + <field name="context" eval="{'model': 'report.mrp.report_bom_structure'}" /> + </record> + + <record id="mrp_bom_byproduct_form_view" model="ir.ui.view"> + <field name="name">mrp.bom.byproduct.form</field> + <field name="model">mrp.bom.byproduct</field> + <field name="arch" type="xml"> + <form string="Byproduct"> + <group> + <field name="allowed_operation_ids" invisible="1"/> + <field name="company_id"/> + <field name="product_id"/> + <label for="product_qty"/> + <div class="o_row"> + <field name="product_qty"/> + <field name="product_uom_id" groups="uom.group_uom"/> + </div> + <field name="operation_id" groups="mrp.group_mrp_routings" options="{'no_quick_create':True,'no_create_edit':True}"/> + </group> + </form> + </field> + </record> + + <record id="mrp_bom_form_view" model="ir.ui.view"> + <field name="name">mrp.bom.form</field> + <field name="model">mrp.bom</field> + <field name="priority">100</field> + <field name="arch" type="xml"> + <form string="Bill of Material"> + <sheet> + <div class="oe_button_box" name="button_box"> + <button name="%(action_mrp_routing_time)d" type="action" class="oe_stat_button" icon="fa-clock-o" groups="mrp.group_mrp_routings"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_text">Routing<br/>Performance</span> + </div> + </button> + <button name="%(action_report_mrp_bom)d" type="action" + class="oe_stat_button" icon="fa-bars" string="Structure & Cost"/> + </div> + <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/> + <group> + <group> + <field name="active" invisible="1"/> + <field name="product_tmpl_id" context="{'default_type': 'product'}"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="product_id" groups="product.group_product_variant" context="{'default_type': 'product'}"/> + <label for="product_qty" string="Quantity"/> + <div class="o_row"> + <field name="product_qty"/> + <field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/> + </div> + </group> + <group> + <field name="code"/> + <field name="type" widget="radio"/> + <p colspan="2" class="oe_grey oe_edit_only" attrs="{'invisible': [('type','!=','phantom')]}"> + <ul> + A BoM of type kit is used to split the product into its components. + <li> + At the creation of a Manufacturing Order. + </li> + <li> + At the creation of a Stock Transfer. + </li> + </ul> + </p> + <field name="company_id" groups="base.group_multi_company" options="{'no_create': True, 'no_open': True}"/> + </group> + </group> + <notebook> + <page string="Components" name="components"> + <field name="bom_line_ids" widget="one2many" context="{'default_parent_product_tmpl_id': product_tmpl_id, 'default_product_id': False, 'default_company_id': company_id, 'default_bom_id': id}"> + <tree string="Components" editable="bottom"> + <field name="company_id" invisible="1"/> + <field name="sequence" widget="handle"/> + <field name="product_id" context="{'default_type': 'product'}"/> + <field name="product_tmpl_id" invisible="1"/> + <button name="action_see_attachments" type="object" icon="fa-files-o" aria-label="Product Attachments" title="Product Attachments" class="float-right oe_read_only"/> + <field name="attachments_count" class="text-left oe_read_only" + string=" "/> + <field name="product_qty"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="parent_product_tmpl_id" invisible="1" /> + <field name="possible_bom_product_template_attribute_value_ids" invisible="1"/> + <field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/> + <field name="bom_product_template_attribute_value_ids" optional="hide" widget="many2many_tags" options="{'no_create': True}" attrs="{'column_invisible': [('parent.product_id', '!=', False)]}" groups="product.group_product_variant"/> + <field name="allowed_operation_ids" invisible="1"/> + <field name="operation_id" groups="mrp.group_mrp_routings" optional="hidden" attrs="{'column_invisible': [('parent.type','not in', ('normal', 'phantom'))]}" options="{'no_quick_create':True,'no_create_edit':True}"/> + </tree> + </field> + </page> + <page string="Operations" + name="operations" + attrs="{'invisible': [('type', 'not in',('normal','phantom'))]}" + groups="mrp.group_mrp_routings"> + <field name="operation_ids" + attrs="{'invisible': [('type','not in',('normal','phantom'))]}" + groups="mrp.group_mrp_routings" + context="{'bom_id_invisible': True, 'default_company_id': company_id, 'default_product_tmpl_ids': [product_tmpl_id]}"/> + </page> + <page string="By-products" + name="by_products" + attrs="{'invisible': [('type','!=','normal')]}" + groups="mrp.group_mrp_byproducts"> + <field name="byproduct_ids" context="{'form_view_ref' : 'mrp.mrp_bom_byproduct_form_view', 'default_company_id': company_id, 'default_bom_id': id}"> + <tree string="By-products" editable="top"> + <field name="company_id" invisible="1"/> + <field name="product_id" context="{'default_type': 'product'}"/> + <field name="product_qty"/> + <field name="product_uom_id" groups="uom.group_uom"/> + <field name="allowed_operation_ids" invisible="1"/> + <field name="operation_id" groups="mrp.group_mrp_routings" options="{'no_quick_create':True,'no_create_edit':True}"/> + </tree> + </field> + </page> + <page string="Miscellaneous" name="miscellaneous"> + <group> + <group> + <field name="ready_to_produce" attrs="{'invisible': [('type','=','phantom')]}" string="Manufacturing Readiness" widget="radio" groups="mrp.group_mrp_routings"/> + <field name="consumption" attrs="{'invisible': [('type','=','phantom')]}" widget="radio"/> + </group> + <group> + <field name="picking_type_id" attrs="{'invisible': [('type','=','phantom')]}" string="Operation" groups="stock.group_adv_location"/> + </group> + </group> + </page> + </notebook> + </sheet> + <div class="oe_chatter"> + <field name="message_follower_ids"/> + <field name="message_ids" colspan="4" nolabel="1"/> + </div> + </form> + </field> + </record> + + <record id="mrp_bom_tree_view" model="ir.ui.view"> + <field name="name">mrp.bom.tree</field> + <field name="model">mrp.bom</field> + <field name="arch" type="xml"> + <tree string="Bill of Materials" sample="1"> + <field name="active" invisible="1"/> + <field name="sequence" widget="handle"/> + <field name="product_tmpl_id"/> + <field name="code" optional="show"/> + <field name="type"/> + <field name="product_id" groups="product.group_product_variant" optional="hide"/> + <field name="company_id" groups="base.group_multi_company" optional="show"/> + <field name="product_qty" optional="hide"/> + <field name="product_uom_id" groups="uom.group_uom" optional="hide" string="Unit of Measure"/> + </tree> + </field> + </record> + + <record id="mrp_bom_kanban_view" model="ir.ui.view"> + <field name="name">mrp.bom.kanban</field> + <field name="model">mrp.bom</field> + <field name="arch" type="xml"> + <kanban class="o_kanban_mobile" sample="1"> + <field name="product_tmpl_id"/> + <field name="product_qty"/> + <field name="product_uom_id"/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_global_click"> + <div class="o_kanban_record_top"> + <div class="o_kanban_record_headings mt4"> + <strong class="o_kanban_record_title"><span clatt="mt4"><field name="product_tmpl_id"/></span></strong> + </div> + <span class="float-right badge badge-pill"><t t-esc="record.product_qty.value"/> <small><t t-esc="record.product_uom_id.value"/></small></span> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="view_mrp_bom_filter" model="ir.ui.view"> + <field name="name">mrp.bom.select</field> + <field name="model">mrp.bom</field> + <field name="arch" type="xml"> + <search string="Search Bill Of Material"> + <field name="code" string="Bill of Materials" filter_domain="['|', ('code', 'ilike', self), ('product_tmpl_id', 'ilike', self)]"/> + <field name="product_tmpl_id" string="Product"/> + <field name="bom_line_ids" string="Component"/> + <filter string="Manufacturing" name="normal" domain="[('type', '=', 'normal')]"/> + <filter string="Kit" name="phantom" domain="[('type', '=', 'phantom')]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/> + <group expand="0" string="Group By..."> + <filter string="Product" name="product" domain="[]" context="{'group_by': 'product_tmpl_id'}"/> + <filter string='BoM Type' name="group_by_type" domain="[]" context="{'group_by' : 'type'}"/> + <filter string='Unit of Measure' name="default_unit_of_measure" domain="[]" context="{'group_by' : 'product_uom_id'}"/> + </group> + </search> + </field> + </record> + + <record id="mrp_bom_form_action" model="ir.actions.act_window"> + <field name="name">Bills of Materials</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.bom</field> + <field name="domain">[]</field> <!-- force empty --> + <field name="view_mode">tree,kanban,form</field> + <field name="search_view_id" ref="view_mrp_bom_filter"/> + <field name="context">{'default_company_id': allowed_company_ids[0]}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No bill of materials found. Let's create one! + </p><p> + Bills of materials allow you to define the list of required raw + materials used to make a finished product; through a manufacturing + order or a pack of products. + </p> + </field> + </record> + + <menuitem id="menu_mrp_bom_form_action" + action="mrp_bom_form_action" + parent="menu_mrp_bom" + sequence="13"/> + + <!-- BOM Line --> + <record id="mrp_bom_line_view_form" model="ir.ui.view"> + <field name="name">mrp.bom.line.view.form</field> + <field name="model">mrp.bom.line</field> + <field name="arch" type="xml"> + <form string="Bill of Material line" create="0" edit="0"> + <sheet> + <group> + <group string="Component"> + <field name="product_id"/> + <field name="parent_product_tmpl_id" invisible="1"/> + <label for="product_qty" string="Quantity"/> + <div class="o_row"> + <field name="product_qty"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/> + </div> + <field name="possible_bom_product_template_attribute_value_ids" invisible="1"/> + <field name="bom_product_template_attribute_value_ids" widget="many2many_tags" options="{'no_create': True}" groups="product.group_product_variant"/> + </group> + <group string="Operation"> + <field name="company_id" invisible="1"/> + <field name="sequence" groups="base.group_no_one"/> + <field name="allowed_operation_ids" invisible="1"/> + <field name="operation_id" groups="mrp.group_mrp_routings"/> + </group> + </group> + </sheet> + </form> + </field> + </record> + + <record id="template_open_bom" model="ir.actions.act_window"> + <field name="context">{'default_product_tmpl_id': active_id, 'search_default_product_tmpl_id': active_id}</field> + <field name="name">Bill of Materials</field> + <field name="res_model">mrp.bom</field> + </record> + + <record id="product_open_bom" model="ir.actions.act_window"> + <field name="context">{'default_product_id': active_id, 'search_default_product_id': active_id}</field> + <field name="name">Bill of Materials</field> + <field name="res_model">mrp.bom</field> + <field name="domain">[]</field> <!-- Force empty --> + </record> + </data> +</odoo> diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml new file mode 100644 index 00000000..ee28c8f6 --- /dev/null +++ b/addons/mrp/views/mrp_production_views.xml @@ -0,0 +1,593 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <!-- Manufacturing Order --> + <record id="mrp_production_tree_view" model="ir.ui.view"> + <field name="name">mrp.production.tree</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <tree string="Manufacturing Orders" default_order="priority desc, date_planned_start desc" multi_edit="1" sample="1"> + <header> + <button name="button_plan" type="object" string="Plan"/> + <button name="do_unreserve" type="object" string="Unreserve"/> + </header> + <field name="priority" optional="show" widget="priority" nolabel="1"/> + <field name="message_needaction" invisible="1"/> + <field name="name" decoration-bf="1"/> + <field name="date_planned_start" readonly="1" optional="show" widget="remaining_days"/> + <field name="date_deadline" widget="remaining_days" attrs="{'invisible': [('state', 'in', ['done', 'cancel'])]}" optional="hide"/> + <field name="product_id" readonly="1" optional="show"/> + <field name="product_uom_id" string="Unit of Measure" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/> + <field name="lot_producing_id" optional="hide"/> + <field name="bom_id" readonly="1" optional="hide"/> + <field name="origin" optional="show"/> + <field name="user_id" optional="hide" widget="many2one_avatar_user"/> + <field name="reservation_state" optional="show"/> + <field name="product_qty" sum="Total Qty" string="Quantity" readonly="1" optional="show"/> + <field name="company_id" readonly="1" groups="base.group_multi_company" optional="show"/> + <field name="state" optional="show" widget='badge' decoration-success="state == 'done'" decoration-info="state not in ('done', 'cancel')"/> + <field name="activity_exception_decoration" widget="activity_exception"/> + <field name="delay_alert_date" invisible="1"/> + <field string=" " name="json_popover" widget="stock_rescheduling_popover" attrs="{'invisible': [('delay_alert_date', '=', False)]}"/> + </tree> + </field> + </record> + + <record id="production_order_server_action" model="ir.actions.server"> + <field name="name">Mrp: Plan Production Orders</field> + <field name="model_id" ref="mrp.model_mrp_production"/> + <field name="binding_model_id" ref="mrp.model_mrp_production"/> + <field name="binding_view_types">list</field> + <field name="groups_id" eval="[(4, ref('mrp.group_mrp_routings'))]"/> + <field name="state">code</field> + <field name="code">records.button_plan()</field> + </record> + + <record id="action_production_order_mark_done" model="ir.actions.server"> + <field name="name">Mark as Done</field> + <field name="model_id" ref="mrp.model_mrp_production"/> + <field name="binding_model_id" ref="mrp.model_mrp_production"/> + <field name="binding_view_types">list</field> + <field name="state">code</field> + <field name="code"> + if records: + res = records.filtered(lambda mo: mo.state in {'confirmed', 'to_close', 'progress'}).button_mark_done() + if res is not True: + action = res + </field> + </record> + + <record id="mrp_production_form_view" model="ir.ui.view"> + <field name="name">mrp.production.form</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <form string="Manufacturing Orders"> + <header> + <field name="confirm_cancel" invisible="1"/> + <field name="show_lock" invisible="1"/> + <button name="button_mark_done" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'cancel', 'done', 'to_close')), ('qty_producing', '=', 0)]}" string="Validate" type="object" class="oe_highlight"/> + <button name="button_mark_done" attrs="{'invisible': [ + '&', + '|', + ('state', 'not in', ('confirmed', 'progress')), + ('qty_producing', '!=', 0), + ('state', '!=', 'to_close')]}" string="Mark as Done" type="object" class="oe_highlight"/> + <button name="action_confirm" attrs="{'invisible': [('state', '!=', 'draft')]}" string="Confirm" type="object" class="oe_highlight"/> + <button name="button_plan" attrs="{'invisible': ['|', '|', ('state', 'not in', ('confirmed', 'progress', 'to_close')), ('workorder_ids', '=', []), ('is_planned', '=', True)]}" type="object" string="Plan" class="oe_highlight"/> + <button name="button_unplan" type="object" string="Unplan" attrs="{'invisible': [('is_planned', '=', False)]}"/> + <button name="action_assign" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done', 'cancel')), ('reserve_visible', '=', False)]}" string="Check availability" type="object"/> + <button name="button_unreserve" type="object" string="Unreserve" attrs="{'invisible': [('unreserve_visible', '=', False)]}"/> + <button name="button_scrap" type="object" string="Scrap" attrs="{'invisible': [('state', 'in', ('cancel', 'draft'))]}"/> + <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,progress,done"/> + <button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('show_lock', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="Unlock the manufacturing order to adjust what has been consumed or produced."/> + <button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('show_lock', '=', False), ('is_locked', '=', True)]}" string="Lock" groups="mrp.group_mrp_manager" type="object" help="Lock the manufacturing order to prevent changes to what has been consumed or produced."/>/> + <button name="action_cancel" type="object" string="Cancel" + attrs="{'invisible': ['|', '|', ('id', '=', False), ('state', 'in', ('done', 'cancel')), ('confirm_cancel', '=', True)]}"/> + <button name="action_cancel" type="object" string="Cancel" + attrs="{'invisible': ['|', '|', ('id', '=', False), ('state', 'in', ('done', 'cancel')), ('confirm_cancel', '=', False)]}" + confirm="Some product moves have already been confirmed, this manufacturing order can't be completely cancelled. Are you still sure you want to process ?"/> + <button name="button_unbuild" type="object" string="Unbuild" attrs="{'invisible': [('state', '!=', 'done')]}"/> + </header> + <sheet> + <field name="reservation_state" invisible="1"/> + <field name="date_planned_finished" invisible="1"/> + <field name="is_locked" invisible="1"/> + <field name="qty_produced" invisible="1"/> + <field name="unreserve_visible" invisible="1"/> + <field name="reserve_visible" invisible="1"/> + <field name="consumption" invisible="1"/> + <field name="is_planned" invisible="1"/> + <div class="oe_button_box" name="button_box"> + <button class="oe_stat_button" name="action_view_mrp_production_childs" type="object" icon="fa-wrench" attrs="{'invisible': [('mrp_production_child_count', '=', 0)]}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="mrp_production_child_count"/></span> + <span class="o_stat_text">Child MO</span> + </div> + </button> + <button class="oe_stat_button" name="action_view_mrp_production_sources" type="object" icon="fa-wrench" attrs="{'invisible': [('mrp_production_source_count', '=', 0)]}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="mrp_production_source_count"/></span> + <span class="o_stat_text">Source MO</span> + </div> + </button> + <button class="oe_stat_button" name="action_view_mrp_production_backorders" type="object" icon="fa-wrench" attrs="{'invisible': [('mrp_production_backorder_count', '<', 2)]}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="mrp_production_backorder_count"/></span> + <span class="o_stat_text">Backorders</span> + </div> + </button> + <button class="oe_stat_button" name="action_see_move_scrap" type="object" icon="fa-arrows-v" attrs="{'invisible': [('scrap_count', '=', 0)]}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="scrap_count"/></span> + <span class="o_stat_text">Scraps</span> + </div> + </button> + <button type="object" name="action_view_mo_delivery" class="oe_stat_button" icon="fa-truck" groups="base.group_user" attrs="{'invisible': [('delivery_count', '=', 0)]}"> + <field name="delivery_count" widget="statinfo" string="Transfers"/> + </button> + <button name="%(stock.action_stock_report)d" icon="fa-arrow-up" class="oe_stat_button" string="Traceability" type="action" states="done" groups="stock.group_production_lot"/> + <button name="%(action_mrp_production_moves)d" type="action" string="Product Moves" class="oe_stat_button" icon="fa-exchange" attrs="{'invisible': [('state', 'not in', ('progress', 'done'))]}"/> + </div> + <div class="oe_title"> + <h1> + <field name="priority" widget="priority" class="mr-3"/> + <field name="name" placeholder="Manufacturing Reference" nolabel="1"/> + </h1> + </div> + <group> + <group> + <field name="id" invisible="1"/> + <field name="use_create_components_lots" invisible="1"/> + <field name="show_lot_ids" invisible="1"/> + <field name="product_tracking" invisible="1"/> + <field name="product_id" context="{'default_type': 'product'}" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + <field name="product_tmpl_id" invisible="1"/> + <field name="product_description_variants" attrs="{'invisible': [('product_description_variants', 'in', (False, ''))], 'readonly': [('state', '!=', 'draft')]}"/> + <label for="product_qty" string="Quantity"/> + <div class="o_row no-gutters d-flex"> + <div attrs="{'invisible': [('state', '=', 'draft')]}" class="o_row"> + <field name="qty_producing" class="text-left" attrs="{'readonly': ['|', ('state', '=', 'cancel'), '&', ('state', '=', 'done'), ('is_locked', '=', True)]}"/> + / + </div> + <field name="product_qty" class="oe_inline text-left" attrs="{'readonly': [('state', '!=', 'draft')], 'invisible': [('state', 'not in', ('draft', 'done'))]}"/> + <button type="action" name="%(mrp.action_change_production_qty)d" + context="{'default_mo_id': id}" class="oe_link oe_inline" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done','cancel')), ('id', '=', False)]}"> + <field name="product_qty" class="oe_inline" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + </button> + <label for="product_uom_id" string="" class="oe_inline"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" force_save="1" groups="uom.group_uom" attrs="{'readonly': [('state', '!=', 'draft')]}" class="oe_inline"/> + <span class='text-bf'>To Produce</span> + </div> + <label for="lot_producing_id" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('product_tracking', 'in', ('none', False))]}"/> + <div class="o_row" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('product_tracking', 'in', ('none', False))]}"> + <field name="lot_producing_id" + context="{'default_product_id': product_id, 'default_company_id': company_id}" attrs="{'invisible': [('product_tracking', 'in', ('none', False))]}"/> + <button name="action_generate_serial" type="object" class="btn btn-primary fa fa-plus-square-o" aria-label="Creates a new serial/lot number" title="Creates a new serial/lot number" role="img" attrs="{'invisible': ['|', ('product_tracking', 'in', ('none', False)), ('lot_producing_id', '!=', False)]}"/> + </div> + <field name="bom_id" + context="{'default_product_tmpl_id': product_tmpl_id}" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + </group> + <group name="group_extra_info"> + <label for="date_planned_start"/> + <div class="o_row"> + <field name="date_planned_start" + attrs="{'readonly': [('state', 'in', ['done', 'cancel'])]}" + decoration-warning="state not in ('done', 'cancel') and date_planned_start < now" + decoration-danger="state not in ('done', 'cancel') and date_planned_start < current_date" + decoration-bf="state not in ('done', 'cancel') and (date_planned_start < current_date or date_planned_start < now)"/> + <field name="delay_alert_date" invisible="1"/> + <field string=" " name="json_popover" widget="stock_rescheduling_popover" attrs="{'invisible': [('delay_alert_date', '=', False)]}"/> + </div> + <field name="user_id" domain="[('share', '=', False)]"/> + <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}" force_save="1"/> + <field name="show_final_lots" invisible="1"/> + <field name="production_location_id" invisible="1" readonly="1"/> + <field name="move_finished_ids" invisible="1" attrs="{'readonly': ['|', ('state', '=', 'cancel'), '&', ('state', '=', 'done'), ('is_locked', '=', True)]}"> + <tree editable="bottom"> + <field name="product_id"/> + <field name="product_uom_qty"/> + <field name="product_uom"/> + <field name="operation_id"/> + <field name="byproduct_id"/> + <field name="name"/> + <field name="date_deadline"/> + <field name="picking_type_id"/> + <field name="location_id"/> + <field name="location_dest_id"/> + <field name="company_id"/> + <field name="warehouse_id"/> + <field name="origin"/> + <field name="group_id"/> + <field name="propagate_cancel"/> + <field name="move_dest_ids"/> + <field name="state"/> + <!-- Useless as the editable in tree declaration -> For Form Test--> + <field name="product_uom_category_id"/> + <field name="allowed_operation_ids"/> + </tree> + </field> + </group> + </group> + <notebook> + <page string="Components" name="components"> + <field name="move_raw_ids" + context="{'default_date': date_planned_start, 'default_date_deadline': date_deadline, 'default_location_id': location_src_id, 'default_location_dest_id': production_location_id, 'default_state': 'draft', 'default_raw_material_production_id': id, 'default_picking_type_id': picking_type_id, 'default_company_id': company_id}" + attrs="{'readonly': ['|', ('state', '=', 'cancel'), '&', ('state', '=', 'done'), ('is_locked', '=', True)]}" options="{'delete': [('state', '=', 'draft')]}"> + <tree default_order="is_done,sequence" editable="bottom"> + <field name="product_id" force_save="1" required="1" context="{'default_type': 'product'}" attrs="{'readonly': ['|', '|', ('has_move_lines', '=', True), ('state', '=', 'cancel'), '&', ('state', '!=', 'draft'), ('additional', '=', False) ]}"/> + + <field name="move_line_ids" invisible="1"> + <tree> + <field name="lot_id" invisible="1"/> + <field name="owner_id" 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="qty_done" invisible="1"/> + <field name="product_id" invisible="1"/> + <field name="product_uom_id" invisible="1"/> + <field name="product_uom_qty" invisible="1"/> + <field name="state" invisible="1"/> + <field name="move_id" invisible="1"/> + <field name="id" invisible="1"/> + </tree> + </field> + + <field name="company_id" invisible="1"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="name" invisible="1"/> + <field name="allowed_operation_ids" invisible="1"/> + <field name="unit_factor" invisible="1"/> + <field name="date_deadline" invisible="1"/> + <field name="date" invisible="1"/> + <field name="additional" 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="sequence" invisible="1"/> + <field name="location_id" invisible="1"/> + <field name="warehouse_id" invisible="1"/> + <field name="is_locked" invisible="1"/> + <field name="has_move_lines" invisible="1"/> + <field name="location_dest_id" domain="[('id', 'child_of', parent.location_dest_id)]" invisible="1"/> + <field name="state" invisible="1" force_save="1"/> + <field name="should_consume_qty" invisible="1"/> + <field name="product_uom_qty" widget="mrp_should_consume" string="To Consume" attrs="{'readonly': ['&', ('parent.state', '!=', 'draft'), '|', ('parent.state', 'not in', ('confirmed', 'progress', 'to_close')), ('parent.is_locked', '=', True)]}" width="1"/> + <field name="product_type" invisible="1"/> + <field name="product_qty" invisible="1" readonly="1"/> + <field name="reserved_availability" invisible="1"/> + <field name="forecast_expected_date" invisible="1"/> + <field name="forecast_availability" string="Reserved" attrs="{'column_invisible': [('parent.state', 'in', ['draft', 'done'])]}" widget="forecast_widget"/> + <field name="is_quantity_done_editable" invisible="1"/> + <field name="quantity_done" string="Consumed" + decoration-success="not is_done and (quantity_done - should_consume_qty == 0)" + decoration-warning="not is_done and (quantity_done - should_consume_qty > 0.0001)" + attrs="{'column_invisible': [('parent.state', '=', 'draft')], 'readonly': [('show_details_visible', '=', True)]}"/> + <field name="product_uom" attrs="{'readonly': [('state', '!=', 'draft')]}" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom"/> + <field name="show_details_visible" invisible="1"/> + <field name="lot_ids" widget="many2many_tags" + groups="stock.group_production_lot" optional="hide" + attrs="{'invisible': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')], 'column_invisible': [('parent.show_lot_ids', '=', False)]}" + options="{'create': [('parent.use_create_components_lots', '!=', False)]}" + context="{'default_company_id': company_id, 'default_product_id': product_id}" + domain="[('product_id','=',product_id)]" + /> + <field name="group_id" invisible="1"/> + <button name="action_show_details" type="object" icon="fa-list" context="{'default_product_uom_qty': 0}" attrs="{'invisible': [('show_details_visible', '=', False)]}" options="{"warn": true}"/> + </tree> + </field> + </page> + <page string="Work Orders" name="operations" groups="mrp.group_mrp_routings"> + <field name="workorder_ids" attrs="{'readonly': [('state', 'in', ['cancel', 'done'])]}" context="{'tree_view_ref': 'mrp.mrp_production_workorder_tree_editable_view', 'default_product_uom_id': product_uom_id, 'default_consumption': consumption, 'default_company_id': company_id}"/> + </page> + <page string="By-Products" name="finished_products" groups="mrp.group_mrp_byproducts"> + <field name="move_byproduct_ids" context="{'default_date': date_planned_finished, 'default_date_deadline': date_deadline, 'default_location_id': production_location_id, 'default_location_dest_id': location_src_id, 'default_state': 'draft', 'default_production_id': id, 'default_picking_type_id': picking_type_id, 'default_company_id': company_id}" attrs="{'readonly': ['|', ('state', '=', 'cancel'), '&', ('state', '=', 'done'), ('is_locked', '=', True)]}" options="{'delete': [('state', '=', 'draft')]}"> + <tree default_order="is_done,sequence" decoration-muted="is_done" editable="bottom"> + <field name="byproduct_id" invisible="1"/> + <field name="product_id" context="{'default_type': 'product'}" domain="[('id', '!=', parent.product_id)]" required="1"/> + + <field name="move_line_ids" invisible="1"> + <tree> + <field name="lot_id" invisible="1"/> + <field name="owner_id" 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="qty_done" invisible="1"/> + <field name="product_id" invisible="1"/> + <field name="product_uom_id" invisible="1"/> + <field name="product_uom_qty" invisible="1"/> + <field name="state" invisible="1"/> + <field name="move_id" invisible="1"/> + <field name="id" invisible="1"/> + </tree> + </field> + + <field name="company_id" invisible="1"/> + <field name="product_uom_category_id" invisible="1"/> + <field name="name" invisible="1"/> + <field name="allowed_operation_ids" invisible="1"/> + <field name="unit_factor" invisible="1"/> + <field name="date" invisible="1"/> + <field name="additional" 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="sequence" invisible="1"/> + <field name="location_id" invisible="1"/> + <field name="warehouse_id" invisible="1"/> + <field name="is_locked" invisible="1"/> + <field name="has_move_lines" invisible="1"/> + <field name="location_dest_id" domain="[('id', 'child_of', parent.location_dest_id)]" invisible="1"/> + <field name="state" invisible="1" force_save="1"/> + <field name="product_uom_qty" string="To Produce" attrs="{'readonly': ['&', ('parent.state', '!=', 'draft'), '|', ('parent.state', 'not in', ('confirmed', 'progress', 'to_close')), ('parent.is_locked', '=', True)]}"/> + <field name="is_quantity_done_editable" invisible="1"/> + <field name="quantity_done" string="Produced" attrs="{'column_invisible': [('parent.state', '=', 'draft')], 'readonly': [('is_quantity_done_editable', '=', False)]}"/> + <field name="product_uom" groups="uom.group_uom"/> + <field name="show_details_visible" invisible="1"/> + <field name="lot_ids" widget="many2many_tags" + groups="stock.group_production_lot" + attrs="{'invisible': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')]}" + options="{'create': [('parent.use_create_components_lots', '!=', False)]}" + context="{'default_company_id': company_id, 'default_product_id': product_id}" + domain="[('product_id','=',product_id)]" + /> + <button name="action_show_details" type="object" icon="fa-list" attrs="{'invisible': [('show_details_visible', '=', False)]}" options="{"warn": true}"/> + </tree> + </field> + </page> + <page string="Miscellaneous" name="miscellaneous"> + <group> + <group> + <field name="picking_type_id" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + <field name="location_src_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + <field name="location_dest_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + </group> + <group> + <field name="origin"/> + <field name="date_deadline" + attrs="{'invisible': ['|', ('state', 'in', ('done', 'cancel')), ('date_deadline', '=', False)]}" + decoration-danger="date_deadline and date_deadline < current_date" + decoration-bf="date_deadline and date_deadline < current_date"/> + </group> + </group> + </page> + </notebook> + </sheet> + <div class="oe_chatter"> + <field name="message_follower_ids"/> + <field name="activity_ids"/> + <field name="message_ids"/> + </div> + </form> + </field> + </record> + + <record id="mrp_production_kanban_view" model="ir.ui.view"> + <field name="name">mrp.production.kanban</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <kanban class="o_kanban_mobile" sample="1"> + <field name="name"/> + <field name="product_id"/> + <field name="product_qty"/> + <field name="product_uom_id" options="{'no_open':True,'no_create':True}"/> + <field name="date_planned_start"/> + <field name="state"/> + <field name="activity_state"/> + <progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_card oe_kanban_global_click"> + <div class="o_kanban_record_top"> + <field name="priority" widget="priority"/> + <div class="o_kanban_record_headings mt4 ml-1"> + <strong class="o_kanban_record_title"><span><t t-esc="record.product_id.value"/></span></strong> + </div> + <span class="float-right text-right"><t t-esc="record.product_qty.value"/> <small><t t-esc="record.product_uom_id.value"/></small></span> + </div> + <div class="o_kanban_record_bottom"> + <div class="oe_kanban_bottom_left text-muted"> + <span><t t-esc="record.name.value"/> <t t-esc="record.date_planned_start.value and record.date_planned_start.value.split(' ')[0] or False"/></span> + <field name="activity_ids" widget="kanban_activity"/> + <field name="delay_alert_date" invisible="1"/> + <field string=" " name="json_popover" widget="stock_rescheduling_popover" attrs="{'invisible': [('delay_alert_date', '=', False)]}"/> + </div> + <div class="oe_kanban_bottom_right"> + <span t-attf-class="badge #{['draft', 'cancel'].indexOf(record.state.raw_value) > -1 ? 'badge-secondary' : ['none'].indexOf(record.state.raw_value) > -1 ? 'badge-danger' : ['confirmed'].indexOf(record.state.raw_value) > -1 ? 'badge-warning' : ['done'].indexOf(record.state.raw_value) > -1 ? 'badge-success' : 'badge-primary'}"><t t-esc="record.state.value"/></span> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="view_production_calendar" model="ir.ui.view"> + <field name="name">mrp.production.calendar</field> + <field name="model">mrp.production</field> + <field eval="2" name="priority"/> + <field name="arch" type="xml"> + <calendar date_start="date_planned_start" date_stop="date_planned_finished" + string="Manufacturing Orders" event_limit="5" quick_add="False"> + <field name="user_id" avatar_field="image_128"/> + <field name="product_id"/> + <field name="product_qty"/> + </calendar> + </field> + </record> + + <record id="view_production_gantt" model="ir.ui.view"> + <field name="name">mrp.production.gantt</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <gantt date_stop="date_finished" date_start="date_start" string="Productions" create="0"> + </gantt> + </field> + </record> + + <record id="view_production_pivot" model="ir.ui.view"> + <field name="name">mrp.production.pivot</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <pivot string="Manufacturing Orders" sample="1"> + <field name="date_planned_start" type="row"/> + </pivot> + </field> + </record> + + <record id="view_production_graph" model="ir.ui.view"> + <field name="name">mrp.production.graph</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <graph string="Manufacturing Orders" type="line" sample="1"> + <field name="date_planned_finished"/> + </graph> + </field> + </record> + + <record id="view_mrp_production_filter" model="ir.ui.view"> + <field name="name">mrp.production.select</field> + <field name="model">mrp.production</field> + <field name="arch" type="xml"> + <search string="Search Production"> + <field name="name" string="Manufacturing Order" filter_domain="['|', ('name', 'ilike', self), ('origin', 'ilike', self)]"/> + <field name="product_id"/> + <field name="move_raw_ids" string="Component" filter_domain="[('move_raw_ids.product_id', 'ilike', self)]"/> + <field name="name" string="Work Center" filter_domain="[('bom_id.operation_ids.workcenter_id', 'ilike', self)]"/> + <field name="origin"/> + <filter string="To Do" name="todo" domain="[('state', 'in', ('draft', 'confirmed', 'progress', 'to_close'))]" + help="Manufacturing Orders which are in confirmed state."/> + <filter string="Starred" name="starred" domain="[('priority', '=', '1')]"/> + <separator/> + <filter string="Draft" name="filter_draft" domain="[('state', '=', 'draft')]"/> + <filter string="Confirmed" name="filter_confirmed" domain="[('state', '=', 'confirmed')]"/> + <filter string="Planned" name="filter_planned" domain="[('is_planned', '=', True)]" groups="mrp.group_mrp_routings"/> + <filter string="In Progress" name="filter_in_progress" domain="[('state', '=', 'progress')]"/> + <filter string="To Close" name="filter_to_close" domain="[('state', '=', 'to_close')]"/> + <filter string="Done" name="filter_done" domain="[('state', '=', 'done')]"/> + <filter string="Cancelled" name="filter_cancel" domain="[('state', '=', 'cancel')]"/> + <separator/> + <filter string="Waiting for Component" name="waiting" domain="[('reservation_state', 'in', ('waiting', 'confirmed'))]"/> + <filter string="Component Available" name="filter_ready" domain="[('reservation_state', '=', 'assigned')]"/> + <separator/> + <filter string="Planning Issues" name="planning_issues" help="Late MO or Late delivery of components" + domain="['|', ('delay_alert_date', '!=', False), '&', ('date_deadline', '<', current_date), ('state', '=', 'confirmed')]"/> + <separator/> + <filter invisible="1" string="Late Activities" name="activities_overdue" + domain="[('my_activity_date_deadline', '<', context_today().strftime('%Y-%m-%d'))]" + help="Show all records which has next action date is before today"/> + <filter invisible="1" string="Today Activities" name="activities_today" + domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/> + <filter invisible="1" string="Future Activities" name="activities_upcoming_all" + domain="[('my_activity_date_deadline', '>', context_today().strftime('%Y-%m-%d'))]"/> + <filter name="filter_date_planned_start" string="Scheduled Date" date="date_planned_start"/> + <separator/> + <filter string="Warnings" name="activities_exception" + domain="[('activity_exception_decoration', '!=', False)]"/> + <group expand="0" string="Group By..."> + <filter string="Product" name="product" domain="[]" context="{'group_by': 'product_id'}"/> + <filter string="Status" name="status" domain="[]" context="{'group_by': 'state'}"/> + <filter string="Material Availability" name="groupby_reservation_state" domain="[]" context="{'group_by': 'reservation_state'}"/> + <filter string="Scheduled Date" name="scheduled_date" domain="[]" context="{'group_by': 'date_planned_start'}" help="Scheduled Date by Month"/> + </group> + </search> + </field> + </record> + + <record id="mrp_production_action" model="ir.actions.act_window"> + <field name="name">Manufacturing Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.production</field> + <field name="view_mode">tree,kanban,form,calendar,pivot,graph</field> + <field name="view_id" eval="False"/> + <field name="search_view_id" ref="view_mrp_production_filter"/> + <field name="context">{'search_default_todo': True, 'default_company_id': allowed_company_ids[0]}</field> + <field name="domain">[('picking_type_id.active', '=', True)]</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No manufacturing order found. Let's create one. + </p><p> + Consume <a name="%(product.product_template_action)d" type='action' tabindex="-1">components</a> and build finished products using <a name="%(mrp_bom_form_action)d" type='action' tabindex="-1">bills of materials</a> + </p> + </field> + </record> + + <record id="mrp_production_action_picking_deshboard" model="ir.actions.act_window"> + <field name="name">Manufacturing Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.production</field> + <field name="view_mode">tree,kanban,form</field> + <field name="view_id" eval="False"/> + <field name="search_view_id" ref="view_mrp_production_filter"/> + <field name="domain">[('picking_type_id', '=', active_id)]</field> + <field name="context">{}</field> + </record> + + <record id="mrp_production_action_unreserve_tree" model="ir.actions.server"> + <field name="name">Unreserve</field> + <field name="model_id" ref="mrp.model_mrp_production"/> + <field name="binding_model_id" ref="mrp.model_mrp_production"/> + <field name="binding_view_types">list</field> + <field name="state">code</field> + <field name="code"> + if records: + records.do_unreserve() + </field> + </record> + + <menuitem action="mrp_production_action" + id="menu_mrp_production_action" + parent="menu_mrp_manufacturing" + sequence="1"/> + + <record id="mrp_production_report" model="ir.actions.act_window"> + <field name="name">Manufacturing Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.production</field> + <field name="view_mode">graph,pivot,form</field> + <field name="target">current</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No data yet! + </p><p> + Create a new manufacturing order + </p> + </field> + </record> + + <menuitem id="menu_mrp_workorder_todo" + name="Work Orders" + action="mrp_workorder_todo" + parent="menu_mrp_manufacturing" + groups="group_mrp_routings"/> + + <menuitem id="menu_mrp_production_report" + name="Manufacturing Orders" + parent="menu_mrp_reporting" + action="mrp_production_report" + sequence="11"/> + + <menuitem id="menu_mrp_work_order_report" + name="Work Orders" + parent="menu_mrp_reporting" + action="mrp_workorder_report" + groups="group_mrp_routings" + sequence="11"/> + + <record id="action_mrp_production_form" model="ir.actions.act_window"> + <field name="name">Manufacturing Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.production</field> + <field name="view_mode">form</field> + </record> + </data> +</odoo> diff --git a/addons/mrp/views/mrp_routing_views.xml b/addons/mrp/views/mrp_routing_views.xml new file mode 100644 index 00000000..4459cd3d --- /dev/null +++ b/addons/mrp/views/mrp_routing_views.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <!-- Routings Workcenter --> + <record id="mrp_routing_workcenter_tree_view" model="ir.ui.view"> + <field name="name">mrp.routing.workcenter.tree</field> + <field name="model">mrp.routing.workcenter</field> + <field name="arch" type="xml"> + <tree string="Routing Work Centers"> + <field name="sequence" widget="handle"/> + <field name="name"/> + <field name="workcenter_id"/> + <field name="time_cycle" widget="float_time" string="Duration (minutes)" sum="Total Duration" width="1.5"/> + </tree> + </field> + </record> + + <record id="mrp_routing_workcenter_form_view" model="ir.ui.view"> + <field name="name">mrp.routing.workcenter.form</field> + <field name="model">mrp.routing.workcenter</field> + <field name="arch" type="xml"> + <form string="Routing Work Centers"> + <sheet> + <group> + <group name="description"> + <field name="name"/> + <field name="workcenter_id" context="{'default_company_id': company_id}"/> + <field name="sequence" groups="base.group_no_one"/> + <field name="bom_id" invisible="context.get('bom_id_invisible', False)"/> + </group><group name="workorder"> + <field name="workorder_count" invisible="1"/> + <field name="time_mode" widget="radio"/> + <label for="time_mode_batch" attrs="{'invisible': [('time_mode', '=', 'manual')]}"/> + <div attrs="{'invisible': [('time_mode', '=', 'manual')]}"> + last + <field name="time_mode_batch" class="oe_inline"/> + work orders + </div> + <label for="time_cycle_manual" attrs="{'invisible': [('time_mode', '=', 'auto'), ('workorder_count', '!=' , 0)]}" string="Default Duration"/> + <div attrs="{'invisible': [('time_mode', '=', 'auto'), ('workorder_count', '!=' , 0)]}"> + <field name="time_cycle_manual" widget="float_time" class="oe_inline"/> minutes + </div> + <field name="time_cycle" invisible="1"/> + <field name="company_id" groups="base.group_multi_company" /> + </group> + </group> + <notebook> + <page string="Work Sheet" name="worksheet"> + <group> + <field name="worksheet_type" widget="radio"/> + <field name="worksheet" help="Upload your PDF file." widget="pdf_viewer" attrs="{'invisible': [('worksheet_type', '!=', 'pdf')], 'required': [('worksheet_type', '=', 'pdf')]}"/> + <field name="worksheet_google_slide" placeholder="Google Slide Link" widget="embed_viewer" attrs="{'invisible': [('worksheet_type', '!=', 'google_slide')], 'required': [('worksheet_type', '=', 'google_slide')]}"/> + <field name="note" attrs="{'invisible': [('worksheet_type', '!=', 'text')]}"/> + </group> + </page> + </notebook> + </sheet> + </form> + </field> + </record> + + <record id="mrp_routing_action" model="ir.actions.act_window"> + <field name="name">Operations</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.routing.workcenter</field> + <field name="view_mode">tree,form</field> + <field name="view_id" ref="mrp_routing_workcenter_tree_view"/> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Create a new operation + </p><p> + Operation define that need to be done to realize a Work Order. + Each operation is done at a specific Work Center and has a specific duration. + </p> + </field> + <field name="domain">['|', ('bom_id', '=', False), ('bom_id.active', '=', True)]</field> + </record> + + <menuitem id="menu_mrp_routing_action" + action="mrp_routing_action" + parent="menu_mrp_configuration" + groups="group_mrp_routings" + sequence="100"/> + + </data> +</odoo> diff --git a/addons/mrp/views/mrp_templates.xml b/addons/mrp/views/mrp_templates.xml new file mode 100644 index 00000000..713b71cf --- /dev/null +++ b/addons/mrp/views/mrp_templates.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <template id="assets_backend" name="mrp assets" inherit_id="web.assets_backend"> + <xpath expr="." position="inside"> + <link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_workorder_kanban.scss" /> + <script type="text/javascript" src="/mrp/static/src/js/mrp.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_bom_report.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_workorder_popover.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_documents_controller_mixin.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_documents_document_viewer.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_documents_kanban_controller.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_documents_kanban_record.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_documents_kanban_renderer.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_document_kanban_view.js"></script> + <script type="text/javascript" src="/mrp/static/src/js/mrp_should_consume.js"></script> + </xpath> + </template> + + <template id="assets_common" name="mrp bom common assets" inherit_id="web.assets_common"> + <xpath expr="." position="inside"> + <link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_bom_report.scss" /> + <link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_fields.scss" /> + <link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_gantt.scss" /> + <link rel="stylesheet" type="text/scss" href="/mrp/static/src/scss/mrp_document_kanban_view.scss" /> + </xpath> + </template> + + <template id="qunit_suite" inherit_id="web.qunit_suite_tests"> + <xpath expr="//script[last()]" position="after"> + <script type="text/javascript" src="/mrp/static/tests/mrp_tests.js"/> + <script type="text/javascript" src="/mrp/static/tests/mrp_document_kanban_tests.js"/> + </xpath> + </template> + + <template id="exception_on_mo"> + <div class="alert alert-warning" role="alert"> + Exception(s) occurred on the manufacturing order(s): + <a href="#" data-oe-model="mrp.production" t-att-data-oe-id="production_order.id"><t t-esc="production_order.name"/></a>. + Manual actions may be needed. + <div class="mt16"> + <p>Exception(s):</p> + <ul t-foreach="order_exceptions.items()" t-as="order_exception"> + <li> + <t t-set="move_raw_id" t-value="order_exception[0]"/> + <t t-set="exception" t-value="order_exception[1]"/> + <t t-set="order" t-value="exception[0]"/> + <t t-set="new_qty" t-value="exception[1][0]"/> + <t t-set="old_qty" t-value="exception[1][1]"/> + <a href="#" data-oe-model="mrp.production" t-att-data-oe-id="production_order.id"><t t-esc="production_order.name"/></a>: + <t t-esc="new_qty"/> <t t-esc="move_raw_id.product_uom.name"/> of <t t-esc="move_raw_id.product_id.name"/> + <t t-if="cancel"> + cancelled + </t> + <t t-if="not cancel"> + ordered instead of <t t-esc="old_qty"/> <t t-esc="move_raw_id.product_uom.name"/> + </t> + </li> + </ul> + </div> + <div class="mt16" t-if="not cancel and impacted_pickings"> + <p>Impacted Transfer(s):</p> + <ul t-foreach="impacted_pickings" t-as="picking"> + <li><a href="#" data-oe-model="stock.picking" t-att-data-oe-id="picking.id"><t t-esc="picking.name"/></a></li> + </ul> + </div> + </div> + </template> + +</odoo> diff --git a/addons/mrp/views/mrp_unbuild_views.xml b/addons/mrp/views/mrp_unbuild_views.xml new file mode 100644 index 00000000..28af1a01 --- /dev/null +++ b/addons/mrp/views/mrp_unbuild_views.xml @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Unbuild and scrap menu --> + + <record id="action_mrp_unbuild_moves" model="ir.actions.act_window"> + <field name="name">Stock Moves</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">stock.move.line</field> + <field name="view_mode">tree,form</field> + <field name="domain">['|', ('move_id.unbuild_id', '=', active_id), ('move_id.consume_unbuild_id', '=', active_id)]</field> + <field name="help" type="html"> + <p class="o_view_nocontent_empty_folder"> + There's no product move yet + </p><p> + This menu gives you the full traceability of inventory operations on a specific product. + You can filter on the product to see all the past movements for the product. + </p> + </field> + </record> + + <record id="mrp_unbuild_search_view" model="ir.ui.view"> + <field name="name">mrp.unbuild.search</field> + <field name="model">mrp.unbuild</field> + <field name="arch" type="xml"> + <search string="Search"> + <field name="product_id"/> + <field name="mo_id"/> + <group expand="0" string="Filters"> + <filter name="draft" string="Draft" domain="[('state', '=', 'draft')]"/> + <filter name="done" string="Done" domain="[('state', '=', 'done')]"/> + <filter invisible="1" string="Late Activities" name="activities_overdue" + domain="[('my_activity_date_deadline', '<', context_today().strftime('%Y-%m-%d'))]" + help="Show all records which has next action date is before today"/> + <filter invisible="1" string="Today Activities" name="activities_today" + domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/> + <filter invisible="1" string="Future Activities" name="activities_upcoming_all" + domain="[('my_activity_date_deadline', '>', context_today().strftime('%Y-%m-%d'))]"/> + </group> + <group expand='0' string='Group by...'> + <filter string='Product' name="productgroup" context="{'group_by': 'product_id'}"/> + <filter string="Manufacturing Order" name="mogroup" context="{'group_by': 'mo_id'}"/> + </group> + </search> + </field> + </record> + + <record id="mrp_unbuild_kanban_view" model="ir.ui.view"> + <field name="name">mrp.unbuild.kanban</field> + <field name="model">mrp.unbuild</field> + <field name="arch" type="xml"> + <kanban class="o_kanban_mobile" sample="1"> + <field name="name"/> + <field name="product_id"/> + <field name="product_qty"/> + <field name="product_uom_id"/> + <field name="state"/> + <field name="location_id"/> + <field name="activity_state"/> + <progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_global_click"> + <div class="o_kanban_record_top"> + <div class="o_kanban_record_headings mt4"> + <strong class="o_kanban_record_title"><span><field name="name"/></span></strong> + </div> + <strong><t t-esc="record.product_qty.value"/> <small><t t-esc="record.product_uom_id.value"/></small></strong> + </div> + <div class="row"> + <div class="col-8 text-muted"> + <span><t t-esc="record.product_id.value"/></span> + </div> + <div class="col-4"> + <span class="float-right text-right"> + <field name="state" widget="label_selection" options="{'classes': {'draft': 'default', 'done': 'success'}}" readonly="1"/> + </span> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="mrp_unbuild_form_view" model="ir.ui.view"> + <field name="name">mrp.unbuild.form</field> + <field name="model">mrp.unbuild</field> + <field name="arch" type="xml"> + <form string="Unbuild Orders"> + <header> + <button name="action_validate" string="Unbuild" type="object" states="draft" class="oe_highlight"/> + <field name="state" widget="statusbar" statusbar_visible="draft,done"/> + </header> + <sheet> + <div class="oe_button_box" name="button_box"> + <button class="oe_stat_button" name="%(action_mrp_unbuild_moves)d" + string="Product Moves" type="action" icon="fa-exchange" states="done"/> + </div> + <div class="oe_title"> + <h1><field name="name" placeholder="Unbuild Order" nolabel="1"/></h1> + </div> + <group> + <group> + <field name="product_id" attrs="{'readonly':['|', ('mo_id','!=',False), ('state', '=', 'done')]}" force_save="1"/> + <field name="mo_bom_id" invisible="1"/> + <field name="bom_id" attrs="{'required': [('mo_id', '=', False)], 'readonly':['|', ('mo_id','!=',False), ('state', '=', 'done')], 'invisible': [('mo_id', '!=', False), ('mo_bom_id', '=', False)]}" force_save="1"/> + <label for="product_qty"/> + <div class="o_row"> + <field name="product_qty" attrs="{'readonly': ['|', ('has_tracking', '=', 'serial'), ('state', '=', 'done')]}"/> + <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom" attrs="{'readonly': ['|', ('mo_id', '!=', False), ('state', '=', 'done')]}" force_save="1"/> + </div> + </group> + <group> + <field name="mo_id"/> + <field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/> + <field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/> + <field name="has_tracking" invisible="1"/> + <field name="allowed_mo_ids" invisible="1"/> + <field name="lot_id" attrs="{'invisible': [('has_tracking', '=', 'none')], 'required': [('has_tracking', '!=', 'none')]}" groups="stock.group_production_lot"/> + <field name="company_id" groups="base.group_multi_company"/> + </group> + </group> + </sheet> + <div class="oe_chatter"> + <field name="message_follower_ids"/> + <field name="activity_ids"/> + <field name="message_ids"/> + </div> + </form> + </field> + </record> + + <!-- simplified version of unbuild form for unbuild button via manufacturing order, + expects required fields to be filled in via 'default_' values --> + <record id="mrp_unbuild_form_view_simplified" model="ir.ui.view"> + <field name="name">mrp.unbuild.form.simplified</field> + <field name="model">mrp.unbuild</field> + <field name="arch" type="xml"> + <form string="Unbuild Order"> + <sheet> + <group> + <group> + <field name="state" invisible="1"/> + <field name="product_id" invisible="1"/> + <field name="bom_id" invisible="1"/> + <label for="product_qty"/> + <div class="o_row"> + <field name="product_qty" attrs="{'readonly': [('has_tracking', '=', 'serial')]}"/> + <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom" attrs="{'readonly': [('mo_id', '!=', False)]}" force_save="1"/> + </div> + </group> + <group> + <field name="mo_id" invisible="1"/> + <field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/> + <field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/> + <field name="has_tracking" invisible="1"/> + <field name="allowed_mo_ids" invisible="1"/> + <field name="lot_id" attrs="{'invisible': [('has_tracking', '=', 'none')], 'required': [('has_tracking', '!=', 'none')]}" groups="stock.group_production_lot"/> + <field name="company_id" groups="base.group_multi_company" readonly="1"/> + </group> + </group> + </sheet> + <footer class="oe_edit_only"> + <button name="action_validate" string="Unbuild" type="object" states="draft" class="oe_highlight"/> + <button string="Discard" special="cancel"/> + </footer> + </form> + </field> + </record> + + + <record id="mrp_unbuild_tree_view" model="ir.ui.view"> + <field name="name">mrp.unbuild.tree</field> + <field name="model">mrp.unbuild</field> + <field name="arch" type="xml"> + <tree sample="1"> + <field name="name" decoration-bf="1"/> + <field name="product_id"/> + <field name="bom_id"/> + <field name="mo_id"/> + <field name="lot_id" groups="stock.group_production_lot"/> + <field name="product_qty"/> + <field name="product_uom_id" groups="uom.group_uom"/> + <field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/> + <field name="activity_exception_decoration" widget="activity_exception"/> + <field name="company_id" groups="base.group_multi_company"/> + <field name="state" widget='badge' decoration-success="state == 'done'" decoration-info="state == 'draft'"/> + </tree> + </field> + </record> + + <record model="ir.actions.act_window" id="mrp_unbuild"> + <field name="name">Unbuild Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.unbuild</field> + <field name="view_mode">tree,kanban,form</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No unbuild order found + </p><p> + An unbuild order is used to break down a finished product into its components. + </p> + </field> + </record> + + <menuitem id="menu_mrp_unbuild" + name="Unbuild Orders" + parent="menu_mrp_manufacturing" + action="mrp_unbuild" + sequence="20"/> + +</odoo> diff --git a/addons/mrp/views/mrp_views_menus.xml b/addons/mrp/views/mrp_views_menus.xml new file mode 100644 index 00000000..747f2521 --- /dev/null +++ b/addons/mrp/views/mrp_views_menus.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <menuitem id="menu_mrp_root" + name="Manufacturing" + groups="group_mrp_user,group_mrp_manager" + web_icon="mrp,static/description/icon.png" + sequence="35"> + + <menuitem id="menu_mrp_manufacturing" + name="Operations" + sequence="10"/> + + <menuitem id="mrp_planning_menu_root" + name="Planning" + sequence="15"/> + + <menuitem id="menu_mrp_bom" + name="Products" + sequence="20"/> + + <menuitem id="menu_mrp_reporting" + name="Reporting" + sequence="25"/> + + <menuitem id="menu_mrp_configuration" + name="Configuration" + groups="group_mrp_manager" + sequence="100"/> + + </menuitem> +</odoo> diff --git a/addons/mrp/views/mrp_workcenter_views.xml b/addons/mrp/views/mrp_workcenter_views.xml new file mode 100644 index 00000000..1e989173 --- /dev/null +++ b/addons/mrp/views/mrp_workcenter_views.xml @@ -0,0 +1,606 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <record id="act_product_mrp_production_workcenter" model="ir.actions.act_window"> + <field name="context">{'search_default_confirmed': 1}</field> + <field name="name">Manufacturing Orders</field> + <field name="res_model">mrp.production</field> + <field name="view_mode">tree,kanban,form,gantt</field> + <field name="domain">[('bom_id', '!=', False), ('bom_id.operation_ids.workcenter_id', '=', active_id)]</field> + </record> + + <record id="action_work_orders" model="ir.actions.act_window"> + <field name="name">Work Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">tree,form,gantt,pivot,graph,calendar</field> + <field name="search_view_id" ref="view_mrp_production_work_order_search"/> + <field name="domain">[('state', 'not in', ('done', 'cancel'))]</field> + <field name="context">{'search_default_workcenter_id': active_id}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No work orders to do! + </p><p> + Work orders are operations to do as part of a manufacturing order. + Operations are defined in the bill of materials or added in the manufacturing order directly. + </p> + </field> + </record> + + <!-- Work Centers --> + <record id="mrp_workcenter_tree_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.tree</field> + <field name="model">mrp.workcenter</field> + <field name="arch" type="xml"> + <tree string="Work Center"> + <field name="sequence" widget="handle"/> + <field name="code"/> + <field name="name"/> + <field name="company_id" groups="base.group_multi_company"/> + <field name="active" invisible="1"/> + </tree> + </field> + </record> + + <record id="mrp_workcenter_view_kanban" model="ir.ui.view"> + <field name="name">mrp.workcenter.kanban</field> + <field name="model">mrp.workcenter</field> + <field name="arch" type="xml"> + <kanban class="o_kanban_mobile"> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_content oe_kanban_global_click"> + <div class="row"> + <div class="col-12"> + <strong><field name="name"/></strong> + </div> + <div class="col-12"> + <span>Code <field name="code"/></span> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="oee_pie_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.graph</field> + <field name="model">mrp.workcenter.productivity</field> + <field name="priority">20</field> + <field name="arch" type="xml"> + <graph string="Workcenter Productivity" type="pie" sample="1"> + <field name="loss_id"/> + <field name="duration" type="measure"/> + </graph> + </field> + </record> + <record model="ir.actions.act_window" id="mrp_workcenter_productivity_report_oee"> + <field name="name">Overall Equipment Effectiveness</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workcenter.productivity</field> + <field name="view_id" eval="oee_pie_view"/> + <field name="view_mode">graph,pivot,tree,form</field> + <field name="domain">[('workcenter_id','=',active_id')]</field> + <field name="context">{'search_default_thismonth':True}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Overall Equipment Effectiveness: no working or blocked time + </p> + </field> + </record> + <record model="ir.actions.act_window" id="mrp_workcenter_productivity_report_blocked"> + <field name="name">Productivity Losses</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workcenter.productivity</field> + <field name="view_mode">tree,form,graph,pivot</field> + <field name="context">{'search_default_availability': '1', + 'search_default_performance': '1', + 'search_default_quality': '1', + 'default_workcenter_id': active_id, + 'search_default_workcenter_id': [active_id]}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_empty_folder"> + No productivity loss for this equipment + </p> + </field> + </record> + + <record model="ir.actions.act_window" id="mrp_workorder_workcenter_report"> + <field name="name">Work Orders Performance</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="domain">[('workcenter_id','=', active_id),('state','=','done')]</field> + <field name="view_mode">graph,pivot,tree,form,gantt</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Create a new work orders performance + </p> + </field> + </record> + + <record model="ir.actions.act_window" id="mrp_workorder_report"> + <field name="name">Work Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="domain">[]</field> + <field name="context">{'search_default_done': True}</field> + <field name="view_mode">graph,pivot,tree,form,gantt</field> + <field name="search_view_id" ref="view_mrp_production_work_order_search"/> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Create a new work orders performance + </p> + </field> + </record> + + <!-- Workcenter Kanban view--> + <record model="ir.ui.view" id="mrp_workcenter_kanban"> + <field name="name">mrp.workcenter.kanban</field> + <field name="model">mrp.workcenter</field> + <field name="arch" type="xml"> + <kanban class="oe_background_grey o_kanban_dashboard o_workcenter_kanban" create="0" sample="1"> + <field name="name"/> + <field name="color"/> + <field name="workorder_count"/> + <field name="working_state"/> + <field name="oee_target"/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''}"> + <div t-attf-class="o_kanban_card_header o_kanban_record_top"> + <div class="o_kanban_record_headings o_kanban_card_header_title"> + <span class="o_primary ml8" style="display: inline-block"> + <field name="name"/> + </span> + </div> + <div class="o_kanban_manage_button_section"> + <a class="o_kanban_manage_toggle_button" href="#"><i class="fa fa-ellipsis-v" role="img" aria-label="Manage" title="Manage"/></a> + </div> + </div> + <div class="container o_kanban_card_content"> + <div class="row mb16"> + <div class="col-6 o_kanban_primary_left"> + <div class="btn-group" name="o_wo"> + <t t-if="record.workorder_count.raw_value > 0"> + <button class="btn btn-primary" name="action_work_order" type="object" context="{'search_default_ready': 1, 'search_default_progress': 1}"> + <span>WORK ORDERS</span> + </button> + </t> + <t t-if="record.workorder_count.raw_value <= 0"> + <button class="btn btn-warning" name="%(act_product_mrp_production_workcenter)d" type="action"> + <span>PLAN ORDERS</span> + </button> + </t> + </div> + </div> + <div class="col-6 o_kanban_primary_right"> + <div class="row" t-if="record.workorder_ready_count.raw_value > 0"> + <div class="col-8"> + <a name="action_work_order" type="object" context="{'search_default_ready': 1}"> + To Launch + </a> + </div> + <div class="col-4 text-right"> + <field name="workorder_ready_count"/> + </div> + </div> + <div class="row" t-if="record.workorder_progress_count.raw_value > 0"> + <div class="col-8"> + <a name="action_work_order" type="object" context="{'search_default_progress': 1}"> + In Progress + </a> + </div> + <div class="col-4 text-right"> + <field name="workorder_progress_count"/> + </div> + </div> + <div class="row" t-if="record.workorder_late_count.raw_value > 0"> + <div class="col-8"> + <a name="action_work_order" type="object" context="{'search_default_late': 1}"> + Late + </a> + </div> + <div class="col-4 text-right"> + <field name="workorder_late_count"/> + </div> + </div> + <div class="row" t-if="record.oee.raw_value > 0"> + <div class="col-6"> + <a name="%(mrp_workcenter_productivity_report_oee)d" type="action"> + OEE + </a> + </div> + <div class="col-6 text-right"> + <span t-att-class="record.oee_target.raw_value and (record.oee.raw_value < record.oee_target.raw_value) and 'text-danger' or (record.oee.raw_value > record.oee_target.raw_value) and 'text-success' or 'text-warning'"> + <strong> + <field name="oee"/>% + </strong> + </span> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-12 o_kanban_primary_left" style="position:absolute; bottom:10px;" name="wc_stages"> + <a name="%(act_mrp_block_workcenter)d" type="action" class="o_status float-right" + title="No workorder currently in progress. Click to mark work center as blocked." + aria-label="No workorder currently in progress. Click to mark work center as blocked." + attrs="{'invisible': [('working_state','in',('blocked','done'))]}"/> + <a name="unblock" type="object" class=" o_status o_status_red float-right" + title="Workcenter blocked, click to unblock." + aria-label="Workcenter blocked, click to unblock." + attrs="{'invisible': [('working_state','in',('normal','done'))]}"/> + <a name="%(act_mrp_block_workcenter)d" type="action" class="o_status o_status_green float-right" + title="Work orders in progress. Click to block work center." + aria-label="Work orders in progress. Click to block work center." + attrs="{'invisible': [('working_state','in',('normal','blocked'))]}"/> + </div> + </div> + </div><div class="container o_kanban_card_manage_pane dropdown-menu" role="menu"> + <div class="row"> + <div class="col-6 o_kanban_card_manage_section o_kanban_manage_view"> + <div role="menuitem" class="o_kanban_card_manage_title"> + <span>Actions</span> + </div> + <div role="menuitem" name="plan_order"> + <a name="action_work_order" type="object">Plan Orders</a> + </div> + </div> + <div class="col-6 o_kanban_card_manage_section o_kanban_manage_new"> + <div role="menuitem" class="o_kanban_card_manage_title"> + <span>Reporting</span> + </div> + <div role="menuitem"> + <a name="%(mrp_workcenter_productivity_report_oee)d" type="action">OEE</a> + </div> + <div role="menuitem"> + <a name="%(mrp_workorder_workcenter_report)d" type="action" context="{'search_default_thisyear':True}"> + Performance + </a> + </div> + <div role="menuitem"> + <a name="action_work_order" type="object" context="{'search_default_waiting': 1}">Waiting Availability</a> + </div> + </div> + </div> + + <div t-if="widget.editable" class="o_kanban_card_manage_settings row"> + <div role="menuitem" aria-haspopup="true" class="col-8"> + <ul role="menu" class="oe_kanban_colorpicker" data-field="color"/> + </div> + <div role="menuitem" class="col-4 text-right"> + <a type="edit">Settings</a> + </div> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="mrp_workcenter_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.form</field> + <field name="model">mrp.workcenter</field> + <field name="arch" type="xml"> + <form string="Work Center"> + <sheet> + <div class="oe_button_box" name="button_box"> + <button name="%(mrp_workcenter_productivity_report_oee)d" type="action" class="oe_stat_button" icon="fa-pie-chart"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="oee" widget="statinfo" nolabel="1"/>%</span> + <span class="o_stat_text">OEE</span> + </div> + </button> + <button name="%(mrp_workcenter_productivity_report_blocked)d" type="action" class="oe_stat_button" icon="fa-bar-chart"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="blocked_time" widget="statinfo" nolabel="1"/> Hours</span> + <span class="o_stat_text">Lost</span> + </div> + </button> + <button name="%(action_mrp_workcenter_load_report_graph)d" type="action" class="oe_stat_button" icon="fa-bar-chart" context="{'search_default_workcenter_id': id}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="workcenter_load" widget="statinfo" nolabel="1"/> Minutes</span> + <span class="o_stat_text">Load</span> + </div> + </button> + <button name="%(mrp_workorder_report)d" type="action" class="oe_stat_button" icon="fa-bar-chart" context="{'search_default_workcenter_id': id, 'search_default_thisyear': True}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="performance" widget="statinfo" nolabel="1"/>%</span> + <span class="o_stat_text">Performance</span> + </div> + </button> + </div> + <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/> + <group> + <group> + <field name="active" invisible="1"/> + <field name="name" string="Work Center Name" required="True"/> + <field + name="alternative_workcenter_ids" + widget="many2many_tags" + context="{'default_company_id': company_id}" + /> + </group> + <group> + <field name="code"/> + <field name="resource_calendar_id" required="1"/> + <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> + </group> + </group> + <notebook> + <page string="General Information" name="general_info"> + <group> + <group string="Production Information" name="capacity"> + <label for="time_efficiency"/> + <div class="o_row"> + <field name="time_efficiency"/> % + </div> + <field name="capacity"/> + + <label for="oee_target"/> + <div class="o_row"> + <field name="oee_target"/> % + </div> + </group> + <group string="Costing Information" name="costing"> + <field name="costs_hour"/> + </group> + <group> + <label for="time_start"/> + <div> + <field name="time_start" widget="float_time" class="oe_inline"/> minutes + </div> + <label for="time_stop"/> + <div> + <field name="time_stop" widget="float_time" class="oe_inline"/> minutes + </div> + </group> + </group> + <separator string="Description"/> + <field name="note" nolabel="1" placeholder="Description of the work center..."/> + </page> + </notebook> + </sheet> + </form> + </field> + </record> + + <record id="view_mrp_workcenter_search" model="ir.ui.view"> + <field name="name">mrp.workcenter.search</field> + <field name="model">mrp.workcenter</field> + <field name="arch" type="xml"> + <search string="Search for mrp workcenter"> + <field name="name" string="Work Center" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/> + <filter name="archived" string="Archived" domain="[('active', '=', False)]"/> + <group expand="0" string="Group By..."> + <filter string="Company" name="company" domain="[]" context="{'group_by': 'company_id'}" groups="base.group_multi_company"/> + </group> + </search> + </field> + </record> + + <record id="mrp_workcenter_action" model="ir.actions.act_window"> + <field name="name">Work Centers</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workcenter</field> + <field name="view_mode">tree,kanban,form</field> + <field name="view_id" ref="mrp_workcenter_tree_view"/> + <field name="view_ids" eval="[(5, 0, 0), + (0, 0, {'view_mode': 'tree', 'view_id': ref('mrp_workcenter_tree_view')}), + (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp_workcenter_view_kanban')}), + (0, 0, {'view_mode': 'form', 'view_id': ref('mrp_workcenter_view')})]"/> + <field name="search_view_id" ref="view_mrp_workcenter_search"/> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Create a new work center + </p><p> + Manufacturing operations are processed at Work Centers. A Work Center can be composed of + workers and/or machines, they are used for costing, scheduling, capacity planning, etc. + </p> + </field> + </record> + + <record id="mrp_workcenter_kanban_action" model="ir.actions.act_window"> + <field name="name">Work Centers Overview</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workcenter</field> + <field name="view_mode">kanban,form</field> + <field name="view_id" ref="mrp_workcenter_kanban"/> + <field name="search_view_id" ref="view_mrp_workcenter_search"/> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Create a new work center + </p><p> + Manufacturing operations are processed at Work Centers. A Work Center can be composed of + workers and/or machines, they are used for costing, scheduling, capacity planning, etc. + They can be defined via the configuration menu. + </p> + </field> + </record> + + <menuitem id="menu_view_resource_search_mrp" + action="mrp_workcenter_action" + groups="group_mrp_routings" + parent="menu_mrp_configuration" + sequence="90"/> + + <record id="oee_loss_form_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.loss.form</field> + <field name="model">mrp.workcenter.productivity.loss</field> + <field name="arch" type="xml"> + <form string="Workcenter Productivity Loss"> + <sheet> + <group> + <field name="name"/> + <field name="loss_id" widget="selection"/> + </group> + </sheet> + </form> + </field> + </record> + + <record id="oee_loss_tree_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.loss.tree</field> + <field name="model">mrp.workcenter.productivity.loss</field> + <field name="arch" type="xml"> + <tree string="Workcenter Productivity Loss" editable='bottom'> + <field name="sequence" widget="handle"/> + <field name="name"/> + <field name="loss_type" string="Category"/> + </tree> + </field> + </record> + + <record id="view_mrp_workcenter_productivity_loss_kanban" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.loss.kanban</field> + <field name="model">mrp.workcenter.productivity.loss</field> + <field name="arch" type="xml"> + <kanban> + <field name="name"/> + <field name="manual"/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_global_click"> + <div> + <strong>Reason: </strong><field name="name"/> + </div> + <div> + <strong>Effectiveness Category: </strong><field name="loss_type"/> + </div> + <div> + <strong>Is a Blocking Reason? </strong> + <span class="float-right" title="Is a Blocking Reason?"> + <field name="manual" widget="boolean"/> + </span> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record id="oee_loss_search_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.loss.search</field> + <field name="model">mrp.workcenter.productivity.loss</field> + <field name="arch" type="xml"> + <search string="Operations"> + <field name="name"/> + </search> + </field> + </record> + + <record id="oee_search_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.search</field> + <field name="model">mrp.workcenter.productivity</field> + <field name="arch" type="xml"> + <search string="Operations"> + <field name="workcenter_id"/> + <field name="workcenter_id"/> + <field name="loss_id"/> + <separator/> + <filter name="availability" string="Availability Losses" domain="[('loss_type','=','availability')]"/> + <filter name="performance" string="Performance Losses" domain="[('loss_type','=','performance')]"/> + <filter name="quality" string="Quality Losses" domain="[('loss_type','=','quality')]"/> + <filter name="productive" string="Fully Productive" domain="[('loss_type','=','productive')]"/> + <filter name="filter_date_start" string="Date" date="date_start"/> + <separator/> + <group expand='0' string='Group by...'> + <filter string="User" name="user" context="{'group_by': 'create_uid'}"/> + <filter string='Workcenter' name="workcenter_group" context="{'group_by': 'workcenter_id'}"/> + <filter string="Loss Reason" name="loss_group" context="{'group_by': 'loss_id'}"/> + </group> + </search> + </field> + </record> + + <record id="oee_form_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.form</field> + <field name="model">mrp.workcenter.productivity</field> + <field name="priority">5</field> + <field name="arch" type="xml"> + <form string="Workcenter Productivity"> + <group> + <group> + <field name="production_id"/> + <field name="workorder_id"/> + <field name="workcenter_id"/> + <field name="loss_id"/> + <field name="company_id" invisible="1"/> + </group><group> + <field name="date_start"/> + <field name="date_end"/> + <field name="duration"/> + <field name="company_id"/> + </group> + <field name="description"/> + </group> + </form> + </field> + </record> + + <record id="oee_tree_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.tree</field> + <field name="model">mrp.workcenter.productivity</field> + <field name="arch" type="xml"> + <tree string="Workcenter Productivity"> + <field name="date_start"/> + <field name="date_end"/> + <field name="workcenter_id"/> + <field name="user_id"/> + <field name="loss_id"/> + <field name="duration" string="Duration (minutes)" sum="Duration"/> + <field name="company_id" groups="base.group_multi_company"/> + </tree> + </field> + </record> + + <record id="oee_graph_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.graph</field> + <field name="model">mrp.workcenter.productivity</field> + <field name="arch" type="xml"> + <graph string="Workcenter Productivity" sample="1"> + <field name="workcenter_id"/> + <field name="loss_id"/> + <field name="duration" type="measure"/> + </graph> + </field> + </record> + + <record id="oee_pivot_view" model="ir.ui.view"> + <field name="name">mrp.workcenter.productivity.pivot</field> + <field name="model">mrp.workcenter.productivity</field> + <field name="arch" type="xml"> + <pivot string="Workcenter Productivity" sample="1"> + <field name="date_start" type="row" interval="day"/> + <field name="loss_type" type="col"/> + <field name="duration" type="measure"/> + </pivot> + </field> + </record> + + <record model="ir.actions.act_window" id="mrp_workcenter_productivity_report"> + <field name="name">Overall Equipment Effectiveness</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workcenter.productivity</field> + <field name="view_mode">graph,pivot,tree,form</field> + <field name="domain">[]</field> + <field name="context">{'search_default_workcenter_group': 1, 'search_default_thismonth':True, 'create':False,'edit':False}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + Overall Equipment Effectiveness: no working or blocked time + </p> + </field> + </record> + + <menuitem id="menu_mrp_workcenter_productivity_report" + parent="menu_mrp_reporting" + action="mrp_workcenter_productivity_report" + groups="group_mrp_routings" + sequence="12"/> + </data> +</odoo> diff --git a/addons/mrp/views/mrp_workorder_views.xml b/addons/mrp/views/mrp_workorder_views.xml new file mode 100644 index 00000000..c14794aa --- /dev/null +++ b/addons/mrp/views/mrp_workorder_views.xml @@ -0,0 +1,496 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="view_mrp_production_work_order_search" model="ir.ui.view"> + <field name="name">mrp.production.work.order.search</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <search> + <field name="production_id"/> + <field name="workcenter_id"/> + <filter string="Ready" name="ready" domain="[('state','=','ready')]"/> + <filter string="Pending" name="pending" domain="[('state','=','pending')]"/> + <filter string="In Progress" name="progress" domain="[('state','=','progress')]"/> + <filter string="Done" name="done" domain="[('state','=', 'done')]"/> + <filter string="Late" name="late" domain="[('date_planned_start','<=',time.strftime('%%Y-%%m-%%d'))]"/> + <separator/> + <filter string="Start Date" name="date_start_filter" date="date_start"/> + </search> + </field> + </record> + + <record id="action_mrp_routing_time" model="ir.actions.act_window"> + <field name="name">Work Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">graph,pivot,tree,form,gantt,calendar</field> + <field name="context">{'search_default_done': True}</field> + <field name="search_view_id" ref="view_mrp_production_work_order_search"/> + <field name="domain">[('operation_id.bom_id', '=', active_id), ('state', '=', 'done')]</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No data yet! + </p><p> + Get statistics about the work orders duration related to this routing. + </p> + </field> + </record> + + <record model="ir.actions.act_window" id="action_mrp_workorder_production_specific"> + <field name="name">Work Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">tree,form,gantt,calendar,pivot,graph</field> + <field name="domain">[('production_id', '=', active_id)]</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No work orders to do! + </p><p> + Work orders are operations to do as part of a manufacturing order. + Operations are defined in the bill of materials or added in the manufacturing order directly. + </p> + </field> + </record> + + <record model="ir.ui.view" id="mrp_production_workorder_tree_editable_view"> + <field name="name">mrp.production.work.order.tree.editable</field> + <field name="model">mrp.workorder</field> + <field name="priority" eval="100"/> + <field name="arch" type="xml"> + <tree editable="bottom"> + <field name="consumption" invisible="1"/> + <field name="company_id" invisible="1"/> + <field name="is_produced" invisible="1"/> + <field name="is_user_working" invisible="1"/> + <field name="name" invisible="1"/> + <field name="product_uom_id" invisible="1" readonly="0"/> + <field name="production_state" invisible="1"/> + <field name="production_bom_id" invisible="1"/> + <field name="qty_producing" invisible="1"/> + <field name="time_ids" invisible="1"/> + <field name="working_state" invisible="1"/> + <field name="operation_id" invisible="1" domain="['|', ('bom_id', '=', production_bom_id), ('bom_id', '=', False)]" context="{'default_workcenter_id': workcenter_id, 'default_company_id': company_id}"/> + <field name="name" string="Operation"/> + <field name="workcenter_id"/> + <field name="date_planned_start" optional="show"/> + <field name="date_planned_finished" optional="hide"/> + <field name="date_start" optional="hide" readonly="1"/> + <field name="date_finished" optional="hide" readonly="1"/> + <field name="duration_expected" widget="float_time"/> + <field name="duration" widget="mrp_time_counter" + attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}"/> + <field name="state" widget="badge" decoration-success="state == 'done'" decoration-info="state not in ('done', 'cancel')" attrs="{'invisible': [('production_state', 'in', ('draft', 'done'))]}"/> + <button name="button_start" type="object" string="Start" class="btn-success" + attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done')), ('working_state', '=', 'blocked'), ('state', '=', 'done'), ('is_user_working', '!=', False)]}"/> + <button name="button_pending" type="object" string="Pause" class="btn-warning" + attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/> + <button name="button_finish" type="object" string="Done" class="btn-success" + attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/> + <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="Block" context="{'default_workcenter_id': workcenter_id}" class="btn-danger" + attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done')), ('working_state', '=', 'blocked')]}"/> + <button name="button_unblock" type="object" string="Unblock" context="{'default_workcenter_id': workcenter_id}" class="btn-danger" + attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done')), ('working_state', '!=', 'blocked')]}"/> + <button name="action_open_wizard" type="object" icon="fa-external-link" class="oe_edit_only" + context="{'default_workcenter_id': workcenter_id}"/> + <field name="show_json_popover" invisible="1"/> + <field name="json_popover" widget="mrp_workorder_popover" string=" " width="0.1" attrs="{'invisible': [('show_json_popover', '=', False)]}"/> + </tree> + </field> + </record> + + <record id="mrp_production_workorder_tree_view" model="ir.ui.view"> + <field name="name">mrp.production.work.order.tree</field> + <field name="model">mrp.workorder</field> + <field name="mode">primary</field> + <field name="priority" eval="10"/> + <field name="inherit_id" ref="mrp.mrp_production_workorder_tree_editable_view"/> + <field name="arch" type="xml"> + <xpath expr="//tree" position="attributes"> + <attribute name="create">0</attribute> + <attribute name="sample">1</attribute> + </xpath> + <field name="workcenter_id" position="after"> + <field name="production_id"/> + </field> + </field> + </record> + + <record model="ir.ui.view" id="mrp_production_workorder_form_view_inherit"> + <field name="name">mrp.production.work.order.form</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <form string="Production Workcenter" delete="0" create="0"> + <field name="is_user_working" invisible="1"/> + <field name="working_state" invisible="1"/> + <field name="production_state" invisible="1"/> + <header> + <field name="state" widget="statusbar" statusbar_visible="pending,ready,progress,done"/> + </header> + <sheet> + <div class="oe_button_box" name="button_box"> + <button class="oe_stat_button" name="action_see_move_scrap" type="object" icon="fa-arrows-v" attrs="{'invisible': [('scrap_count', '=', 0)]}"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"><field name="scrap_count"/></span> + <span class="o_stat_text">Scraps</span> + </div> + </button> + </div> + <field name="workcenter_id" invisible="1"/> + <field name="company_id" invisible="1"/> + <field name="product_tracking" invisible="1"/> + <field name="product_id" invisible="1"/> + <field name="finished_lot_id" invisible="1"/> + <field name="qty_producing" invisible="1"/> + <group> + <group attrs="{'invisible': [('date_planned_start', '=', False)]}"> + <label for="date_planned_start" string="Planned Date"/> + <div class="oe_inline"> + <field name="date_planned_start" class="mr8 oe_inline" required="True"/> + <strong class="mr8 oe_inline">to</strong> + <field name="date_planned_finished" class="oe_inline" required="True"/> + <field name="show_json_popover" invisible="1"/> + <field name="json_popover" widget="mrp_workorder_popover" class="oe_inline mx-2" attrs="{'invisible': [('show_json_popover', '=', False)]}"/> + </div> + <label for="duration_expected"/> + <div class="o_row"> + <field name="duration_expected" widget="float_time"/> + <span>minutes</span> + </div> + </group> + </group> + <notebook> + <page string="Time Tracking" name="time_tracking" groups="mrp.group_mrp_manager"> + <group> + <field name="time_ids" nolabel="1" context="{'default_workcenter_id': workcenter_id, 'default_workorder_id': id}"> + <tree editable="bottom"> + <field name="date_start"/> + <field name="date_end"/> + <field name="duration" widget="float_time" sum="Total duration"/> + <field name="user_id"/> + <field name="workcenter_id" invisible="1"/> + <field name="company_id" invisible="1"/> + <field name="loss_id" string="Productivity" optional="hide"/> + </tree> + <form> + <group> + <group> + <field name="date_start"/> + <field name="date_end"/> + <field name="duration" widget="float_time"/> + <field name="company_id" invisible="1"/> + </group> + <group> + <field name="user_id"/> + <field name="workcenter_id"/> + <field name="company_id" invisible="1"/> + <field name="loss_id"/> + </group> + </group> + </form> + </field> + </group> + </page> + <page string="Work Instruction" name="workorder_page_work_instruction" attrs="{'invisible': [('worksheet', '=', False), ('worksheet_google_slide', '=', False), ('operation_note', '=', False)]}"> + <field name="worksheet_type" invisible="1"/> + <field name="worksheet" widget="pdf_viewer" attrs="{'invisible': [('worksheet_type', '!=', 'pdf')]}"/> + <field name="worksheet_google_slide" widget="embed_viewer" attrs="{'invisible': [('worksheet_type', '!=', 'google_slide')]}"/> + <field name="operation_note" attrs="{'invisible': [('worksheet_type', '!=', 'text')]}"/> + </page> + </notebook> + </sheet> + </form> + </field> + </record> + + <record id="view_mrp_production_workorder_form_view_filter" model="ir.ui.view"> + <field name="name">mrp.production.work.order.select</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <search string="Search Work Orders"> + <field name="name" string="Work Order"/> + <field name="workcenter_id"/> + <field name="production_id"/> + <filter string="In Progress" name="progress" domain="[('state', '=', 'progress')]"/> + <filter string="Ready" name="ready" domain="[('state', '=', 'ready')]"/> + <filter string="Pending" name="pending" domain="[('state', '=', 'pending')]"/> + <filter string="Finished" name="finish" domain="[('state', '=', 'done')]"/> + <filter string="Available" name="available" domain="[('production_availability', '=', 'assigned')]"/> + <separator/> + <filter string="Late" name="late" domain="['&', ('date_planned_start', '<', current_date), ('state', '=', 'ready')]" + help="Production started late"/> + <group expand="0" string="Group By"> + <filter string="Work Center" name="work_center" domain="[]" context="{'group_by': 'workcenter_id'}"/> + <filter string="Manufacturing Order" name="production" domain="[]" context="{'group_by': 'production_id'}"/> + <filter string="Status" name="status" domain="[]" context="{'group_by': 'state'}"/> + <filter string="Scheduled Date" name="scheduled_month" domain="[]" context="{'group_by': 'date_planned_start'}"/> + </group> + </search> + </field> + </record> + + <record id="workcenter_line_calendar" model="ir.ui.view"> + <field name="name">mrp.production.work.order.calendar</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <calendar date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" color="workcenter_id" event_limit="5" delete="0" create="0"> + <field name="workcenter_id" filters="1"/> + <field name="production_id"/> + <field name="state"/> + </calendar> + </field> + </record> + + <record id="workcenter_line_graph" model="ir.ui.view"> + <field name="name">mrp.production.work.order.graph</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <graph string="Operations" sample="1"> + <field name="production_id"/> + <field name="duration" type="measure"/> + </graph> + </field> + </record> + + <record id="workcenter_line_pivot" model="ir.ui.view"> + <field name="name">mrp.production.work.order.pivot</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <pivot string="Operations" sample="1"> + <field name="date_start"/> + <field name="operation_id"/> + <field name="duration" type="measure"/> + <field name="duration_expected" type="measure"/> + </pivot> + </field> + </record> + + <record id="workcenter_line_gantt_production" model="ir.ui.view"> + <field name="name">mrp.production.work.order.gantt.production</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" default_group_by="production_id" create="0" delete="0" + progress="progress" plan="0" + decoration-danger="json_popover and 'text-danger' in json_popover" + decoration-success="state == 'done'" + decoration-warning="state == 'cancel' or (json_popover and 'text-warning' in json_popover)" + color="workcenter_id" + display_unavailability="1" + sample="1" + form_view_id="%(mrp_production_workorder_form_view_inherit)d"> + + <field name="date_planned_start"/> + <field name="state"/> + <field name="workcenter_id"/> + <field name="json_popover"/> + + <templates> + <div t-name="gantt-popover" class="container-fluid"> + <div class="row no-gutters"> + <div class="col"> + <ul class="pl-1 mb-0 list-unstyled"> + <li><strong>Start Date: </strong> <t t-esc="userTimezoneStartDate.format('L LTS')"/></li> + <li><strong>Stop Date: </strong> <t t-esc="userTimezoneStopDate.format('L LTS')"/></li> + <li><strong>Workcenter: </strong> <t t-esc="workcenter_id[1]"/></li> + </ul> + </div> + </div> + </div> + </templates> + </gantt> + </field> + </record> + + <record id="mrp_workorder_view_gantt" model="ir.ui.view"> + <field name="name">mrp.workorder.view.gantt</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" string="Operations" default_group_by="workcenter_id" create="0" + delete="0" sample="1" + progress="progress" plan="0" + decoration-danger="json_popover and 'text-danger' in json_popover" + decoration-success="state == 'done'" + decoration-warning="state == 'cancel' or (json_popover and 'text-warning' in json_popover)" + color="production_id" + display_unavailability="1" + form_view_id="mrp_production_workorder_form_view_inherit"> + + <field name="date_planned_start"/> + <field name="state"/> + <field name="workcenter_id"/> + <field name="json_popover"/> + + <templates> + <div t-name="gantt-popover" class="container-fluid"> + <div class="row no-gutters"> + <div class="col"> + <ul class="pl-1 mb-0 list-unstyled"> + <li><strong>Start Date: </strong> <t t-esc="userTimezoneStartDate.format('L LTS')"/></li> + <li><strong>Stop Date: </strong> <t t-esc="userTimezoneStopDate.format('L LTS')"/></li> + <li><strong>Workcenter: </strong> <t t-esc="workcenter_id[1]"/></li> + </ul> + </div> + </div> + </div> + </templates> + </gantt> + </field> + </record> + + <record model="ir.ui.view" id="workcenter_line_kanban"> + <field name="name">mrp.production.work.order.kanban</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <kanban class="oe_background_grey o_kanban_dashboard o_mrp_workorder_kanban" create="0" sample="1"> + <field name="name"/> + <field name="production_id"/> + <field name="state" readonly="1"/> + <field name="is_user_working"/> + <field name="working_user_ids"/> + <field name="last_working_user_id"/> + <field name="working_state"/> + <field name="workcenter_id"/> + <field name="product_id"/> + <field name="qty_production"/> + <field name="product_uom_id"/> + <templates> + <t t-name="kanban-box"> + <div class="oe_kanban_global_click"> + <div class="o_kanban_card_header o_kanban_record_top"> + <div class="o_kanban_record_headings o_kanban_card_header_title"> + <strong class="o_primary ml8"> + <span><t t-esc="record.production_id.value"/></span> - <span><t t-esc="record.name.value"/></span> + </strong> + </div> + <div class="o_kanban_manage_button_section"> + <h2> + <span t-attf-class="badge #{['pending'].indexOf(record.state.raw_value) > -1 ? 'badge-warning' :['progress'].indexOf(record.state.raw_value) > -1 ? 'badge-secondary' : ['ready'].indexOf(record.state.raw_value) > -1 ? 'badge-primary' : ['done'].indexOf(record.state.raw_value) > -1 ? 'badge-success' : 'badge-danger'}"> + <t t-esc="record.state.value"/> + </span> + </h2> + </div> + </div> + <div class="container o_kanban_record_bottom"> + <h5 class="oe_kanban_bottom_left"> + <span><t t-esc="record.product_id.value"/>, </span> <span><t t-esc="record.qty_production.value"/> <t t-esc="record.product_uom_id.value"/></span> + </h5> + <div class="oe_kanban_bottom_right" t-if="record.state.raw_value == 'progress'"> + <span t-if="record.working_state.raw_value != 'blocked' and record.working_user_ids.raw_value.length > 0"><i class="fa fa-play" role="img" aria-label="Run" title="Run"/></span> + <span t-if="record.working_state.raw_value != 'blocked' and record.working_user_ids.raw_value.length == 0 and record.last_working_user_id.raw_value"><i class="fa fa-pause" role="img" aria-label="Pause" title="Pause"/></span> + <span t-if="record.working_state.raw_value == 'blocked' and (record.working_user_ids.raw_value.length == 0 or record.last_working_user_id.raw_value)"><i class="fa fa-stop" role="img" aria-label="Stop" title="Stop"/></span> + <t t-if="record.last_working_user_id.raw_value"> + <img t-att-src="kanban_image('res.users', 'image_128', record.last_working_user_id.raw_value)" class="oe_kanban_avatar" alt="Avatar"/> + </t> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record model="ir.actions.act_window" id="action_mrp_workorder_workcenter"> + <field name="name">Work Orders Planning</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">gantt,tree,form,calendar,pivot,graph</field> + <field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/> + <field name="view_id" ref="mrp_workorder_view_gantt"/> + <field name="context">{'search_default_work_center': True, 'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No work orders to do! + </p><p> + Work orders are operations to do as part of a manufacturing order. + Operations are defined in the bill of materials or added in the manufacturing order directly. + </p> + </field> + </record> + + <record model="ir.actions.act_window" id="action_mrp_workorder_production"> + <field name="name">Work Orders Planning</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="domain">[('production_state','not in',('done','cancel'))]</field> + <field name="view_mode">gantt,tree,form,calendar,pivot,graph</field> + <field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/> + <field name="view_id" ref="workcenter_line_gantt_production"/> + <field name="context">{'search_default_production': True, 'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No work orders to do! + </p><p> + Work orders are operations to do as part of a manufacturing order. + Operations are defined in the bill of materials or added in the manufacturing order directly. + </p> + </field> + </record> + + <record model="ir.actions.act_window" id="mrp_workorder_mrp_production_form"> + <field name="name">Work Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">form</field> + <field name="target">new</field> + <field name="view_id" ref="mrp_production_workorder_form_view_inherit"/> + </record> + + <record model="ir.actions.act_window" id="mrp_workorder_todo"> + <field name="name">Work Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">tree,kanban,form,calendar,pivot,graph,gantt</field> + <field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/> + <field name="context">{'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No work orders to do! + </p><p> + Work orders are operations to do as part of a manufacturing order. + Operations are defined in the bill of materials or added in the manufacturing order directly. + </p> + </field> + </record> + + <record id="view_workcenter_load_pivot" model="ir.ui.view"> + <field name="name">report.workcenter.load.pivot</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <pivot string="Work Center Loads" sample="1"> + <field name="duration_expected" type="measure"/> + <field name="workcenter_id" type="row"/> + <field name="production_date" type="row" interval="day"/> + </pivot> + </field> + </record> + + <record id="view_work_center_load_graph" model="ir.ui.view"> + <field name="name">report.workcenter.load.graph</field> + <field name="model">mrp.workorder</field> + <field name="arch" type="xml"> + <graph string="Work Center load" type="bar" sample="1"> + <field name="production_date" interval="day"/> + <field name="workcenter_id"/> + <field name="duration_expected" type="measure"/> + </graph> + </field> + </record> + + <record id="action_mrp_workcenter_load_report_graph" model="ir.actions.act_window"> + <field name="name">Work Center Loads</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">mrp.workorder</field> + <field name="view_mode">graph,pivot</field> + <field name="view_id" ref="view_workcenter_load_pivot"/> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No data yet! + </p> + </field> + </record> + + <record id="action_mrp_workcenter_load_report_pivot" model="ir.actions.act_window.view"> + <field name="view_mode">graph</field> + <field name="view_id" ref="view_work_center_load_graph"/> + <field name="act_window_id" ref="action_mrp_workcenter_load_report_graph"/> + </record> +</odoo> diff --git a/addons/mrp/views/product_views.xml b/addons/mrp/views/product_views.xml new file mode 100644 index 00000000..2dd6fe52 --- /dev/null +++ b/addons/mrp/views/product_views.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <!-- Product Template --> + <record id="view_mrp_product_template_form_inherited" model="ir.ui.view"> + <field name="name">product.form.mrp.inherited</field> + <field name="model">product.template</field> + <field name="inherit_id" ref="stock.view_template_property_form"/> + <field name="arch" type="xml"> + <xpath expr="//label[@for='sale_delay']" position="before"> + <label for="produce_delay" attrs="{'invisible':[('type','=','service')]}"/> + <div attrs="{'invisible':[('type','=','service')]}"> + <field name="produce_delay" class="oe_inline"/> days + </div> + </xpath> + </field> + </record> + + <record id="mrp_product_template_search_view" model="ir.ui.view"> + <field name="name">mrp.product.template.search</field> + <field name="model">product.template</field> + <field name="mode">primary</field> + <field name="inherit_id" ref="product.product_template_search_view"/> + <field name="arch" type="xml"> + <xpath expr="//filter[@name='consumable']" position="after"> + <separator/> + <filter string="Manufactured Products" name="manufactured_products" domain="[('bom_ids', '!=', False)]"/> + <filter string="BoM Components" name="components" domain="[('bom_line_ids', '!=', False)]"/> + </xpath> + </field> + </record> + + <record id="mrp_product_product_search_view" model="ir.ui.view"> + <field name="name">mrp.product.product.search</field> + <field name="model">product.product</field> + <field name="mode">primary</field> + <field name="inherit_id" ref="product.product_search_form_view"/> + <field name="arch" type="xml"> + <xpath expr="//filter[@name='consumable']" position="after"> + <separator/> + <filter string="Manufactured Products" name="manufactured_products" domain="[('bom_ids', '!=', False)]"/> + <filter string="BoM Components" name="components" domain="[('bom_line_ids', '!=', False)]"/> + </xpath> + </field> + </record> + + <record id="product_template_action" model="ir.actions.act_window"> + <field name="name">Products</field> + <field name="res_model">product.template</field> + <field name="search_view_id" ref="mrp_product_template_search_view"/> + <field name="view_mode">kanban,tree,form</field> + <field name="context">{"search_default_consumable": 1, 'default_type': 'product'}</field> + <field name="help" type="html"> + <p class="o_view_nocontent_smiling_face"> + No product found. Let's create one! + </p><p> + Define the components and finished products you wish to use in + bill of materials and manufacturing orders. + </p> + </field> + </record> + + <menuitem id="menu_mrp_product_form" + name="Products" + action="product_template_action" + parent="menu_mrp_bom" sequence="1"/> + + <record id="mrp_product_variant_action" model="ir.actions.act_window"> + <field name="name">Product Variants</field> + <field name="res_model">product.product</field> + <field name="search_view_id" ref="mrp_product_product_search_view"/> + <field name="view_mode">kanban,tree,form</field> + </record> + + <menuitem id="product_variant_mrp" name="Product Variants" + action="mrp_product_variant_action" + parent="menu_mrp_bom" groups="product.group_product_variant" sequence="2"/> + + + <record id="product_template_form_view_bom_button" model="ir.ui.view"> + <field name="name">product.template.procurement</field> + <field name="model">product.template</field> + <field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/> + <field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]"/> + <field name="arch" type="xml"> + <xpath expr="//button[@name='action_open_product_lot']" position="after"> + <button class="oe_stat_button" name="%(template_open_bom)d" type="action" + attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}" icon="fa-flask"> + <field string="Bill of Materials" name="bom_count" widget="statinfo" /> + </button> + <button class="oe_stat_button" name="action_used_in_bom" type="object" + attrs="{'invisible':['|',('type', 'not in', ['product', 'consu']), ('used_in_bom_count', '=', 0)]}" icon="fa-level-up"> + <field string="Used In" name="used_in_bom_count" widget="statinfo" /> + </button> + <button class="oe_stat_button" name="action_view_mos" type="object" + attrs="{'invisible': ['|', '|', ('type', 'not in', ['product', 'consu']), ('bom_count', '=', 0), ('mrp_product_qty', '=', 0)]}" icon="fa-list-alt" help="Manufactured in the last 365 days"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"> + <field name="mrp_product_qty" widget="statinfo" nolabel="1" class="mr4"/> + <field name="uom_name"/> + </span> + <span class="o_stat_text">Manufactured</span> + </div> + </button> + </xpath> + </field> + </record> + + <record id="product_product_form_view_bom_button" model="ir.ui.view"> + <field name="name">product.product.procurement</field> + <field name="model">product.product</field> + <field name="inherit_id" ref="stock.product_form_view_procurement_button"/> + <field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]"/> + <field name="arch" type="xml"> + <xpath expr="//button[@name='action_open_product_lot']" position="after"> + <button class="oe_stat_button" name="action_view_bom" type="object" + attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}" icon="fa-flask"> + <field string="Bill of Materials" name="bom_count" widget="statinfo" /> + </button> + <button class="oe_stat_button" name="action_used_in_bom" type="object" + attrs="{'invisible':['|',('type', 'not in', ['product', 'consu']), ('used_in_bom_count', '=', 0)]}" icon="fa-level-up"> + <field string="Used In" name="used_in_bom_count" widget="statinfo" /> + </button> + <button class="oe_stat_button" name="action_view_mos" type="object" + attrs="{'invisible': ['|', '|', ('type', 'not in', ['product', 'consu']), ('bom_count', '=', 0), ('mrp_product_qty', '=', 0)]}" icon="fa-list-alt" help="Manufactured in the last 365 days"> + <div class="o_field_widget o_stat_info"> + <span class="o_stat_value"> + <field name="mrp_product_qty" widget="statinfo" nolabel="1" class="mr4"/> + <field name="uom_name"/> + </span> + <span class="o_stat_text">Manufactured</span> + </div> + </button> + </xpath> + </field> + </record> + </data> +</odoo> diff --git a/addons/mrp/views/res_config_settings_views.xml b/addons/mrp/views/res_config_settings_views.xml new file mode 100644 index 00000000..5390fc40 --- /dev/null +++ b/addons/mrp/views/res_config_settings_views.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <record id="res_config_settings_view_form" model="ir.ui.view"> + <field name="name">res.config.settings.view.form.inherit.mrp</field> + <field name="model">res.config.settings</field> + <field name="priority" eval="35"/> + <field name="inherit_id" ref="base.res_config_settings_view_form" /> + <field name="arch" type="xml"> + <xpath expr="//div[hasclass('settings')]" position="inside"> + <div class="app_settings_block" data-string="Manufacturing" string="Manufacturing" data-key="mrp" groups="mrp.group_mrp_manager"> + <h2>Operations</h2> + <div class="row mt16 o_settings_container" name="process_operations_setting_container"> + <div class="col-lg-6 col-12 o_setting_box" id="work_order" title="Work Order Operations allow you to create and manage the manufacturing operations that should be followed within your work centers in order to produce a product. They are attached to bills of materials that will define the required components."> + <div class="o_setting_left_pane"> + <field name="group_mrp_routings"/> + <field name="module_mrp_workorder" invisible="1"/> + </div> + <div class="o_setting_right_pane" id="workorder_settings"> + <label for="group_mrp_routings" string="Work Orders"/> + <a href="https://www.odoo.com/documentation/14.0/applications/inventory_and_mrp/manufacturing/management/bill_configuration.html#adding-a-routing" title="Documentation" class="o_doc_link" target="_blank"></a> + <div class="text-muted"> + Process operations at specific work centers + </div> + <div class="content-group" attrs="{'invisible': [('group_mrp_routings','=',False)]}"> + <div class="mt8"> + <div> + <button name="%(mrp.mrp_workcenter_action)d" icon="fa-arrow-right" type="action" string="Work Centers" class="btn-link"/> + </div> + </div> + </div> + </div> + </div> + <div class="col-lg-6 col-12 o_setting_box"> + <div class="o_setting_left_pane"> + <field name="module_mrp_subcontracting"/> + </div> + <div class="o_setting_right_pane"> + <label for="module_mrp_subcontracting"/> + <a href="https://www.odoo.com/documentation/14.0/applications/inventory_and_mrp/manufacturing/management/subcontracting.html" title="Documentation" class="o_doc_link" target="_blank"></a> + <div class="text-muted"> + Subcontract the production of some products + </div> + </div> + </div> + <div class="col-lg-6 col-12 o_setting_box" id="quality_control"> + <div class="o_setting_left_pane"> + <field name="module_quality_control" widget="upgrade_boolean"/> + </div> + <div class="o_setting_right_pane"> + <label for="module_quality_control"/> + <div class="text-muted"> + Add quality checks to your work orders + </div> + </div> + </div> + <div class="col-lg-6 col-12 o_setting_box" id="mrp_lock" title="Makes confirmed manufacturing orders locked rather than unlocked by default. This only applies to new manufacturing orders, not previously created ones."> + <div class="o_setting_left_pane"> + <field name="group_locked_by_default"/> + </div> + <div class="o_setting_right_pane"> + <label for="group_locked_by_default"/> + <div class="text-muted"> + Prevent manufacturing users from modifying quantities to consume, unless a manager has unlocked the document + </div> + </div> + </div> + </div> + <div class="row mt16 o_settings_container"> + <div class="col-lg-6 col-12 o_setting_box" id="mrp_byproduct" title="Add by-products to bills of materials. This can be used to get several finished products as well. Without this option you only do: A + B = C. With the option: A + B = C + D."> + <div class="o_setting_left_pane"> + <field name="group_mrp_byproducts"/> + </div> + <div class="o_setting_right_pane"> + <label for="group_mrp_byproducts"/> + <div class="text-muted"> + Produce residual products (A + B -> C + D) + </div> + </div> + </div> + </div> + <h2>Planning</h2> + <div class="row mt16 o_settings_container"> + <div class="col-lg-6 col-12 o_setting_box" id="mrp_mps" title="Using a MPS report to schedule your reordering and manufacturing operations is useful if you have long lead time and if you produce based on sales forecasts."> + <div class="o_setting_left_pane"> + <field name="module_mrp_mps" widget="upgrade_boolean"/> + </div> + <div class="o_setting_right_pane"> + <label for="module_mrp_mps"/> + <a href="https://www.odoo.com/documentation/14.0/applications/inventory_and_mrp/manufacturing/management/use_mps.html" title="Documentation" class="o_doc_link" target="_blank"></a> + <div class="text-muted"> + Plan manufacturing or purchase orders based on forecasts + </div> + <div class="content-group" id="content_mrp_mps"/> + </div> + </div> + <div class="col-lg-6 col-12 o_setting_box" id="security_lead_time"> + <div class="o_setting_left_pane"> + <field name="use_manufacturing_lead"/> + </div> + <div class="o_setting_right_pane"> + <label string="Security Lead Time" for="use_manufacturing_lead"/> + <a href="https://www.odoo.com/documentation/14.0/applications/inventory_and_mrp/inventory/management/planning/scheduled_dates.html" title="Documentation" class="mr-2 o_doc_link" target="_blank"></a> + <span class="fa fa-lg fa-building-o" title="Values set here are company-specific." role="img" aria-label="Values set here are company-specific." groups="base.group_multi_company"/> + <div class="text-muted"> + Schedule manufacturing orders earlier to avoid delays + </div> + <div class="content-group" attrs="{'invisible': [('use_manufacturing_lead','=',False)]}"> + <div class="mt16" > + <field name="manufacturing_lead" class="oe_inline"/> days + </div> + </div> + </div> + </div> + </div> + </div> + </xpath> + </field> + </record> + + <record id="action_mrp_configuration" model="ir.actions.act_window"> + <field name="name">Settings</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">res.config.settings</field> + <field name="view_mode">form</field> + <field name="target">inline</field> + <field name="context">{'module' : 'mrp', 'bin_size': False}</field> + </record> + + <menuitem id="menu_mrp_config" name="Settings" parent="menu_mrp_configuration" + sequence="0" action="action_mrp_configuration" groups="base.group_system"/> + </data> +</odoo> diff --git a/addons/mrp/views/stock_move_views.xml b/addons/mrp/views/stock_move_views.xml new file mode 100644 index 00000000..544c7ee0 --- /dev/null +++ b/addons/mrp/views/stock_move_views.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record model="ir.actions.act_window" id="action_mrp_production_moves"> + <field name="name">Inventory Moves</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">stock.move.line</field> + <field name="view_mode">tree,form</field> + <field name="domain">['|', ('move_id.raw_material_production_id', '=', active_id), ('move_id.production_id', '=', active_id)]</field> + </record> + + <record id="view_stock_move_operations_raw" model="ir.ui.view"> + <field name="name">stock.move.operations.raw.form</field> + <field name="model">stock.move</field> + <field name="priority">1</field> + <field name="mode">primary</field> + <field name="inherit_id" ref="stock.view_stock_move_operations" /> + <field name="arch" type="xml"> + <xpath expr="//label[@for='product_uom_qty']" position="attributes"> + <attribute name="string">Total To Consume</attribute> + </xpath> + <xpath expr="//label[@for='quantity_done']" position="attributes"> + <attribute name="string">Consumed</attribute> + </xpath> + </field> + </record> + + <record id="view_stock_move_operations_finished" model="ir.ui.view"> + <field name="name">stock.move.operations.finished.form</field> + <field name="model">stock.move</field> + <field name="priority">1</field> + <field name="mode">primary</field> + <field name="inherit_id" ref="stock.view_stock_move_operations" /> + <field name="arch" type="xml"> + <xpath expr="//label[@for='product_uom_qty']" position="attributes"> + <attribute name="string">To Produce</attribute> + </xpath> + <xpath expr="//label[@for='quantity_done']" position="attributes"> + <attribute name="string">Produced</attribute> + </xpath> + </field> + </record> + + <menuitem id="menu_mrp_traceability" + name="Lots/Serial Numbers" + parent="menu_mrp_bom" + action="stock.action_production_lot_form" + groups="stock.group_production_lot" + sequence="15"/> + + <menuitem id="menu_mrp_scrap" + name="Scrap" + parent="menu_mrp_manufacturing" + action="stock.action_stock_scrap" + sequence="25"/> + + <menuitem id="menu_procurement_compute_mrp" + action="stock.action_procurement_compute" + parent="mrp_planning_menu_root" + sequence="135"/> + +</odoo> diff --git a/addons/mrp/views/stock_orderpoint_views.xml b/addons/mrp/views/stock_orderpoint_views.xml new file mode 100644 index 00000000..407ac631 --- /dev/null +++ b/addons/mrp/views/stock_orderpoint_views.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="view_warehouse_orderpoint_tree_editable_inherited_purchase" model="ir.ui.view"> + <field name="name">stock.warehouse.orderpoint.tree.editable.inherit.purchase</field> + <field name="model">stock.warehouse.orderpoint</field> + <field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable"/> + <field name="arch" type="xml"> + <field name="route_id" position="after"> + <field name="show_bom" invisible="1"/> + <field name="bom_id" optional="hide" attrs="{'invisible': [('show_bom', '=', False)]}" context="{'default_product_tmpl_id': product_tmpl_id}"/> + </field> + </field> + </record> +</odoo>
\ No newline at end of file diff --git a/addons/mrp/views/stock_picking_views.xml b/addons/mrp/views/stock_picking_views.xml new file mode 100644 index 00000000..120b0791 --- /dev/null +++ b/addons/mrp/views/stock_picking_views.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="stock_production_type_kanban" model="ir.ui.view"> + <field name="name">stock.picking.type.kanban</field> + <field name="model">stock.picking.type</field> + <field name="inherit_id" ref="stock.stock_picking_type_kanban"/> + <field name="arch" type="xml"> + <field name="code" position="after"> + <field name="count_mo_todo"/> + <field name="count_mo_waiting"/> + <field name="count_mo_late"/> + </field> + + <xpath expr='//div[@name="stock_picking"]' position="after"> + <div t-if="record.code.raw_value == 'mrp_operation'" t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''}"> + <div> + <div t-attf-class="o_kanban_card_header"> + <div class="o_kanban_card_header_title"> + <div class="o_primary" t-if="!selection_mode"> + <a type="object" name="get_mrp_stock_picking_action_picking_type"> + <field name="name"/> + </a> + </div> + <span class="o_primary" t-if="selection_mode"><field name="name"/></span> + <div class="o_secondary"><field class="o_secondary" name="warehouse_id" readonly="1" groups="stock.group_stock_multi_warehouses"/></div> + </div> + <div class="o_kanban_manage_button_section" t-if="!selection_mode"> + <a class="o_kanban_manage_toggle_button" href="#"><i class="fa fa-ellipsis-v" role="img" aria-label="Manage" title="Manage"/></a> + </div> + </div> + <div class="container o_kanban_card_content" t-if="!selection_mode"> + <div class="row"> + <div class="col-6 o_kanban_primary_left"> + <button class="btn btn-primary" name="%(mrp_production_action_picking_deshboard)d" type="action" context="{'search_default_todo': 1, 'default_picking_type_id': active_id}"> + <span t-if="record.code.raw_value =='mrp_operation'"><t t-esc="record.count_mo_todo.value"/> To Process</span> + </button> + </div> + <div class="col-6 o_kanban_primary_right"> + <div t-if="record.count_mo_waiting.raw_value > 0" class="row"> + <div class="col-9"> + <a name="%(mrp_production_action_picking_deshboard)d" type="action" context="{'search_default_waiting': 1}"> + Waiting + </a> + </div> + <div class="col-3"> + <field name="count_mo_waiting"/> + </div> + </div> + <div t-if="record.count_mo_late.raw_value > 0" class="row"> + <div class="col-9"> + <a class="oe_kanban_stock_picking_type_list" name="%(mrp_production_action_picking_deshboard)d" type="action" context="{'search_default_planning_issues': 1, 'default_picking_type_id': active_id}"> + Late + </a> + </div> + <div class="col-3"> + <field name="count_mo_late"/> + </div> + </div> + </div> + </div> + </div><div class="container o_kanban_card_manage_pane dropdown-menu" role="menu"> + <div class="row"> + <div class="col-6 o_kanban_card_manage_section o_kanban_manage_view" name="picking_left_manage_pane"> + <div role="menuitem" class="o_kanban_card_manage_title"> + <span>Orders</span> + </div> + <div role="menuitem"> + <a name="%(mrp_production_action_picking_deshboard)d" type="action">All</a> + </div> + <div role="menuitem"> + <a name="%(mrp_production_action_picking_deshboard)d" type="action" context="{'search_default_inprogress': 1}">In Progress</a> + </div> + <div role="menuitem"> + <a name="%(mrp_production_action_picking_deshboard)d" type="action" context="{'search_default_planned': 1}">Planned</a> + </div> + </div> + <div class="col-6 o_kanban_card_manage_section o_kanban_manage_new"> + <div role="menuitem" class="o_kanban_card_manage_title"> + <span>New</span> + </div> + <div role="menuitem"> + <a name="%(action_mrp_production_form)d" context="{'default_picking_type_id': active_id}" type="action">Manufacturing Order</a> + </div> + </div> + </div> + + <div t-if="widget.editable" class="o_kanban_card_manage_settings row"> + <div role="menuitem" aria-haspopup="true" class="col-8"> + <ul role="menu" class="oe_kanban_colorpicker" data-field="color"/> + </div> + <div class="col-4"> + <a class="dropdown-item" role="menuitem" type="edit">Configuration</a> + </div> + </div> + </div> + </div> + </div> + </xpath> + </field> + </record> + <record id="view_picking_type_form_inherit_mrp" model="ir.ui.view"> + <field name="name">Operation Types</field> + <field name="model">stock.picking.type</field> + <field name="inherit_id" ref="stock.view_picking_type_form"/> + <field name="arch" type="xml"> + <field name="show_operations" position="attributes"> + <attribute name="attrs">{"invisible": [("code", "=", "mrp_operation")]}</attribute> + </field> + <xpath expr="//group[@name='stock_picking_type_lot']" position="after"> + <group attrs='{"invisible": [("code", "!=", "mrp_operation")]}' string="Traceability" groups="stock.group_production_lot"> + <field name="use_create_components_lots"/> + </group> + </xpath> + </field> + </record> +</odoo> diff --git a/addons/mrp/views/stock_scrap_views.xml b/addons/mrp/views/stock_scrap_views.xml new file mode 100644 index 00000000..3286e5a1 --- /dev/null +++ b/addons/mrp/views/stock_scrap_views.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="stock_scrap_view_form2_mrp_inherit_mrp" model="ir.ui.view"> + <field name="name">stock.scrap.view.form2.inherit.mrp</field> + <field name="model">stock.scrap</field> + <field name="inherit_id" ref="stock.stock_scrap_form_view2"/> + <field name="arch" type="xml"> + <field name="owner_id" position="after"> + <field name="workorder_id" invisible="1"/> + <field name="production_id" invisible="1"/> + </field> + </field> + </record> + <record id="stock_scrap_view_form_mrp_inherit_mrp" model="ir.ui.view"> + <field name="name">stock.scrap.view.form.inherit.mrp</field> + <field name="model">stock.scrap</field> + <field name="inherit_id" ref="stock.stock_scrap_form_view"/> + <field name="arch" type="xml"> + <field name="owner_id" position="after"> + <field name="workorder_id" domain="[('production_id', '=', product_id)]" attrs="{'invisible': [('workorder_id', '=', False)]}"/> + <field name="production_id" domain="[('company_id', '=', company_id)]" attrs="{'invisible': [('production_id', '=', False)]}"/> + </field> + </field> + </record> +</odoo> diff --git a/addons/mrp/views/stock_warehouse_views.xml b/addons/mrp/views/stock_warehouse_views.xml new file mode 100644 index 00000000..f9f2b882 --- /dev/null +++ b/addons/mrp/views/stock_warehouse_views.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Warehouse --> + <record id="view_warehouse_inherit_mrp" model="ir.ui.view"> + <field name="name">Stock Warehouse Inherit MRP</field> + <field name="model">stock.warehouse</field> + <field name="inherit_id" ref="stock.view_warehouse"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='resupply_wh_ids']" position="before"> + <field name="manufacture_to_resupply" /> + <field name="manufacture_steps" attrs="{'invisible': [('manufacture_to_resupply', '=', False)]}" widget="radio"/> + </xpath> + <xpath expr="//field[@name='out_type_id']" position="after"> + <field name="manu_type_id" readonly="True"/> + </xpath> + <xpath expr="//group[@name='group_resupply']" position="attributes"> + <attribute name="attrs">{}</attribute> + </xpath> + <xpath expr="//field[@name='wh_output_stock_loc_id']" position="after"> + <field name="sam_loc_id"/> + <field name="pbm_loc_id"/> + </xpath> + <xpath expr="//field[@name='out_type_id']" position="after"> + <field name="sam_type_id"/> + <field name="pbm_type_id"/> + </xpath> + </field> + </record> +</odoo> |
