Skip to content

Commit 7e1df65

Browse files
authoredJun 26, 2019
[MERGE] port-forward from v11.0
12.0 merge 11.02
2 parents 3b4a04f + 1cbcf38 commit 7e1df65

29 files changed

+330
-104
lines changed
 

‎.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ python:
99
- "3.5"
1010

1111
addons:
12+
postgresql: "9.6"
1213
apt:
1314
# only add the two lines below if you need wkhtmltopdf for your tests
1415
# sources:

‎l10n_ar_account/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Módulo base de Contabilidad Argentina",
3-
'version': '11.0.1.17.0',
3+
'version': '11.0.1.23.0',
44
'category': 'Localization/Argentina',
55
'sequence': 14,
66
'author': 'ADHOC SA,Moldeo Interactive,Odoo Community Association (OCA)',

‎l10n_ar_account/data/res_currency.xml

+3
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@
3232
<record model='res.currency' forcecreate="0" id='base.EUR'>
3333
<field name="afip_code">060</field>
3434
</record>
35+
<record model='res.currency' forcecreate="0" id='base.CHF'>
36+
<field name="afip_code">009</field>
37+
</record>
3538

3639
</odoo>

‎l10n_ar_account/models/account_invoice.py

+28-18
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ class AccountInvoice(models.Model):
4747
# TODO make it editable, we have to change move create method
4848
readonly=True,
4949
)
50-
# computed_currency_rate = fields.Float(
51-
# string='Currency Rate',
52-
# compute='_compute_currency_rate',
53-
# digits=(10, 6),
54-
# )
50+
computed_currency_rate = fields.Float(
51+
string='Currency Rate',
52+
digits=(16, 4),
53+
compute='_compute_currency_rate',
54+
)
5555
document_letter_id = fields.Many2one(
5656
related='document_type_id.document_letter_id',
5757
readonly=True,
@@ -338,19 +338,27 @@ def _compute_concept(self):
338338
afip_concept = rec._get_concept()
339339
rec.afip_concept = afip_concept
340340

341+
# TODO al final lo re implementamos solo para poder previsualizar
342+
# cual va a ser la cotizacion, es medio feo pero lo hacemos asi para tener
343+
# solucion rapida, deberiamos hacer algo mas definitivo
341344
# TODO borrar o implementar. Al final usamos el currency rate que
342345
# almacenamos porque es muy inexacto calcularlo ya que se pierde
343346
# información y segun el importe, al mismo cambio, podriamos tener
344347
# distintos valores de cambio
345-
# @api.multi
346-
# def _compute_currency_rate(self):
347-
# for rec in self:
348-
# if rec.currency_id and rec.company_id and (
349-
# rec.currency_id != rec.company_id.currency_id):
350-
# rec.computed_currency_rate = abs(
351-
# rec.amount_total_company_signed / rec.amount_total)
352-
# else:
353-
# rec.computed_currency_rate = 1.0
348+
@api.depends('currency_id', 'company_id', 'date_invoice')
349+
def _compute_currency_rate(self):
350+
for rec in self:
351+
if rec.currency_id and rec.company_id and (
352+
rec.currency_id != rec.company_id.currency_id):
353+
# rec.computed_currency_rate = abs(
354+
# rec.amount_total_company_signed / rec.amount_total)
355+
currency = rec.currency_id.with_context(
356+
company_id=rec.company_id.id,
357+
date=rec.date_invoice or fields.Date.context_today(rec))
358+
rec.computed_currency_rate = currency.compute(
359+
1., self.company_id.currency_id, round=False)
360+
else:
361+
rec.computed_currency_rate = 1.0
354362

355363
@api.multi
356364
def get_localization_invoice_vals(self):
@@ -362,6 +370,7 @@ def get_localization_invoice_vals(self):
362370
currency_rate = 1.0
363371
else:
364372
currency = self.currency_id.with_context(
373+
company_id=self.company_id.id,
365374
date=self.date_invoice or fields.Date.context_today(self))
366375
currency_rate = currency.compute(
367376
1., self.company_id.currency_id, round=False)
@@ -605,10 +614,11 @@ def check_argentinian_invoice_taxes(self):
605614
# única alicuota, entonces el impuesto liquidado da cero y se
606615
# obliga reportar con alicuota 0, entonces se exige tmb cod de op.
607616
# esta restriccion no es de FE si no de aplicativo citi
608-
zero_vat_lines = invoice.tax_line_ids.filtered(
609-
lambda r: ((
610-
r.tax_id.tax_group_id.afip_code in [4, 5, 6, 8, 9] and
611-
r.currency_id.is_zero(r.amount))))
617+
vat_taxes = invoice.tax_line_ids.filtered(
618+
lambda x: x.tax_id.tax_group_id.afip_code in [
619+
4, 5, 6, 8, 9])
620+
zero_vat_lines = vat_taxes and all(
621+
x.currency_id.is_zero(x.amount) for x in vat_taxes)
612622
if (
613623
zero_vat_lines and
614624
invoice.fiscal_position_id.afip_code

‎l10n_ar_account/report/invoice_analysis.py

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class AccountInvoiceLineReport(models.Model):
3434
('paid', 'Done'),
3535
('cancel', 'Cancelled')
3636
], 'Invoice State', readonly=True)
37+
account_id = fields.Many2one('account.account', readonly=True)
3738
document_type_id = fields.Many2one('account.document.type', readonly=True)
3839
date = fields.Date('Accounting Date', readonly=True)
3940
date_invoice = fields.Date('Date Invoice', readonly=True)
@@ -103,6 +104,7 @@ def init(self):
103104
"account_invoice_line"."id" AS "id",
104105
"account_invoice_line"."price_unit" AS "price_unit",
105106
"account_invoice_line"."discount" AS "discount",
107+
"account_invoice_line"."account_id" AS "account_id",
106108
"account_invoice_line"."account_analytic_id" AS "account_analytic_id",
107109
"account_invoice_line"."price_subtotal_signed" AS
108110
"price_subtotal_signed",

