bemade_fsm: further progress on work order PDF.
This commit is contained in:
parent
8459ce3673
commit
838db389b0
2 changed files with 72 additions and 6 deletions
|
|
@ -51,12 +51,14 @@ class Task(models.Model):
|
||||||
|
|
||||||
relevant_order_lines = fields.Many2many(comodel_name='sale.order.line',
|
relevant_order_lines = fields.Many2many(comodel_name='sale.order.line',
|
||||||
store=False,
|
store=False,
|
||||||
compute='_compute_relevant_order_lines',)
|
compute='_compute_relevant_order_lines', )
|
||||||
|
|
||||||
@api.depends('sale_order_id')
|
@api.depends('sale_order_id')
|
||||||
def _compute_relevant_order_lines(self):
|
def _compute_relevant_order_lines(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
rec.relevant_order_lines = rec.sale_order_id \
|
rec.relevant_order_lines = (
|
||||||
and rec.sale_order_id.get_relevant_order_lines(rec)
|
rec.sale_order_id and rec.sale_order_id.get_relevant_order_lines(
|
||||||
|
rec) or False)
|
||||||
|
|
||||||
def _get_closed_stage_by_project(self):
|
def _get_closed_stage_by_project(self):
|
||||||
""" Gets the stage representing completed tasks for each project in
|
""" Gets the stage representing completed tasks for each project in
|
||||||
|
|
@ -172,7 +174,7 @@ class Task(models.Model):
|
||||||
template = rec.sale_line_id and rec.sale_line_id.product_id.task_template_id
|
template = rec.sale_line_id and rec.sale_line_id.product_id.task_template_id
|
||||||
if not rec.parent_id:
|
if not rec.parent_id:
|
||||||
rec.name = f"{rec.sale_order_id.name}: " \
|
rec.name = f"{rec.sale_order_id.name}: " \
|
||||||
f"{rec.sale_order_id.partner_shipping_id.name} - " \
|
f"{rec.sale_order_id.partner_shipping_id.name} - " \
|
||||||
f"{rec.sale_line_id.name}"
|
f"{rec.sale_line_id.name}"
|
||||||
if template:
|
if template:
|
||||||
rec.name += f" ({template.name})"
|
rec.name += f" ({template.name})"
|
||||||
|
|
|
||||||
|
|
@ -128,14 +128,14 @@
|
||||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr t-if="final_tax">
|
<tr t-if="final_tax" class="border-black o_subtotal">
|
||||||
<td><strong>Taxes</strong></td>
|
<td><strong>Taxes</strong></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<span t-esc="final_tax"
|
<span t-esc="final_tax"
|
||||||
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
t-options='{"widget": "monetary", "display_currency": doc.sale_order_id.pricelist_id.currency_id}'/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr t-if="final_total" class="border-black o_total">
|
||||||
<td><strong>Total</strong></td>
|
<td><strong>Total</strong></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<span t-esc="final_total"
|
<span t-esc="final_total"
|
||||||
|
|
@ -147,6 +147,69 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template id="subtask_list">
|
||||||
|
<ul t-if="task.child_ids" class="ml-1 pl-1" style="list-style-type: none;">
|
||||||
|
<t t-foreach="task.child_ids" t-as="subtask">
|
||||||
|
<li class="ml-1">
|
||||||
|
<span t-out="subtask.name"/>
|
||||||
|
<t t-call="bemade_fsm.subtask_list">
|
||||||
|
<t t-set="task" t-value="subtask"/>
|
||||||
|
</t>
|
||||||
|
</li>
|
||||||
|
</t>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
<template id="workorder_page_tasks_table">
|
||||||
|
<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>
|
||||||
|
<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">
|
||||||
|
<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>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</template>
|
||||||
<template id="workorder_page_info_block">
|
<template id="workorder_page_info_block">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div t-attf-class="{{'col-6' if report_type == 'pdf' else 'col-md-6 col-12'}}">
|
<div t-attf-class="{{'col-6' if report_type == 'pdf' else 'col-md-6 col-12'}}">
|
||||||
|
|
@ -210,6 +273,7 @@
|
||||||
<t t-call="bemade_fsm.workorder_page_info_block"/>
|
<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_page_sale_order_table"/>
|
||||||
<t t-call="bemade_fsm.workorder_page_signature_block"/>
|
<t t-call="bemade_fsm.workorder_page_signature_block"/>
|
||||||
|
<t t-call="bemade_fsm.workorder_page_tasks_table"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template id="work_order">
|
<template id="work_order">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue