[IMP] mrp: convert note field of operation into text work instruction.
The field note of mrp.routing.workcenter was not very usefull, and not appear in the workorder related to this operation. Sometime, we need to have a small description of the work to do for a opeartion in the WO, instead of a complet pdf or google slide. -> Convert the note field as a description of the job to do and add a "text" worksheet_type to select it, in the mrp.routing.workcenter and add the related field in the WO. Update the view of accordingly. -> (migration): The 'note' content remain the same, then migration is not needed. If the user change the worksheet_type into text, the "note" will be the previous "description". task-2196687
This commit is contained in:
@@ -46,16 +46,16 @@ class MrpRoutingWorkcenter(models.Model):
|
||||
index=True, ondelete='cascade', required=True,
|
||||
help="The routing contains all the Work Centers used and for how long. This will create work orders afterwards "
|
||||
"which alters the execution of the manufacturing order.")
|
||||
note = fields.Text('Description')
|
||||
company_id = fields.Many2one(
|
||||
'res.company', 'Company',
|
||||
readonly=True, related='routing_id.company_id', store=True)
|
||||
worksheet = fields.Binary('PDF')
|
||||
worksheet_type = fields.Selection([
|
||||
('pdf', 'PDF'), ('google_slide', 'Google Slide')],
|
||||
('pdf', 'PDF'), ('google_slide', 'Google Slide'), ('text', 'Text')],
|
||||
string="Work Sheet", default="pdf",
|
||||
help="Defines if you want to use a PDF or a Google Slide as work sheet."
|
||||
)
|
||||
note = fields.Text('Description', help="Text worksheet description")
|
||||
worksheet = fields.Binary('PDF')
|
||||
worksheet_google_slide = fields.Char('Google Slide', help="Paste the url of your Google Slide. Make sure the access to the document is public.")
|
||||
time_mode = fields.Selection([
|
||||
('auto', 'Compute based on real time'),
|
||||
|
||||
@@ -110,6 +110,7 @@ class MrpWorkorder(models.Model):
|
||||
string='Worksheet Type', related='operation_id.worksheet_type', readonly=True)
|
||||
worksheet_google_slide = fields.Char(
|
||||
'Worksheet URL', related='operation_id.worksheet_google_slide', readonly=True)
|
||||
operation_note = fields.Text("Description", related='operation_id.note', readonly=True)
|
||||
move_raw_ids = fields.One2many(
|
||||
'stock.move', 'workorder_id', 'Raw Moves',
|
||||
domain=[('raw_material_production_id', '!=', False), ('production_id', '=', False)])
|
||||
|
||||
@@ -49,14 +49,12 @@
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Description" name="description">
|
||||
<field name="note"/>
|
||||
</page>
|
||||
<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', '=', 'google_slide')]}"/>
|
||||
<field name="worksheet_google_slide" placeholder="Google Slide Link" widget="embed_viewer" attrs="{'invisible': [('worksheet_type', '=', 'pdf')]}"/>
|
||||
<field name="worksheet" help="Upload your PDF file." widget="pdf_viewer" attrs="{'invisible': [('worksheet_type', '!=', 'pdf')]}"/>
|
||||
<field name="worksheet_google_slide" placeholder="Google Slide Link" widget="embed_viewer" attrs="{'invisible': [('worksheet_type', '!=', 'google_slide')]}"/>
|
||||
<field name="note" attrs="{'invisible': [('worksheet_type', '!=', 'text')]}"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
@@ -224,10 +224,11 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Work Instruction" name="workorder_page_work_instruction" attrs="{'invisible': [('worksheet', '=', False),('worksheet_google_slide', '=', False)]}">
|
||||
<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_google_slide" widget="embed_viewer" attrs="{'invisible': [('worksheet_type', '=', 'pdf')]}"/>
|
||||
<field name="worksheet" widget="pdf_viewer" attrs="{'invisible': [('worksheet_type', '=', 'google_slide')]}"/>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user