‎l10n_ar_account/report/invoice_analysis.xml

+25-19
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<filter string="Invoice" domain="['|', ('type','=','out_invoice'),('type','=','in_invoice')]"/>
5656
<filter string="Refund" domain="['|', ('type','=','out_refund'),('type','=','in_refund')]"/>
5757
<separator/>
58-
<filter string="With AFIP Document" name="with_afip_document" domain="[('journal_id.use_documents', '=', True)]"/>
58+
<filter string="With AFIP Document" name="with_afip_document" domain="[('journal_id.use_documents', '=', True), ('journal_id.localization', '=', 'argentina')]"/>
5959
<separator/>
6060
<field name="name_template"/>
6161
<filter string="Draft"
@@ -69,17 +69,21 @@
6969
<separator/>
7070
<filter string="Last month"
7171
name="last_month"
72-
domain="[('date_invoice', '&gt;=', (context_today()-relativedelta(months=1)).strftime('%Y-%m-01')), ('date_invoice', '&lt;', (context_today()).strftime('%Y-%m-01'))]"/>
72+
help="Last month (by accounting date)"
73+
domain="[('date', '&gt;=', (context_today()-relativedelta(months=1)).strftime('%Y-%m-01')), ('date', '&lt;', (context_today()).strftime('%Y-%m-01'))]"/>
7374
<filter string="This month"
7475
name="this_month"
75-
domain="[('date_invoice', '&gt;=', context_today().strftime('%Y-%m-01')), ('date_invoice', '&lt;', (context_today()+relativedelta(months=1)).strftime('%Y-%m-01'))]"/>
76+
help="This month (by accounting date)"
77+
domain="[('date', '&gt;=', context_today().strftime('%Y-%m-01')), ('date', '&lt;', (context_today()+relativedelta(months=1)).strftime('%Y-%m-01'))]"/>
7678
<separator/>
7779
<filter string="Last year"
7880
name="last_year"
79-
domain="[('date_invoice', '&gt;=', (context_today()-relativedelta(years=1)).strftime('%Y-01-01')), ('date_invoice', '&lt;', (context_today()).strftime('%Y-01-01'))]"/>
81+
help="Last year (by accounting date)"
82+
domain="[('date', '&gt;=', (context_today()-relativedelta(years=1)).strftime('%Y-01-01')), ('date', '&lt;', (context_today()).strftime('%Y-01-01'))]"/>
8083
<filter string="This year"
8184
name="this_year"
82-
domain="[('date_invoice', '&gt;=', context_today().strftime('%Y-01-01')), ('date_invoice', '&lt;', (context_today()+relativedelta(years=1)).strftime('%Y-01-01'))]"/>
85+
help="This year (by accounting date)"
86+
domain="[('date', '&gt;=', context_today().strftime('%Y-01-01')), ('date', '&lt;', (context_today()+relativedelta(years=1)).strftime('%Y-01-01'))]"/>
8387

8488
<field name="date_invoice_from" filter_domain="[('date_invoice','&gt;=',self)]"/>
8589
<field name="date_invoice_to" filter_domain="[('date_invoice','&lt;=',self)]"/>
@@ -89,30 +93,32 @@
8993
<!-- <field name="period_id" /> -->
9094
<!-- <field name="fiscalyear_id" /> -->
9195
<field name="product_id"/>
96+
<field name="account_id"/>
9297
<field name="document_type_id"/>
9398
<field name="product_category_id" filter_domain="[('product_category_id', 'child_of', self)]"/>
9499
<field name="partner_id"/>
95100
<!-- <field name="partner_category_ids"/> -->
96101
<group expand="1" string="Group By...">
97-
<filter string="Use" name="partner" context="{'group_by':'partner_id'}"/>
98-
<filter string="Partner" name="partner" context="{'group_by':'partner_id'}"/>
99-
<filter string="Currency" name="currency" context="{'group_by':'currency_id'}"/>
100-
<filter string="Salesman" name='user' context="{'group_by':'user_id'}"/>
101-
<filter string="AFIP Activity" name='afip_activity_id' context="{'group_by':'afip_activity_id'}"/>
102+
<filter string="Use" name="group_by_partner" context="{'group_by':'partner_id'}"/>
103+
<filter string="Partner" name="group_by_partner" context="{'group_by':'partner_id'}"/>
104+
<filter string="Currency" name="group_by_currency" context="{'group_by':'currency_id'}"/>
105+
<filter string="Salesman" name="group_by_user" context="{'group_by':'user_id'}"/>
102106
<!-- <filter string="Period" name='period_id' context="{'group_by':'period_id'}"/> -->
103107
<!-- <filter string="Fiscal Year" name='fiscalyear_id' context="{'group_by':'fiscalyear_id'}"/> -->
104-
<filter string="State" context="{'group_by':'state_id'}"/>
105-
<filter string="Document Type" context="{'group_by':'document_type_id'}"/>
106-
<filter string="Product" context="{'group_by':'product_id'}"/>
107-
<filter string="Product Category" name="category_product" context="{'group_by':'product_category_id'}"/>
108-
<filter string="State" context="{'group_by':'state'}"/>
109-
<filter string="Journal Type" context="{'group_by':'type'}"/>
110-
<filter string="Journal" context="{'group_by':'journal_id'}"/>
111-
<filter string="Company" context="{'group_by':'company_id'}"/>
108+
<filter name="group_by_company_id" string="Company" context="{'group_by':'company_id'}"/>
109+
<filter name="group_by_state_id" string="State" context="{'group_by':'state_id'}"/>
110+
<filter name="group_by_document_type_id" string="Document Type" context="{'group_by':'document_type_id'}"/>
111+
<filter string="AFIP Activity" name="group_by_afip_activity_id" context="{'group_by':'afip_activity_id'}"/>
112+
<filter string="Account" name="group_by_account_id" context="{'group_by':'account_id'}"/>
113+
<filter name="group_by_product_id" string="Product" context="{'group_by':'product_id'}"/>
114+
<filter string="Product Category" name="group_by_category_product" context="{'group_by':'product_category_id'}"/>
115+
<filter name="group_by_state" string="State" context="{'group_by':'state'}"/>
116+
<filter name="group_by_type" string="Journal Type" context="{'group_by':'type'}"/>
117+
<filter name="group_by_journal_id" string="Journal" context="{'group_by':'journal_id'}"/>
112118
<!-- <filter string="Week" name="week" context="{'group_by':'week'}" help="Group by week of Invoice Date"/> -->
113119
<!-- <filter string="Month" name="month" context="{'group_by':'month'}" help="Group by month of Invoice Date"/> -->
114120
<!-- <filter string="Year" name="year" context="{'group_by':'year'}" help="Group by year of Invoice Date"/> -->
115-
</group>
121+
</group>
116122
</search>
117123
</field>
118124
</record>

