[FIX] l10n_ar: add afip responsability for demo partner

Part of task 2124952

Populate fields that are required and added in dependencies of l10n_ar.

Remove an unused variable too as an act of kindness.
This commit is contained in:
wan
2021-02-17 08:39:29 +00:00
parent 7841777afa
commit 00ed98db4d
4 changed files with 46 additions and 1 deletions
+1
View File
@@ -2,3 +2,4 @@
from . import models
from . import report
from . import demo
+3
View File
@@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_demo
+42
View File
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
import logging
from odoo import api, models
_logger = logging.getLogger(__name__)
class AccountChartTemplate(models.Model):
_inherit = "account.chart.template"
@api.model
def _get_demo_data(self):
ref = self.env.ref
# Do not load generic demo data on these companies
ar_demo_companies = (
ref('l10n_ar.company_mono', raise_if_not_found=False),
ref('l10n_ar.company_exento', raise_if_not_found=False),
ref('l10n_ar.company_ri', raise_if_not_found=False),
)
if self.env.company in ar_demo_companies:
return []
yield ('res.partner', {
'base.res_partner_12': {
'l10n_ar_afip_responsibility_type_id': ref('l10n_ar.res_IVARI').id,
},
'base.res_partner_2': {
'l10n_ar_afip_responsibility_type_id': ref('l10n_ar.res_IVARI').id,
},
})
for model, data in super()._get_demo_data():
yield model, data
@api.model
def _get_demo_data_move(self):
cid = self.env.company.id
model, data = super()._get_demo_data_move()
data[f'{cid}_demo_invoice_5']['l10n_latam_document_number'] = '1-1'
data[f'{cid}_demo_invoice_equipment_purchase']['l10n_latam_document_number'] = '1-2'
return model, data
-1
View File
@@ -62,7 +62,6 @@ class AccountMove(models.Model):
product_types = set([x.product_id.type for x in invoice_lines if x.product_id])
consumable = set(['consu', 'product'])
service = set(['service'])
mixed = set(['consu', 'service', 'product'])
# on expo invoice you can mix services and products
expo_invoice = self.l10n_latam_document_type_id.code in ['19', '20', '21']