Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] l10n_ar_ux: duplicado/triplicado #510

Merged
merged 1 commit into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions l10n_ar_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This module extends the l10n_ar module to add some usability improvesment:
#. Show Name fantasy in the partner form view.
#. Set Non Monetary tag to accounts depending of the account type
#. Show Gross Income Jurisdiction in both partner and company
#. Add a not nice implementation for duplicado/triplicado on invoices (and later on delivery slip with l10n_ar_stock)
#. Add checks account link to chart template

Installation
Expand Down
3 changes: 2 additions & 1 deletion l10n_ar_ux/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
'name': 'Argentinian Accounting UX',
'version': "13.0.1.19.0",
'version': "13.0.1.20.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
Expand Down Expand Up @@ -30,6 +30,7 @@
'views/report_invoice.xml',
'views/account_payment_view.xml',
'views/account_journal_views.xml',
'views/ir_actions_views.xml',
'wizards/res_config_settings_views.xml',
'reports/account_invoice_report_view.xml',
'reports/report_payment_group.xml',
Expand Down
1 change: 1 addition & 0 deletions l10n_ar_ux/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
from . import res_partner
from . import account_payment
from . import res_config_settings
from . import ir_actions_report
30 changes: 30 additions & 0 deletions l10n_ar_ux/models/ir_actions_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################

from odoo import api, fields, models


class IrActionsReport(models.Model):
_inherit = 'ir.actions.report'

l10n_ar_copies = fields.Selection(
selection=[
# ('original', 'Solo Original'),
('duplicado', 'Duplicado'), ('triplicado', 'Duplicado y Triplicado')],
string="Agregar Duplicado/Triplicado",)

@api.model
def _get_rendering_context(self, docids, data):
res = super()._get_rendering_context(docids, data)
l10n_ar_copies = ['']
is_email = 'force_email' in self._context or 'default_subject' in self._context
if not is_email and self.l10n_ar_copies:
l10n_ar_copies = ['ORIGINAL', 'DUPLICADO']
if self.l10n_ar_copies == 'triplicado':
l10n_ar_copies += ['TRIPLICADO']
res.update({
'l10n_ar_copies_list': l10n_ar_copies,
})
return res
14 changes: 14 additions & 0 deletions l10n_ar_ux/views/ir_actions_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<odoo>

<record id="act_report_xml_view" model="ir.ui.view">
<field name="name">ir.actions.report</field>
<field name="model">ir.actions.report</field>
<field name="inherit_id" ref="base.act_report_xml_view"/>
<field name="arch" type="xml">
<field name="paperformat_id" position="after">
<field name="l10n_ar_copies" attrs="{'invisible': [('report_name', 'not in', ['stock.report_deliveryslip', 'account.report_invoice', 'account.report_invoice_with_payments'])]}"/>
</field>
</field>
</record>

</odoo>
20 changes: 20 additions & 0 deletions l10n_ar_ux/views/report_invoice.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<template id="report_invoice" inherit_id="account.report_invoice">
<t t-foreach="docs" position="replace">
<t t-foreach="l10n_ar_copies_list" t-as="copy_type">
<t>$0</t>
</t>
</t>
</template>

<template id="report_invoice_with_payments" inherit_id="account.report_invoice_with_payments">
<t t-foreach="docs" position="replace">
<t t-foreach="l10n_ar_copies_list" t-as="copy_type">
<t>$0</t>
</t>
</t>
</template>

<template id="custom_header" inherit_id="l10n_ar.custom_header">
<h4 position="after">
<strong><span tif="copy_type" t-esc="copy_type"/></strong>
</h4>

<!-- usar datos de header_adress en vez de company -->
<img t-if="o.company_id.logo" position="replace">
<img t-if="header_address.image_1920" t-att-src="image_data_uri(header_address.image_1920)" style="max-height: 45px;" alt="Logo"/>
Expand Down