‎l10n_ar_account/security/security.xml

+7
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@
1515
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
1616
</record>
1717

18+
<record id="account_ar_vat_line_rule" model="ir.rule">
19+
<field name="name">Línea de IVA para análisis en localización argentina</field>
20+
<field name="model_id" ref="model_account_ar_vat_line"/>
21+
<field name="global" eval="True"/>
22+
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
23+
</record>
24+
1825
</odoo>

‎l10n_ar_account/view/account_invoice_view.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
</form>
2525
<div groups="base.group_multi_currency" position="after">
2626
<!-- <field name="old_currency_rate" attrs="{'invisible': [('old_currency_rate', '=', False)]}"/> -->
27-
<field name="currency_rate" attrs="{'invisible': [('currency_rate', '=', False)]}"/>
27+
<field name="currency_rate" attrs="{'invisible': ['|', ('currency_rate', '=', False), ('currency_rate', '=', 0.0)]}"/>
28+
<field name="computed_currency_rate" attrs="{'invisible': [('currency_rate', '!=', 0.0)]}"/>
2829
</div>
2930

3031
<field name="journal_id" position="after">

‎l10n_ar_account/wizard/res_config_settings_view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<label for="arba_cit" string="ARBA"/>
4141
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." groups="base.group_multi_company"/>
4242
<div class="text-muted" name="arba_description">
43-
Indique la clave CIT si utiliza padrón de ARBA de ret/perc de iibb o remito electrónico mediante web-service de ARBA.
43+
Indique la clave CIT si utiliza padrón de ARBA de ret/perc de iibb.
4444
</div>
4545
<div class="content-group" name="arba-content-group">
4646
<div class="row">

