Cherry pick of 2b65a7c111232d31d5113565bb6a114486f0123c failed

stdout:

stderr:

closes odoo/odoo#58605

Error: could not apply 2b65a7c1112... [IMP] l10n_ar: Accounting Tour adaptation
Hint: after resolving the conflicts, mark the corrected paths
Hint: with 'git add <paths>' or 'git rm <paths>'
Hint: and commit the result with 'git commit'
Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
fw-bot
2020-09-29 13:46:59 +00:00
committed by Josse Colpaert
parent e01269b5b7
commit 1c77b833d6
9 changed files with 33 additions and 54 deletions
+1
View File
@@ -101,6 +101,7 @@ Master Data:
'views/l10n_latam_document_type_view.xml',
'views/report_invoice.xml',
'report/invoice_report_view.xml',
'data/account_chart_template_configure_data.xml',
],
'demo': [
# we create demo data on different companies (not main_company) to
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<function model="account.chart.template" name="try_loading">
<value eval="[ref('l10n_ar.l10nar_ri_chart_template')]"/>
</function>
</data>
</odoo>
-12
View File
@@ -37,18 +37,6 @@
<data noupdate="1">
<record id="sale_journal_exento" model="account.journal">
<field name='name'>Sales Journal</field>
<field name='company_id' ref="l10n_ar.company_exento"/>
<field name='type'>sale</field>
<field name='code'>S0001</field>
<field name='l10n_latam_use_documents' eval="True"/>
<field name='l10n_ar_afip_pos_number'>1</field>
<field name='l10n_ar_afip_pos_partner_id' ref="l10n_ar.partner_exento"/>
<field name='l10n_ar_afip_pos_system'>II_IM</field>
<field name='l10n_ar_share_sequences' eval="True"/>
</record>
<record id="sale_expo_journal_exento" model="account.journal">
<field name='name'>Expo Sales Journal</field>
<field name='company_id' ref="l10n_ar.company_exento"/>
-12
View File
@@ -37,18 +37,6 @@
<data noupdate="1">
<record id="sale_journal_mono" model="account.journal">
<field name='name'>Sales Journal</field>
<field name='company_id' ref="l10n_ar.company_mono"/>
<field name='type'>sale</field>
<field name='code'>S0001</field>
<field name='l10n_latam_use_documents' eval="True"/>
<field name='l10n_ar_afip_pos_number'>1</field>
<field name='l10n_ar_afip_pos_partner_id' ref="l10n_ar.partner_mono"/>
<field name='l10n_ar_afip_pos_system'>II_IM</field>
<field name='l10n_ar_share_sequences' eval="True"/>
</record>
<record id="sale_expo_journal_mono" model="account.journal">
<field name='name'>Expo Sales Journal</field>
<field name='company_id' ref="l10n_ar.company_mono"/>
-13
View File
@@ -45,19 +45,6 @@
<data noupdate="1">
<record id="sale_journal_ri" model="account.journal">
<field name='name'>Sales Journal</field>
<field name='company_id' ref="l10n_ar.company_ri"/>
<field name='type'>sale</field>
<field name='code'>S0001</field>
<field name='l10n_latam_use_documents' eval="True"/>
<field name='l10n_ar_afip_pos_number'>1</field>
<field name='l10n_ar_afip_pos_partner_id' ref="l10n_ar.partner_ri"/>
<field name='l10n_ar_afip_pos_system'>II_IM</field>
<field name='l10n_ar_share_sequences' eval="True"/>
<field name='refund_sequence' eval="False"/>
</record>
<record id="sale_expo_journal_ri" model="account.journal">
<field name='name'>Expo Sales Journal</field>
<field name='company_id' ref="l10n_ar.company_ri"/>
@@ -17,13 +17,20 @@ class AccountChartTemplate(models.Model):
return res
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
""" If Argentinean chart, we don't create sales journal as we need more
data to create it properly """
""" In case of an Argentinean CoA, we modify the default values of the sales journal to be a preprinted journal"""
res = super()._prepare_all_journals(acc_template_ref, company, journals_dict=journals_dict)
if company.country_id == self.env.ref('base.ar'):
for vals in res:
if vals['type'] == 'sale':
res.remove(vals)
vals.update({
"name": "Ventas Preimpreso",
"code": "0001",
"l10n_ar_afip_pos_number": 1,
"l10n_ar_afip_pos_partner_id": company.partner_id.id,
"l10n_ar_afip_pos_system": 'II_IM',
"l10n_ar_share_sequences": True,
"refund_sequence": False
})
return res
@api.model
@@ -48,10 +55,6 @@ class AccountChartTemplate(models.Model):
coa_responsibility = self._get_ar_responsibility_match(self.id)
if coa_responsibility:
company_responsibility = company.l10n_ar_afip_responsibility_type_id
if company_responsibility and company_responsibility != coa_responsibility:
raise UserError(_(
'You are trying to install a chart of account for the %s responsibility but your company is'
' configured as %s type', coa_responsibility.name, company_responsibility.name))
company.write({
'l10n_ar_afip_responsibility_type_id': coa_responsibility.id,
'country_id': self.env.ref('base.ar').id,
+4 -5
View File
@@ -106,13 +106,12 @@ class AccountJournal(models.Model):
@api.constrains('type', 'l10n_ar_afip_pos_system', 'l10n_ar_afip_pos_number', 'l10n_ar_share_sequences',
'l10n_latam_use_documents')
def _check_afip_configurations(self):
""" Do not let to update journal if already have confirmed invoices """
arg_sale_journals = self.filtered(lambda x: x.company_id.country_id == self.env.ref('base.ar') and
x.type == 'sale' and x._origin.type == 'sale')
invoices = self.env['account.move'].search([('journal_id', 'in', arg_sale_journals.ids), ('state', '!=', 'draft')])
""" Do not let the user update the journal if it already contains confirmed invoices """
journals = self.filtered(lambda x: x.company_id.country_id == self.env.ref('base.ar') and x.type in ['sale', 'purchase'])
invoices = self.env['account.move'].search([('journal_id', 'in', journals.ids), ('posted_before', '=', True)], limit=1)
if invoices:
raise ValidationError(
_("You can not change the journal's configuration if journal already have validated invoices") + ' ('
_("You can not change the journal's configuration if it already has validated invoices") + ' ('
+ ', '.join(invoices.mapped('journal_id').mapped('name')) + ')')
@api.constrains('l10n_ar_afip_pos_number')
+9 -4
View File
@@ -177,8 +177,6 @@ class AccountMove(models.Model):
def _inverse_l10n_latam_document_number(self):
super()._inverse_l10n_latam_document_number()
# Avoid that user change the POS number (x.l10n_latam_document_number), Rhe POS number configure in journal it
# will always be used
to_review = self.filtered(
lambda x: x.journal_id.type == 'sale' and x.l10n_latam_document_type_id and x.l10n_latam_document_number and
(x.l10n_latam_manual_document_number or not x.highest_name))
@@ -186,8 +184,15 @@ class AccountMove(models.Model):
number = rec.l10n_latam_document_type_id._format_document_number(rec.l10n_latam_document_number)
current_pos = int(number.split("-")[0])
if current_pos != rec.journal_id.l10n_ar_afip_pos_number:
raise UserError(_('Can not change the POS number, you can only change the first number for document'
' type that you are creating in odoo'))
invoices = self.search([('journal_id', '=', rec.journal_id.id), ('posted_before', '=', True)], limit=1)
# If there is no posted before invoices the user can change the POS number (x.l10n_latam_document_number)
if (not invoices):
rec.journal_id.l10n_ar_afip_pos_number = current_pos
rec.journal_id._onchange_set_short_name()
# If not, avoid that the user change the POS number
else:
raise UserError(_('The document number can not be changed for this journal, you can only modify'
' the POS number if there is not posted (or posted before) invoices'))
def _get_formatted_sequence(self, number=0):
return "%s %05d-%08d" % (self.l10n_latam_document_type_id.doc_code_prefix,
@@ -26,7 +26,7 @@ class AccountJournal(models.Model):
@api.constrains('l10n_latam_use_documents')
def check_use_document(self):
for rec in self:
if rec.env['account.move'].search([('journal_id', '=', rec.id), ('state', '!=', 'draft')], limit=1):
if rec.env['account.move'].search([('journal_id', '=', rec.id), ('posted_before', '=', True)], limit=1):
raise ValidationError(_(
'You can not modify the field "Use Documents?" if there are validated invoices in this journal!'))