changes
This commit is contained in:
@@ -59,31 +59,11 @@ class FpJobStepInputWizard(models.TransientModel):
|
||||
job_id = fields.Many2one(
|
||||
related='step_id.job_id', string='Job', store=False, readonly=True,
|
||||
)
|
||||
# Sub 12d — surface the office-authored instructions to the operator
|
||||
# at the exact moment they're recording values. Sourced from the
|
||||
# recipe node's description (rich-text); empty when the recipe
|
||||
# author left it blank.
|
||||
instructions = fields.Html(
|
||||
string='Operator Instructions',
|
||||
compute='_compute_instructions',
|
||||
readonly=True,
|
||||
)
|
||||
has_instructions = fields.Boolean(
|
||||
compute='_compute_instructions',
|
||||
)
|
||||
line_ids = fields.One2many(
|
||||
'fp.job.step.input.wizard.line', 'wizard_id',
|
||||
string='Inputs',
|
||||
)
|
||||
|
||||
@api.depends('step_id', 'step_id.recipe_node_id', 'step_id.recipe_node_id.description')
|
||||
def _compute_instructions(self):
|
||||
for rec in self:
|
||||
node = rec.step_id.recipe_node_id if rec.step_id else False
|
||||
html = (node and node.description) or ''
|
||||
rec.instructions = html
|
||||
rec.has_instructions = bool(html and html.strip())
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
defaults = super().default_get(fields_list)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_fp_job_step_input_wizard_form" model="ir.ui.view">
|
||||
<field name="name">fp.job.step.input.wizard.form</field>
|
||||
<record id="view_fp_job_step_input_wizard_form_v2" model="ir.ui.view">
|
||||
<field name="name">fp.job.step.input.wizard.form.v2</field>
|
||||
<field name="model">fp.job.step.input.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Record Step Inputs">
|
||||
@@ -11,17 +11,6 @@
|
||||
<field name="step_id" readonly="1"/>
|
||||
<field name="job_id" readonly="1"/>
|
||||
</group>
|
||||
<field name="has_instructions" invisible="1"/>
|
||||
<div class="alert alert-info"
|
||||
role="alert"
|
||||
invisible="not has_instructions"
|
||||
style="margin-bottom: 12px;">
|
||||
<h4 style="margin-top: 0;">
|
||||
<i class="fa fa-info-circle"/>
|
||||
Instructions for this step
|
||||
</h4>
|
||||
<field name="instructions" nolabel="1" readonly="1"/>
|
||||
</div>
|
||||
<separator string="Measurements"/>
|
||||
<p class="text-muted" invisible="line_ids">
|
||||
Click <strong>Add a line</strong> to record one or
|
||||
@@ -39,13 +28,16 @@
|
||||
<field name="name"
|
||||
string="Measurement"
|
||||
readonly="is_authored"
|
||||
width="220"
|
||||
placeholder="e.g. Oven Temp, Bath Reading, Operator Initials"/>
|
||||
<field name="input_type"
|
||||
string="Type"
|
||||
readonly="is_authored"/>
|
||||
readonly="is_authored"
|
||||
width="120"/>
|
||||
<field name="target_unit"
|
||||
string="Unit"
|
||||
readonly="is_authored"
|
||||
width="100"
|
||||
optional="show"/>
|
||||
<field name="value_number"
|
||||
string="Number"
|
||||
@@ -105,6 +97,7 @@
|
||||
<field name="name">Record Step Inputs</field>
|
||||
<field name="res_model">fp.job.step.input.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_fp_job_step_input_wizard_form_v2"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user