bemade_fsm: PDF improvements
* Equipment summary added after the sale line summary. Fixes Dur-Pro/bemade-addons#60. * Different blocks of the document made conditional to content * Improved how tasks and subtasks are rendered
This commit is contained in:
parent
2a5b8dba42
commit
83d84a7bfa
1 changed files with 201 additions and 157 deletions
|
|
@ -30,119 +30,122 @@
|
|||
</t>
|
||||
<t t-else="" t-set="root_tasks"
|
||||
t-value="doc.root_ancestor"/>
|
||||
<h2 t-if="order_lines">Time & Material</h2>
|
||||
<div t-if="order_lines" class="table-responsive-sm">
|
||||
<table class="table table-sm o_main_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">Description</th>
|
||||
<th class="text-right">Ordered</th>
|
||||
<th class="text-right">Delivered</th>
|
||||
<th class="text-right">Unit Price</th>
|
||||
<th t-if="display_discount" class="text-right"
|
||||
groups="product.group_discount_per_so_line">
|
||||
<span>Disc.%</span>
|
||||
</th>
|
||||
<th class="text-right">
|
||||
<span groups="account.group_show_line_subtotals_tax_excluded">
|
||||
Amount</span>
|
||||
<span groups="account.group_show_line_subtotals_tax_included">
|
||||
Total Price</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sale_tbody">
|
||||
<t t-set="current_subtotal" t-value="0"/>
|
||||
<t t-foreach="order_lines" t-as="line">
|
||||
<t t-set="is_task" t-value="line == doc.sale_line_id"/>
|
||||
<t t-set="is_total_discount"
|
||||
t-value="line.discount and line.price_unit != 0 and line.delivered_price_total == 0"/>
|
||||
<t t-set="current_subtotal"
|
||||
t-value="current_subtotal + line.delivered_price_subtotal"
|
||||
groups="account.group_show_line_subtotals_tax_excluded"/>
|
||||
<t t-set="current_total"
|
||||
t-value="current_subtotal + line.delivered_price_total"
|
||||
groups="account.group_show_line_subtotals_tax_included"/>
|
||||
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
|
||||
<t t-if="not line.display_type and not line.is_downpayment">
|
||||
<td><span t-field="line.name"/></td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.product_uom_qty"/>
|
||||
<span t-field="line.product_uom"
|
||||
groups="uom.group_uom"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.qty_delivered"/>
|
||||
<span t-field="line.product_uom"
|
||||
groups="uom.group_uom"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.price_unit"/>
|
||||
</td>
|
||||
<td t-if="display_discount"
|
||||
class="text-right"
|
||||
groups="product.group_discount_per_so_line">
|
||||
<span t-field="line.discount"/>
|
||||
</td>
|
||||
<td class="text-right o_price_total">
|
||||
<span t-field="line.delivered_price_subtotal"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-if="line.display_type == 'line_section'">
|
||||
<td colspan="99">
|
||||
<span t-field="line.name"/>
|
||||
</td>
|
||||
<t t-set="current_section" t-value="line"/>
|
||||
<t t-set="current_subtotal" t-value="0"/>
|
||||
</t>
|
||||
<t t-if="line.display_type == 'line_note'">
|
||||
<td colspan="99">
|
||||
<span t-field="line.name"/>
|
||||
</td>
|
||||
</t>
|
||||
<div t-if="order_lines.filtered(lambda l: not l.display_type)">
|
||||
<h2 t-if="order_lines">Time & Material</h2>
|
||||
<div t-if="order_lines" class="table-responsive-sm">
|
||||
<table class="table table-sm o_main_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">Description</th>
|
||||
<th class="text-right">Ordered</th>
|
||||
<th class="text-right">Delivered</th>
|
||||
<th class="text-right">Unit Price</th>
|
||||
<th t-if="display_discount" class="text-right"
|
||||
groups="product.group_discount_per_so_line">
|
||||
<span>Disc.%</span>
|
||||
</th>
|
||||
<th class="text-right">
|
||||
<span groups="account.group_show_line_subtotals_tax_excluded">
|
||||
Amount</span>
|
||||
<span groups="account.group_show_line_subtotals_tax_included">
|
||||
Total Price</span>
|
||||
</th>
|
||||
</tr>
|
||||
<t t-if="current_section and len(section_lines) > 1 and (line_last or order_lines[line_index+1].display_type == 'line_section')">
|
||||
<tr class="is-subtotal text-right">
|
||||
<td colspan="99">
|
||||
<strong class="mr16">Section Subtotal</strong>
|
||||
<span
|
||||
t-esc="current_subtotal"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'
|
||||
/>
|
||||
</thead>
|
||||
<tbody class="sale_tbody">
|
||||
<t t-set="current_subtotal" t-value="0"/>
|
||||
<t t-foreach="order_lines" t-as="line">
|
||||
<t t-set="is_task" t-value="line == doc.sale_line_id"/>
|
||||
<t t-set="is_total_discount"
|
||||
t-value="line.discount and line.price_unit != 0 and line.delivered_price_total == 0"/>
|
||||
<t t-set="current_subtotal"
|
||||
t-value="current_subtotal + line.delivered_price_subtotal"
|
||||
groups="account.group_show_line_subtotals_tax_excluded"/>
|
||||
<t t-set="current_total"
|
||||
t-value="current_subtotal + line.delivered_price_total"
|
||||
groups="account.group_show_line_subtotals_tax_included"/>
|
||||
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
|
||||
<t t-if="not line.display_type and not line.is_downpayment">
|
||||
<td><span t-field="line.name"/></td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.product_uom_qty"/>
|
||||
<span t-field="line.product_uom"
|
||||
groups="uom.group_uom"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.qty_delivered"/>
|
||||
<span t-field="line.product_uom"
|
||||
groups="uom.group_uom"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-field="line.price_unit"/>
|
||||
</td>
|
||||
<td t-if="display_discount"
|
||||
class="text-right"
|
||||
groups="product.group_discount_per_so_line">
|
||||
<span t-field="line.discount"/>
|
||||
</td>
|
||||
<td class="text-right o_price_total">
|
||||
<span t-field="line.delivered_price_subtotal"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-if="line.display_type == 'line_section'">
|
||||
<td colspan="99">
|
||||
<span t-field="line.name"/>
|
||||
</td>
|
||||
<t t-set="current_section" t-value="line"/>
|
||||
<t t-set="current_subtotal" t-value="0"/>
|
||||
</t>
|
||||
<t t-if="line.display_type == 'line_note'">
|
||||
<td colspan="99">
|
||||
<span t-field="line.name"/>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
<t t-if="current_section and len(section_lines) > 1 and (line_last or order_lines[line_index+1].display_type == 'line_section')">
|
||||
<tr class="is-subtotal text-right">
|
||||
<td colspan="99">
|
||||
<strong class="mr16">Section
|
||||
Subtotal</strong>
|
||||
<span
|
||||
t-esc="current_subtotal"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="container_subtotal" name="so_total_summary">
|
||||
<div id="total" class="row justify-content-end" name="total">
|
||||
<div t-attf-class="#{'col-auto' if report_type != 'html' else 'col-sm-2'}">
|
||||
<table class="table table-sm">
|
||||
<tr t-if="final_tax" class="border-black o_subtotal"
|
||||
style="">
|
||||
<td><strong>Untaxed amount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="final_subtotal"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="container_subtotal" name="so_total_summary">
|
||||
<div id="total" class="row justify-content-end" name="total">
|
||||
<div t-attf-class="#{'col-auto' if report_type != 'html' else 'col-sm-2'}">
|
||||
<table class="table table-sm">
|
||||
<tr t-if="final_tax" class="border-black o_subtotal"
|
||||
style="">
|
||||
<td><strong>Untaxed amount</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="final_subtotal"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr t-if="final_tax" class="border-black o_subtotal">
|
||||
<td><strong>Taxes</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="final_tax"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr t-if="final_total" class="border-black o_total">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="final_total"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr t-if="final_tax" class="border-black o_subtotal">
|
||||
<td><strong>Taxes</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="final_tax"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr t-if="final_total" class="border-black o_total">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-esc="final_total"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -163,52 +166,53 @@
|
|||
<t t-set="interventions" t-value="doc.child_ids"/>
|
||||
<t t-set="timesheets" t-value="doc.timesheet_ids"/>
|
||||
<t t-foreach="interventions" t-as="intervention">
|
||||
<h2 style="page-break-before: always;"
|
||||
t-out="str(intervention_index + 1) + '. ' + intervention.name"/>
|
||||
<h3 t-if="intervention.equipment_ids">Equipment:
|
||||
<t t-foreach="intervention.equipment_ids" t-as="equipment_id">
|
||||
<span t-out="equipment_id.complete_name + (', ' if not equipment_id_last else '')"/>
|
||||
</t>
|
||||
</h3>
|
||||
<div>
|
||||
<span t-esc="intervention.description"/>
|
||||
</div>
|
||||
<t t-set="tasks" t-value="intervention.child_ids"/>
|
||||
<div t-if="tasks" class="table-responsive-sm">
|
||||
<table class="table table-sm o_main_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="7%">Status</th>
|
||||
<th width="30%">Task</th>
|
||||
<th width="18%">Technician</th>
|
||||
<th width="45%">Comments</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="tasks" t-as="task">
|
||||
<tr class="o_line_section p-1 m-1">
|
||||
<td t-out="task.stage_id.name"/>
|
||||
<td>
|
||||
<span t-out="task.name"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-foreach="task.user_ids" t-as="user">
|
||||
<span t-out="user.name + (', ' if not user_last else '')"/>
|
||||
</t>
|
||||
</td>
|
||||
<td t-out="task.description or ''"/>
|
||||
<div style="page-break-inside: avoid;">
|
||||
<h2 t-out="str(intervention_index + 1) + '. ' + intervention.name"/>
|
||||
<h3 t-if="intervention.equipment_ids">Equipment:
|
||||
<t t-foreach="intervention.equipment_ids" t-as="equipment_id">
|
||||
<span t-out="equipment_id.complete_name + (', ' if not equipment_id_last else '')"/>
|
||||
</t>
|
||||
</h3>
|
||||
<div>
|
||||
<span t-esc="intervention.description"/>
|
||||
</div>
|
||||
<t t-set="tasks" t-value="intervention.child_ids"/>
|
||||
<div t-if="tasks" class="table-responsive-sm">
|
||||
<table class="table table-sm o_main_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="7%">Status</th>
|
||||
<th width="30%">Task</th>
|
||||
<th width="18%">Technician</th>
|
||||
<th width="45%">Comments</th>
|
||||
</tr>
|
||||
<tr class="mt-0 pt-0">
|
||||
<td/>
|
||||
<td>
|
||||
<t t-call="bemade_fsm.subtask_list"/>
|
||||
</td>
|
||||
<td/>
|
||||
<td/>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="tasks" t-as="task">
|
||||
<tr class="p-1 m-1">
|
||||
<td t-out="task.stage_id.name"/>
|
||||
<td>
|
||||
<span t-out="task.name"/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-foreach="task.user_ids" t-as="user">
|
||||
<span t-out="user.name + (', ' if not user_last else '')"/>
|
||||
</t>
|
||||
</td>
|
||||
<td t-out="task.description or ''"/>
|
||||
</tr>
|
||||
<tr class="mt-0 pt-0">
|
||||
<td/>
|
||||
<td>
|
||||
<t t-call="bemade_fsm.subtask_list"/>
|
||||
</td>
|
||||
<td/>
|
||||
<td/>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
|
|
@ -251,7 +255,8 @@
|
|||
</t>
|
||||
</div>
|
||||
<div t-attf-class="{{'col-6' if report_type == 'pdf' else 'col-md-6 col-12'}}">
|
||||
<div t-if="doc.work_order_contacts"><h6>Work Order Contacts: </h6></div>
|
||||
<div t-if="doc.work_order_contacts"><h6>Work Order
|
||||
Contacts: </h6></div>
|
||||
<t t-foreach="doc.work_order_contacts" t-as="contact">
|
||||
<div class="mb-3">
|
||||
<div t-esc="contact" t-options='{
|
||||
|
|
@ -263,6 +268,43 @@
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template id="workorder_equipment_summary">
|
||||
<div t-if="doc.equipment_ids and len(doc.child_ids) > 1"
|
||||
style="page-break-inside: avoid;">
|
||||
<h3>Equipment Serviced</h3>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-sm o_main_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th>Name</th>
|
||||
<th>Application</th>
|
||||
<th>Location</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="doc.equipment_ids" t-as="equipment">
|
||||
<tr>
|
||||
<td><span t-esc="equipment.pid_tag"/></td>
|
||||
<td><span t-esc="equipment.name"/></td>
|
||||
<td>
|
||||
<t t-foreach="equipment.tag_ids"
|
||||
t-as="application">
|
||||
<span t-esc="application.name + (', ' if not application_last else '')"/>
|
||||
</t>
|
||||
</td>
|
||||
<td t-esc="equipment.partner_location_id"
|
||||
t-options='{
|
||||
"widget": "contact",
|
||||
"fields": ["name", "address"]}'
|
||||
/>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template id="workorder_page_signature_block">
|
||||
<div t-if="doc.worksheet_signature">
|
||||
<div t-if="report_type == html" class="ribbon" style="
|
||||
|
|
@ -287,7 +329,8 @@
|
|||
Signed
|
||||
</span>
|
||||
</div>
|
||||
<div t-attf-class="#{'col-12 col-lg-3' if report_type != 'html' else 'col-sm-7 col-md-4'} ml-auto text-right"
|
||||
<div t-attf-class="#{' col-12 col-lg-3' if report_type != 'html' else '
|
||||
col-sm-7 col-md-4'} ml-auto text-right"
|
||||
style="page-break-inside: avoid">
|
||||
<h5>Signature</h5>
|
||||
<img t-att-src="image_data_uri(doc.worksheet_signature)"
|
||||
|
|
@ -300,6 +343,7 @@
|
|||
<div class="page">
|
||||
<t t-call="bemade_fsm.workorder_page_info_block"/>
|
||||
<t t-call="bemade_fsm.workorder_page_sale_order_table"/>
|
||||
<t t-call="bemade_fsm.workorder_equipment_summary"/>
|
||||
<t t-call="bemade_fsm.workorder_page_signature_block"/>
|
||||
<t t-call="bemade_fsm.workorder_page_tasks_table"/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue