bemade_fsm: updates to qweb for pdf of work orders.

This commit is contained in:
Marc Durepos 2023-08-02 12:24:26 -04:00
parent b367169579
commit 83b002e41c
4 changed files with 113 additions and 106 deletions

View file

@ -20,7 +20,7 @@
######################################################################################## ########################################################################################
{ {
'name': 'Improved Field Service Management', 'name': 'Improved Field Service Management',
'version': '15.0.0.3.0', 'version': '15.0.0.5.0',
'summary': 'Adds functionality necessary for managing field service operations at Durpro.', 'summary': 'Adds functionality necessary for managing field service operations at Durpro.',
'description': 'Adds functionality necessary for managing field service operations at Durpro.', 'description': 'Adds functionality necessary for managing field service operations at Durpro.',
'category': 'Services/Field Service', 'category': 'Services/Field Service',

View file

@ -67,7 +67,6 @@ class Equipment(models.Model):
'|', '|', '|', '|', '|', '|',
('pid_tag', operator, name), ('pid_tag', operator, name),
('name', operator, name), ('name', operator, name),
('partner_id.name', operator, name),
('partner_location_id.name', operator, name)], ('partner_location_id.name', operator, name)],
limit=limit) limit=limit)
else: else:

View file

@ -16,120 +16,130 @@
<template id="worksheet_complete"> <template id="worksheet_complete">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-foreach="docs" t-as="doc"> <t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout"> <t t-call="bemade_fsm.worksheet_complete_page"
<t t-call="bemade_fsm.worksheet_complete_page" t-lang="doc.partner_id.lang"/>
t-lang="doc.partner_id.lang"/>
</t>
</t> </t>
</t> </t>
</template> </template>
<template id="worksheet_complete_page"> <template id="worksheet_complete_page">
<t t-set="address" t-if="doc.sale_order_id"> <t t-call="web.external_layout">
<strong class="big-red">Customer:</strong> <t t-set="address" t-if="doc.sale_order_id">
<div t-field="doc.sale_order_id.partner_id" <strong class="big-red">Customer:</strong>
t-options='{"widget": "contact", <div t-field="doc.sale_order_id.partner_id"
t-options='{"widget": "contact",
"fields": ["address", "name"], "no_marker": True}'/> "fields": ["address", "name"], "no_marker": True}'/>
</t> </t>
<t t-set="information_block"> <t t-set="information_block">
<strong>Service Address:</strong> <strong>Service Address:</strong>
<div t-field="doc.partner_id" <div t-field="doc.partner_id"
t-options='{"widget": "contact", t-options='{"widget": "contact",
"fields": ["address", "name", "phone"], "fields": ["address", "name", "phone"],
"no_marker": True, "phone_icons": True}'/> "no_marker": True, "phone_icons": True}'/>
</t> </t>
<div class="page"> <div class="page">
<div class="oe_structure"/> <div class="oe_structure"/>
<h2 class="mt16"> <h2 class="mt-3">
<span>Work Order </span> <span>Work Order </span>
<span t-field="doc.name"/> <span t-if="doc.sale_order_id" t-field="doc.sale_order_id.name"/>
</h2> <span t-else="" t-field="doc.name"/>
</h2>
<div class="container wo-information"> <div class="container">
<div class="row mt32 mb32" id="informations"> <div class="row mb-3 border-dark">
<div t-if="doc.sale_order_id.client_order_ref" class="col-3"> <div t-if="doc.sale_order_id.client_order_ref" class="col-4">
<p class="m-0"> <span class="font-weight-bolder">Your Reference:</span>
<strong>Your Reference: </strong>
<span t-field="doc.sale_order_id.client_order_ref"/> <span t-field="doc.sale_order_id.client_order_ref"/>
</p> </div>
<p t-if="doc.planned_date_begin" class="m-0"> <div t-if="doc.site_contacts" class="col-4">
<strong t-if="doc.planned_date_begin">Planned <span class="font-weight-bolder">Site Contacts:</span>
for: </strong> <t t-foreach="doc.site_contacts" t-as="contact">
<span t-field="doc.planned_date_begin" <span t-field="contact.name"/>
t-options='{"widget": "datetime"}'/> <span t-out="contact"
</p> t-options='{"widget": "contact",
</div> "fields": ["phone", "mobile", "email"],
<div class="col-3">
<strong>Technician(s):</strong>
<t t-foreach="doc.user_ids" t-as="technician"
t-if="doc.user_ids">
<p class="m-0" t-field="technician.name"/>
</t>
</div>
<div class="col-3">
<strong>Site Contacts:</strong>
<t t-foreach="doc.site_contacts" t-as="contact">
<p class="m-0" t-out="contact"
t-options='{"widget": "contact",
"fields": ["name", "phone", "mobile", "email"],
"no_marker": True, "phone_icons": True}'/> "no_marker": True, "phone_icons": True}'/>
</t> </t>
</div>
<div t-if="doc.work_order_contacts" class="col-4">
<span class="font-weight-bolder">Work order attn:</span>
<t t-foreach="doc.work_order_contacts" t-as="contact">
<span t-field="contact.name"/>
<span t-out="contact"
t-options='{"widget": "contact",
"fields": ["phone", "mobile", "email"],
"no_marker": True, "phone_icons": True}'/>
</t>
</div>
</div> </div>
<div class="col-3"> <div class="row mb-3 border-dark">
<strong>Work order attn:</strong> <div class="col-4" t-if="doc.user_ids">
<t t-foreach="doc.work_order_contacts" t-as="contact"> <span class="font-weight-bolder">Technician(s)</span>
<p class="m-0" t-out="contact"/> <t t-foreach="doc.user_ids" t-as="technician">
</t> <p class="m-0" t-field="technician.name"/>
</t>
</div>
<div class="col-4" t-if="doc.planned_date_begin">
<span class="font-weight-bolder">Planned Start</span>
<p t-field="doc.planned_date_begin"
t-options="{'widget': 'datetime'}"/>
</div>
<div class="col-4" t-if="doc.planned_date_end">
<span class="font-weight-bolder">Planned End</span>
<p t-field="doc.planned_date_end"
t-options="{'widget': 'datetime'}"/>
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="container">
<div class="col mb16"> <h3 class="mb32"><strong>Interventions</strong></h3>
<h3 class="mb32"><strong>Interventions</strong></h3> <t t-foreach="doc.child_ids" t-as="intervention">
</div> <div class="row">
</div> <div class="col-6">
<t t-foreach="doc.child_ids" t-as="intervention"> <h4><span t-field="intervention.name"/></h4>
<div class="container wo-intervention mb16"> <span t-if="intervention.description"
<div class="row mb16 pb16"> t-field="intervention.description"/>
<div class="col-12 mb16 tb16"> </div>
<h4><strong> <div t-if="intervention.equipment_ids"
<span t-field="intervention.name"/> class="col-6">
<t t-foreach="intervention.equipment_ids" <h4>Equipment: </h4>
t-as="equipment"> <t t-foreach="intervention.equipment_ids"
<span t-field="equipment.name"/> t-as="equipment">
<span t-if="intervention_index &lt; intervention_size - 1" <span t-field="equipment.complete_name"/>
t-out="', '" /> <span t-if="equipment_index &lt; equipment_size -1"
</t> t-out="', '"/>
</strong></h4> </t>
<p class="mb16" t-field="intervention.description"/>
</div> </div>
</div> </div>
<table class="table table-borderless"> <div class="row">
<thead> <table class="table table-borderless col-12">
<th>Done</th> <thead>
<th>Task to do</th> <th>Done</th>
</thead> <th>Task to do</th>
<tbody> </thead>
<t t-foreach="intervention.child_ids" t-as="task"> <tbody>
<tr class="wo-task"> <t t-foreach="intervention.child_ids"
<td style="width: 5%"> t-as="task">
<input type="checkbox" <tr class="wo-task">
t-att-checked="task.is_complete"/> <td style="width: 5%">
</td> <input type="checkbox"
<td style="width: 95%"> t-att-checked="task.is_complete"/>
<p t-field="task.name"/> </td>
<p t-field="task.description"/> <td style="width: 95%">
</td> <p t-field="task.name"/>
<!-- TODO: Figure out what to do with the old <p t-field="task.description"/>
concept of task comments --> </td>
</tr> <!-- TODO: Figure out what to do with the old
</t> concept of task comments -->
</tbody> </tr>
</table> </t>
</tbody>
</div> </table>
</t> </div>
</t>
</div>
</div> </div>
</div> </t>
</template> </template>
</data> </data>

View file

@ -7,14 +7,12 @@
<field name="inherit_id" ref="industry_fsm.view_task_form2_inherit"/> <field name="inherit_id" ref="industry_fsm.view_task_form2_inherit"/>
<field name="priority" eval="8"/> <field name="priority" eval="8"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="equipment_ids"
domain="[('partner_location_id', '=', partner_id)]"
context="{'tree_view_ref': 'bemade_fsm.equipment_view_tree'}"/>
</xpath>
<xpath expr="//page[@name='extra_info']" position="after"> <xpath expr="//page[@name='extra_info']" position="after">
<page string="Field Service" name="field_service"> <page string="Field Service" name="field_service">
<group name="contacts"> <group name="equipment_and_contacts">
<field name="equipment_ids"
domain="[('partner_location_id', '=', partner_id)]"
context="{'tree_view_ref': 'bemade_fsm.equipment_view_tree'}"/>
<field name="site_contacts" <field name="site_contacts"
context="{'tree_view_ref': 'bemade_fsm.fsm_contacts_view_tree'}"/> context="{'tree_view_ref': 'bemade_fsm.fsm_contacts_view_tree'}"/>
<field name="work_order_contacts" <field name="work_order_contacts"