‎l10n_ar_account_vat_ledger/__manifest__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Argentinian VAT Ledger Management",
3-
'version': '11.0.11.0.0',
3+
'version': '11.0.11.1.0',
44
'category': 'Localization/Argentina',
55
'sequence': 14,
66
'author': 'ADHOC SA,Moldeo Interactive,Odoo Community Association (OCA)',
@@ -15,8 +15,8 @@
1515
},
1616
"data": [
1717
'data/l10n_ar_account_vat_ledger_data.xml',
18-
'views/account_vat_report_views.xml',
1918
'report/account_vat_ledger_report.xml',
19+
'views/account_vat_report_views.xml',
2020
'wizards/res_config_settings_views.xml',
2121
'security/security.xml',
2222
'security/ir.model.access.csv',

‎l10n_ar_account_vat_ledger/i18n/es.po

+23-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgid ""
1010
msgstr ""
1111
"Project-Id-Version: Odoo Server 11.0\n"
1212
"Report-Msgid-Bugs-To: \n"
13-
"POT-Creation-Date: 2019-01-18 17:21+0000\n"
13+
"POT-Creation-Date: 2019-04-30 17:56+0000\n"
1414
"PO-Revision-Date: 2018-08-23 20:15+0000\n"
1515
"Last-Translator: Katherine Zaoral <katherine.zaoral@gmail.com>, 2019\n"
1616
"Language-Team: Spanish (https://www.transifex.com/adhoc/teams/46451/es/)\n"
@@ -21,7 +21,7 @@ msgstr ""
2121
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
2222

2323
#. module: l10n_ar_account_vat_ledger
24-
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:161
24+
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:180
2525
#, python-format
2626
msgid "%s VAT Ledger %s - %s"
2727
msgstr "%s Libro de IVA %s - %s"
@@ -48,6 +48,7 @@ msgstr "Libro IVA Contable"
4848

4949
#. module: l10n_ar_account_vat_ledger
5050
#: model:ir.actions.report,name:l10n_ar_account_vat_ledger.report_account_vat_ledger
51+
#: model:ir.actions.report,name:l10n_ar_account_vat_ledger.report_account_vat_ledger_columns
5152
msgid "Account Vat Ledger"
5253
msgstr "Libro IVA Contable"
5354

@@ -102,6 +103,11 @@ msgstr "Importe Moneda IVA Cia"
102103
msgid "Company Cur. VAT Exempt Base Amount"
103104
msgstr "Monto base de excención de IVA de la Compañia en Cuestion"
104105

106+
#. module: l10n_ar_account_vat_ledger
107+
#: model:ir.model.fields,field_description:l10n_ar_account_vat_ledger.field_account_invoice_cc_vat_taxable_amount
108+
msgid "Company Cur. VAT Taxable Amount"
109+
msgstr ""
110+
105111
#. module: l10n_ar_account_vat_ledger
106112
#: model:ir.model.fields,field_description:l10n_ar_account_vat_ledger.field_account_invoice_cc_vat_untaxed_base_amount
107113
msgid "Company Cur. VAT Untaxed"
@@ -157,6 +163,16 @@ msgstr "Primer Página"
157163
msgid "ID"
158164
msgstr "ID"
159165

166+
#. module: l10n_ar_account_vat_ledger
167+
#: model:ir.ui.view,arch_db:l10n_ar_account_vat_ledger.account_vat_ledger_form
168+
msgid "Imprimir en columnas (beta)"
169+
msgstr ""
170+
171+
#. module: l10n_ar_account_vat_ledger
172+
#: model:ir.ui.view,arch_db:l10n_ar_account_vat_ledger.account_vat_ledger_form
173+
msgid "Imprimir libro iva en columnas, beta"
174+
msgstr ""
175+
160176
#. module: l10n_ar_account_vat_ledger
161177
#: model:ir.model,name:l10n_ar_account_vat_ledger.model_account_invoice
162178
msgid "Invoice"
@@ -251,7 +267,7 @@ msgid "Purchase"
251267
msgstr "Compra"
252268

253269
#. module: l10n_ar_account_vat_ledger
254-
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:160
270+
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:179
255271
#, python-format
256272
msgid "Purchases"
257273
msgstr "Compras"
@@ -280,7 +296,7 @@ msgid "Sale"
280296
msgstr "Venta"
281297

282298
#. module: l10n_ar_account_vat_ledger
283-
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:158
299+
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:177
284300
#, python-format
285301
msgid "Sales"
286302
msgstr "Ventas"
@@ -324,13 +340,13 @@ msgid "To Draft"
324340
msgstr "A Borrador"
325341

326342
#. module: l10n_ar_account_vat_ledger
327-
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:185
343+
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:204
328344
#, python-format
329345
msgid "To set \"Presented\" you must set the \"Last Page\" first"
330346
msgstr "Para establecer \"Presentado\" primero debe setear la \"Última Página\""
331347

332348
#. module: l10n_ar_account_vat_ledger
333-
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:181
349+
#: code:addons/l10n_ar_account_vat_ledger/models/account_vat_ledger.py:200
334350
#, python-format
335351
msgid "To set \"Presented\" you must upload the \"Presented Ledger\" first"
336352
msgstr "Para establecer \"Presentado\" primero debe subir el \"Libro Presentado\""
@@ -372,7 +388,7 @@ msgid "VAT Taxes"
372388
msgstr "Impuestos de IVA"
373389

374390
#. module: l10n_ar_account_vat_ledger
375-
#: code:addons/l10n_ar_account_vat_ledger/models/account_invoice.py:103
391+
#: code:addons/l10n_ar_account_vat_ledger/models/account_invoice.py:112
376392
#, python-format
377393
msgid ""
378394
"You can't validate/cancel an invoice of this date if the VAT Ledger Report "

‎l10n_ar_account_vat_ledger/models/account_invoice.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def _get_currency_values(self):
5757
# debito o credito de ese mismo
5858
for rec in self:
5959
currency = rec.currency_id.with_context(
60+
company_id=rec.company_id.id,
6061
date=rec.date_invoice or fields.Date.context_today(rec))
6162
if not currency:
6263
return False
@@ -72,7 +73,9 @@ def _get_currency_values(self):
7273
# rec.currency_rate = 1.0
7374
else:
7475
# nueva modalidad de currency_rate
75-
currency_rate = rec.currency_rate
76+
# el or es por si la factura no esta balidad o no es l10n_ar
77+
currency_rate = rec.currency_rate or currency.compute(
78+
1., rec.company_id.currency_id, round=False)
7679
# TODO borrar
7780
# currency_rate = currency.compute(
7881
# 1.0, rec.company_id.currency_id, round=False)

0 commit comments

Comments
 (0)