[ADD]pms: reports invoice proforma

This commit is contained in:
Darío Lodeiros
2022-11-01 11:57:35 +01:00
parent 066a86d87d
commit 3f7abf5376
6 changed files with 89 additions and 22 deletions

View File

@@ -92,6 +92,8 @@
"views/res_partner_id_category.xml",
"views/payment_transaction_views.xml",
"views/account_move_line_views.xml",
"report/proforma_report_templates.xml",
"report/proforma_report.xml",
],
"demo": [
"demo/pms_master_data.xml",

View File

@@ -1,30 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//address" position="before">
<t t-if="o.pms_property_id">
<t t-set="information_block">
<div name="pms_property_address_block">
<div
t-field="o.pms_property_id.partner_id"
t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: True}"
/>
</div>
</t>
</t>
</xpath>
<xpath expr="//div[@class='page']//h2" position="replace">
<h2>
<span
t-if="o.move_type == 'out_invoice' and o.is_simplified_invoice and o.state == 'posted'"
>Simplified Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and o.is_simplified_invoice and o.state == 'draft'"
>Draft Simplified Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and o.is_simplified_invoice and o.state == 'cancel'"
>Cancelled Simplified Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and not o.is_simplified_invoice and o.state == 'posted'"
>Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and not o.is_simplified_invoice and o.state == 'draft'"
>Draft Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and not o.is_simplified_invoice and o.state == 'cancel'"
>Cancelled Invoice</span>
<span t-if="o.move_type == 'out_refund'">Credit Note</span>
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note</span>
<span t-if="o.move_type == 'in_invoice'">Vendor Bill</span>
<span t-if="o.name != '/'" t-field="o.name" />
<t t-if="not (env.context.get('proforma', False) or is_pro_forma)">
<span
t-if="o.move_type == 'out_invoice' and o.is_simplified_invoice and o.state == 'posted'"
>Simplified Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and o.is_simplified_invoice and o.state == 'draft'"
>Draft Simplified Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and o.is_simplified_invoice and o.state == 'cancel'"
>Cancelled Simplified Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and not o.is_simplified_invoice and o.state == 'posted'"
>Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and not o.is_simplified_invoice and o.state == 'draft'"
>Draft Invoice</span>
<span
t-if="o.move_type == 'out_invoice' and not o.is_simplified_invoice and o.state == 'cancel'"
>Cancelled Invoice</span>
<span t-if="o.move_type == 'out_refund'">Credit Note</span>
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note</span>
<span t-if="o.move_type == 'in_invoice'">Vendor Bill</span>
<span t-if="o.name != '/'" t-field="o.name" />
</t>
<t t-if="env.context.get('proforma', False) or is_pro_forma">
<span>Pro-Forma Invoice # </span>
</t>
</h2>
</xpath>
</template>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="action_report_pms_pro_forma_invoice" model="ir.actions.report">
<field name="name">PRO-FORMA Invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">pms.report_pms_pro_forma</field>
<field name="report_file">pms.report_pms_pro_forma</field>
<field name="print_report_name">'PRO-FORMA - %s' % (object.name)</field>
<field name="binding_model_id" ref="model_account_move" />
<field name="binding_type">report</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_pms_pro_forma">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="is_pro_forma" t-value="True" />
<t t-set="o" t-value="o.with_context(proforma=True)" />
<t
t-call="account.report_invoice_document"
t-lang="o.partner_id.lang"
/>
</t>
</t>
</template>
</odoo>

View File

@@ -42,6 +42,7 @@
"views/precheckin_portal_templates.xml",
"wizards/traveller_report.xml",
"wizards/wizard_ine.xml",
"reports/invoice.xml",
],
"installable": True,
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//div[@t-if='o.partner_id.vat']" position="after">
<div
t-if="not o.partner_id.vat and o.partner_id.aeat_identification_type"
class="mt16"
>
<t><span t-field="o.partner_id.aeat_identification_type" /></t>: <span
t-field="o.partner_id.aeat_identification"
/>
</div>
</xpath>
</template>
</odoo>