Browse Source

[UPDT] Update in 'invoice_format_editor'

pull/216/head
AjmalCybro 3 years ago
parent
commit
95717f3b9d
  1. 2
      invoice_format_editor/__manifest__.py
  2. 11
      invoice_format_editor/doc/RELEASE_NOTES.md
  3. 116
      invoice_format_editor/reports/custom_invoice_template.xml
  4. 129
      invoice_format_editor/reports/default_invoice_template.xml

2
invoice_format_editor/__manifest__.py

@ -22,7 +22,7 @@
{
'name': 'Invoice Format Editor',
'version': '14.0.2.1.',
'version': '14.0.2.2.',
'category': 'Accounting',
'summary': 'Invoice Format Editor',
'description': """Invoice Format Editor For Configuring the Invoice Templates""",

11
invoice_format_editor/doc/RELEASE_NOTES.md

@ -0,0 +1,11 @@
## Module <invoice_format_editor>
#### 20.11.2021
#### Version 14.0.2.1.
#### ADD
- Initial commit for invoice_format_editor
#### 10.06.2022
#### Version 14.0.2.2.
#### UPDT AND BUGFIX
- Invoice printing issue

116
invoice_format_editor/reports/custom_invoice_template.xml

@ -105,24 +105,24 @@
t-field="o.partner_id"/>
<br/>
<span t-if="o.theme_id.address">
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.street"/>
<br/>
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.street2"/>
<br/>
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.street"/>
<br/>
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.street2"/>
<br/>
</span>
<span t-if="o.theme_id.city">
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.city"/>
<br/>
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.city"/>
<br/>
</span>
<span t-if="o.theme_id.country">
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.country_id"/>
<br/>
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.country_id"/>
<br/>
</span>
<span t-attf-style="color:#{o.theme_id.customer_text_color} !important;"
t-field="o.partner_id.vat"/>
@ -405,55 +405,59 @@
</div>
</t>
</template>
<template id="account.report_invoice_with_payments">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang"
t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="print_with_payments" t-value="True"/>
<t t-if="o.company_id.base_layout == 'normal'">
<t t-call="invoice_format_editor.custom_template_report_invoice_normal"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'old'">
<t t-call="invoice_format_editor.old_std_report_invoice_document"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'modern'">
<t t-call="invoice_format_editor.custom_template_report_invoice_modern"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'default'">
<t t-call="invoice_format_editor.report_invoice_document"
t-lang="o.partner_id.lang"/>
<template id="report_invoice_with_payments_inherit" inherit_id="account.report_invoice_with_payments">
<xpath expr="//t[@t-call='web.html_container']" position="replace">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang"
t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="print_with_payments" t-value="True"/>
<t t-if="o.company_id.base_layout == 'normal'">
<t t-call="invoice_format_editor.custom_template_report_invoice_normal"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'old'">
<t t-call="invoice_format_editor.old_std_report_invoice_document"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'modern'">
<t t-call="invoice_format_editor.custom_template_report_invoice_modern"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'default'">
<t t-call="invoice_format_editor.report_invoice_document"
t-lang="o.partner_id.lang"/>
</t>
</t>
</t>
</t>
</xpath>
</template>
<template id="account.report_invoice">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang"
t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="print_with_payments" t-value="True"/>
<t t-if="o.company_id.base_layout == 'normal'">
<t t-call="invoice_format_editor.custom_template_report_invoice_normal"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'old'">
<t t-call="invoice_format_editor.old_std_report_invoice_document"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'modern'">
<t t-call="invoice_format_editor.custom_template_report_invoice_modern"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'default'">
<t t-call="invoice_format_editor.report_invoice_document"
t-lang="o.partner_id.lang"/>
<template id="report_invoice_inherit" inherit_id="account.report_invoice">
<xpath expr="//t[@t-call='web.html_container']" position="replace">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang"
t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="print_with_payments" t-value="True"/>
<t t-if="o.company_id.base_layout == 'normal'">
<t t-call="invoice_format_editor.custom_template_report_invoice_normal"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'old'">
<t t-call="invoice_format_editor.old_std_report_invoice_document"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'modern'">
<t t-call="invoice_format_editor.custom_template_report_invoice_modern"
t-lang="o.partner_id.lang"/>
</t>
<t t-if="o.company_id.base_layout == 'default'">
<t t-call="invoice_format_editor.report_invoice_document"
t-lang="o.partner_id.lang"/>
</t>
</t>
</t>
</t>
</xpath>
</template>
</data>
</odoo>

129
invoice_format_editor/reports/default_invoice_template.xml

@ -3,12 +3,16 @@
<data>
<template id="report_invoice_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context(lang=lang)" />
<t t-set="o" t-value="o.with_context(lang=lang)"/>
<t t-set="address">
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<address t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
<div t-if="o.partner_id.vat" class="mt16">
<t t-if="o.company_id.country_id.vat_label" t-esc="o.company_id.country_id.vat_label" id="inv_tax_id_label"/>
<t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/></div>
<t t-if="o.company_id.country_id.vat_label" t-esc="o.company_id.country_id.vat_label"
id="inv_tax_id_label"/>
<t t-else="">Tax ID</t>:
<span t-field="o.partner_id.vat"/>
</div>
</t>
<div class="page">
<h2>
@ -26,7 +30,9 @@
<strong>Invoice Date:</strong>
<p class="m-0" t-field="o.invoice_date"/>
</div>
<div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'" name="due_date">
<div class="col-auto col-3 mw-100 mb-2"
t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'"
name="due_date">
<strong>Due Date:</strong>
<p class="m-0" t-field="o.invoice_date_due"/>
</div>
@ -49,13 +55,24 @@
<table class="table table-sm o_main_table" name="invoice_line_table">
<thead>
<tr>
<th name="th_description" class="text-left"><span>Description</span></th>
<th name="th_quantity" class="text-right"><span>Quantity</span></th>
<th name="th_priceunit" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Unit Price</span></th>
<th name="th_price_unit" t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<th name="th_description" class="text-left">
<span>Description</span>
</th>
<th name="th_quantity" class="text-right">
<span>Quantity</span>
</th>
<th name="th_priceunit"
t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span>Unit Price</span>
</th>
<th name="th_price_unit" t-if="display_discount"
t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span>Disc.%</span>
</th>
<th name="th_taxes" t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Taxes</span></th>
<th name="th_taxes"
t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span>Taxes</span>
</th>
<th name="th_subtotal" 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>
@ -64,31 +81,40 @@
</thead>
<tbody class="invoice_tbody">
<t t-set="current_subtotal" t-value="0"/>
<t t-set="lines" t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"/>
<t t-set="lines"
t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"/>
<t t-foreach="lines" t-as="line">
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal"
groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.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" name="account_invoice_line_accountable">
<td name="account_invoice_line_name"><span t-field="line.name" t-options="{'widget': 'text'}"/></td>
<td name="account_invoice_line_name">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
<td class="text-right">
<span t-field="line.quantity"/>
<span t-field="line.product_uom_id" groups="uom.group_uom"/>
<span t-field="line.product_uom_id" groups="uom.group_uom"/>
</td>
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span class="text-nowrap" t-field="line.price_unit"/>
</td>
<td t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<td t-if="display_discount"
t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span class="text-nowrap" t-field="line.discount"/>
</td>
<td t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))" id="line_tax_ids"/>
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))"
id="line_tax_ids"/>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap" t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<span class="text-nowrap" t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<span class="text-nowrap" t-field="line.price_subtotal"
groups="account.group_show_line_subtotals_tax_excluded"/>
<span class="text-nowrap" t-field="line.price_total"
groups="account.group_show_line_subtotals_tax_included"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
@ -110,8 +136,8 @@
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
</td>
</tr>
@ -125,7 +151,9 @@
<div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ml-auto">
<table class="table table-sm" style="page-break-inside: avoid;">
<tr class="border-black o_subtotal" style="">
<td><strong>Subtotal</strong></td>
<td>
<strong>Subtotal</strong>
</td>
<td class="text-right">
<span t-field="o.amount_untaxed"/>
</td>
@ -133,15 +161,17 @@
<t t-foreach="o.amount_by_group" t-as="amount_by_group">
<tr style="">
<t t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) in [0, 1] and o.amount_untaxed == amount_by_group[2]">
<td><span class="text-nowrap" t-esc="amount_by_group[0]"/></td>
<td>
<span class="text-nowrap" t-esc="amount_by_group[0]"/>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap" t-esc="amount_by_group[3]" />
<span class="text-nowrap" t-esc="amount_by_group[3]"/>
</td>
</t>
<t t-else="">
<td>
<span t-esc="amount_by_group[0]"/>
<span class="text-nowrap"> on
<span class="text-nowrap">on
<t t-esc="amount_by_group[4]"/>
</span>
</td>
@ -152,27 +182,36 @@
</tr>
</t>
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span class="text-nowrap" t-field="o.amount_total"/>
</td>
</tr>
<t t-if="print_with_payments">
<t t-if="o.payment_state != 'invoicing_legacy'">
<t t-set="payments_vals" t-value="o.sudo()._get_reconciled_info_JSON_values()"/>
<t t-set="payments_vals"
t-value="o.sudo()._get_reconciled_info_JSON_values()"/>
<t t-foreach="payments_vals" t-as="payment_vals">
<tr>
<td>
<i class="oe_form_field text-right oe_payment_label">Paid on <t t-esc="payment_vals['date']" t-options='{"widget": "date"}'/></i>
<i class="oe_form_field text-right oe_payment_label">Paid on
<t t-esc="payment_vals['date']"
t-options='{"widget": "date"}'/>
</i>
</td>
<td class="text-right">
<span t-esc="payment_vals['amount']" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
<span t-esc="payment_vals['amount']"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</t>
<t t-if="len(payments_vals) > 0">
<tr class="border-black">
<td><strong>Amount Due</strong></td>
<td>
<strong>Amount Due</strong>
</td>
<td class="text-right">
<span t-field="o.amount_residual"/>
</td>
@ -184,8 +223,12 @@
</div>
</div>
</div>
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference" name="payment_communication">
Please use the following communication for your payment : <b><span t-field="o.payment_reference"/></b>
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference"
name="payment_communication">
Please use the following communication for your payment :
<b>
<span t-field="o.payment_reference"/>
</b>
</p>
<p t-if="o.invoice_payment_term_id" name="payment_term">
<span t-field="o.invoice_payment_term_id.note"/>
@ -197,11 +240,16 @@
<span t-field="o.fiscal_position_id.note"/>
</p>
<p t-if="o.invoice_incoterm_id" name="incoterm">
<strong>Incoterm: </strong><span t-field="o.invoice_incoterm_id.code"/> - <span t-field="o.invoice_incoterm_id.name"/>
<strong>Incoterm:</strong>
<span t-field="o.invoice_incoterm_id.code"/>
-
<span t-field="o.invoice_incoterm_id.name"/>
</p>
<div id="qrcode" t-if="o.display_qr_code">
<p t-if="qr_code_urls.get(o.id)">
<strong class="text-center">Scan me with your banking app.</strong><br/><br/>
<strong class="text-center">Scan me with your banking app.</strong>
<br/>
<br/>
<img class="border border-dark rounded" t-att-src="qr_code_urls[o.id]"/>
</p>
</div>
@ -212,9 +260,10 @@
<template id="report_invoice">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="lang"
t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-if="o._get_name_invoice_report() == 'account.report_invoice_document'"
t-call="account.report_invoice_document" t-lang="lang"/>
t-call="account.report_invoice_document" t-lang="lang"/>
</t>
</t>
</template>
@ -222,10 +271,11 @@
<template id="report_invoice_with_payments">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="lang"
t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="print_with_payments" t-value="True"/>
<t t-if="o._get_name_invoice_report() == 'account.report_invoice_document'"
t-call="account.report_invoice_document" t-lang="lang"/>
t-call="account.report_invoice_document" t-lang="lang"/>
</t>
</t>
</template>
@ -236,7 +286,8 @@
<template id="report_original_vendor_bill">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<div class="article" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')"></div>
<div class="article" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id"
t-att-data-oe-lang="o and o.env.context.get('lang')"></div>
</t>
</t>
</template>

Loading…
Cancel
Save