Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sale_order_offer_version/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def _default_type_id(self):

@api.onchange("type_id")
def onchange_type_id(self):
result = super().onchange_type_id()
# result = super().onchange_type_id()
for order in self.filtered(lambda x: x.type_id):
self.is_offer_type = order.type_id.is_offer_type
return result
order.is_offer_type = order.type_id.is_offer_type
# return result

def action_confirm(self):
if any(self.filtered("is_offer_type")):
Expand Down
97 changes: 40 additions & 57 deletions sale_order_offer_version/reports/sale_order_report_template.xml
Original file line number Diff line number Diff line change
@@ -1,64 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template
<template
id="report_saleorder_offer_document"
inherit_id="sale.report_saleorder_document"
>
<t t-set="address" position="after">
<t t-set="offer" t-value="doc.type_id.is_offer_type" />
</t>
<div t-if="doc.client_order_ref" position="after">
<div t-if="offer and doc.date_order" class="col-auto col-3 mw-100 mb-2">
<strong>Offer Date:</strong>
<p class="m-0" t-field="doc.date_order" />
</div>
</div>
<span t-field="doc.name" position="before">
<span t-if="offer">Offer # </span>
</span>
<t
t-if="not (env.context.get('proforma', False) or is_pro_forma)"
position="attributes"

<!-- Definir variable "offer" -->
<xpath expr="//t[@t-set='address']" position="after">
<t t-set="offer" t-value="doc.type_id.is_offer_type" />
</xpath>

<!-- Prefijar "Offer #" al nombre si aplica -->
<xpath expr="//span[@t-field='doc.name']" position="before">
<t t-if="offer">Offer # </t>
</xpath>

<!-- Mostrar fecha de oferta -->
<xpath
expr="//div[contains(@class, 'col-auto') and contains(., 'Quotation Date')]"
position="before"
>
<attribute
name="t-if"
>not offer and not (env.context.get('proforma', False) or is_pro_forma)</attribute>
</t>
<t
t-if="env.context.get('proforma', False) or is_pro_forma"
position="attributes"
>
<attribute
name="t-if"
>not offer and (env.context.get('proforma', False) or is_pro_forma)</attribute>
</t>
<div
t-if="doc.date_order and doc.state not in ['draft','sent']"
position="attributes"
>
<attribute
name="t-if"
>not offer and doc.date_order and doc.state not in ['draft','sent']</attribute>
</div>
<div
t-if="doc.date_order and doc.state in ['draft','sent']"
position="attributes"
>
<attribute
name="t-if"
>not offer and doc.date_order and doc.state in ['draft','sent']</attribute>
</div>
<th name="th_taxes" position="attributes">
<attribute name="t-if">not offer</attribute>
</th>
<td name="td_taxes" position="attributes">
<attribute name="t-if">not offer</attribute>
</td>
<xpath expr="//tr[hasclass('is-subtotal')]" position="attributes">
<attribute name="t-if">not offer</attribute>
</xpath>
<div name="so_total_summary" position="attributes">
<attribute name="t-if">not offer</attribute>
</div>
</template>
<div t-if="offer and doc.date_order" class="col-auto col-3 mw-100 mb-2">
<strong>Offer Date:</strong>
<p class="m-0" t-field="doc.date_order" />
</div>
</xpath>

<!-- Ocultar secciones si es oferta -->
<xpath expr="//div[@name='so_total_summary']" position="attributes">
<attribute name="t-if">not offer</attribute>
</xpath>

<xpath expr="//th[@name='th_taxes']" position="attributes">
<attribute name="t-if">not offer</attribute>
</xpath>

<xpath expr="//td[@name='td_taxes']" position="attributes">
<attribute name="t-if">not offer</attribute>
</xpath>

<xpath expr="//tr[contains(@class, 'is-subtotal')]" position="attributes">
<attribute name="t-if">not offer</attribute>
</xpath>

</template>
</odoo>
Loading