Files
odoo_source/addons/mrp/views/mrp_routing_views.xml
T
Achraf (abz) df312153d4 [FIX] mrp_workorder: Start and pause work order without attached PDF
What are the steps to reproduce your issue ?

    1. Install 'Manufacture' and enable 'Work Order' in settings
    2. Create product 'ProductA', enable 'Manufacture' in 'Inventory' tab
    3. Create a BOM for 'ProductA'
    4. For that BOM, create a new operation called 'OperationA' with PDF worksheet but don't attach any PDF
    4. Go to 'Manufacture' and create a MO with 'ProductA', the 'OperationA' is automatically set in 'Work Orders'
    5. Start the work order

What is currently happening ?

    When you try to pause, an error is raised.
    'TypeError: Cannot read property 'pdfViewer' of undefined'

What are you expecting to happen ?

    Start and pause the work order even without attached PDF.

Why is this happening ?

    'this.pdfViewer = existing.data('PDFViewerApplication').pdfViewer'
    When there is no pdf attached. The data 'PDFViewerApplication' does not exist.

How to fix the bug ?

    Change worksheet default value to text, and make the field mandatory in case of a PDF type

opw-2387428

closes odoo/odoo#62350

X-original-commit: 8597aada3d9bacc3cff4707bb78a7bc48d723cfb
Related: odoo/enterprise#14992
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-11-25 16:38:06 +00:00

86 lines
4.7 KiB
XML

<?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" readonly="1"/>
</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>
</record>
<menuitem id="menu_mrp_routing_action"
action="mrp_routing_action"
parent="menu_mrp_configuration"
groups="group_mrp_routings"
sequence="100"/>
</data>
</odoo>