From 075152d1a01c19773eb2e954250b828025508bb0 Mon Sep 17 00:00:00 2001 From: Pablo Montenegro Date: Wed, 6 Apr 2022 12:12:59 +0000 Subject: [PATCH] =?UTF-8?q?[FIX]=20l10n=5Far:=20Delete=20=E2=80=9CUnified?= =?UTF-8?q?=20Book=E2=80=9D=20option=20on=20sale=20journals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this change, we bringed to the user the posibility to select the option “Unified Book” (boolean) on journals with type “Sales” and Pre-printed Invoice “AFIP POS System”. This allowed all documents with the same letter document to use the same sequence, and it does not matter if they are invoices, credit notes or debit notes for example. Now that functionality is deleted and all documents will have their own sequence regardless of the letter document of each receipt. closes odoo/odoo#88129 Signed-off-by: Josse Colpaert --- addons/l10n_ar/i18n/es.po | 12 ------------ addons/l10n_ar/i18n/l10n_ar.pot | 12 ------------ addons/l10n_ar/models/account_chart_template.py | 1 - addons/l10n_ar/models/account_journal.py | 10 +--------- addons/l10n_ar/models/account_move.py | 16 ++-------------- addons/l10n_ar/views/account_journal_view.xml | 1 - 6 files changed, 3 insertions(+), 49 deletions(-) diff --git a/addons/l10n_ar/i18n/es.po b/addons/l10n_ar/i18n/es.po index bf484b162c3..d7944cea771 100644 --- a/addons/l10n_ar/i18n/es.po +++ b/addons/l10n_ar/i18n/es.po @@ -1236,12 +1236,6 @@ msgstr "Código AFIP Tributos" msgid "Type of gross income: exempt, local, multilateral" msgstr "Tipo de ingreso bruto: exento, local, multilateral" -#. module: l10n_ar -#: model:ir.model.fields,field_description:l10n_ar.field_account_bank_statement_import_journal_creation__l10n_ar_share_sequences -#: model:ir.model.fields,field_description:l10n_ar.field_account_journal__l10n_ar_share_sequences -msgid "Unified Book" -msgstr "Libro Unificado" - #. module: l10n_ar #: model:product.product,uom_name:l10n_ar.product_product_arancel #: model:product.product,uom_name:l10n_ar.product_product_cero @@ -1278,12 +1272,6 @@ msgstr "Conceptos No gravados" msgid "UpApP" msgstr "" -#. module: l10n_ar -#: model:ir.model.fields,help:l10n_ar.field_account_bank_statement_import_journal_creation__l10n_ar_share_sequences -#: model:ir.model.fields,help:l10n_ar.field_account_journal__l10n_ar_share_sequences -msgid "Use same sequence for documents with the same letter" -msgstr "Usar la misma secuencia para documentos con misma letra" - #. module: l10n_ar #: model:ir.model.fields,field_description:l10n_ar.field_res_partner__l10n_ar_vat #: model:ir.model.fields,field_description:l10n_ar.field_res_users__l10n_ar_vat diff --git a/addons/l10n_ar/i18n/l10n_ar.pot b/addons/l10n_ar/i18n/l10n_ar.pot index 50906cdc9d7..6ea97894df3 100644 --- a/addons/l10n_ar/i18n/l10n_ar.pot +++ b/addons/l10n_ar/i18n/l10n_ar.pot @@ -1184,12 +1184,6 @@ msgstr "" msgid "Type of gross income: exempt, local, multilateral" msgstr "" -#. module: l10n_ar -#: model:ir.model.fields,field_description:l10n_ar.field_account_bank_statement_import_journal_creation__l10n_ar_share_sequences -#: model:ir.model.fields,field_description:l10n_ar.field_account_journal__l10n_ar_share_sequences -msgid "Unified Book" -msgstr "" - #. module: l10n_ar #: model:product.product,uom_name:l10n_ar.product_product_arancel #: model:product.product,uom_name:l10n_ar.product_product_cero @@ -1226,12 +1220,6 @@ msgstr "" msgid "UpApP" msgstr "" -#. module: l10n_ar -#: model:ir.model.fields,help:l10n_ar.field_account_bank_statement_import_journal_creation__l10n_ar_share_sequences -#: model:ir.model.fields,help:l10n_ar.field_account_journal__l10n_ar_share_sequences -msgid "Use same sequence for documents with the same letter" -msgstr "" - #. module: l10n_ar #: model:ir.model.fields,field_description:l10n_ar.field_res_partner__l10n_ar_vat #: model:ir.model.fields,field_description:l10n_ar.field_res_users__l10n_ar_vat diff --git a/addons/l10n_ar/models/account_chart_template.py b/addons/l10n_ar/models/account_chart_template.py index 0e593468c36..2545699bb25 100644 --- a/addons/l10n_ar/models/account_chart_template.py +++ b/addons/l10n_ar/models/account_chart_template.py @@ -28,7 +28,6 @@ class AccountChartTemplate(models.Model): "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 diff --git a/addons/l10n_ar/models/account_journal.py b/addons/l10n_ar/models/account_journal.py index 4f86000b980..aeab340f00f 100644 --- a/addons/l10n_ar/models/account_journal.py +++ b/addons/l10n_ar/models/account_journal.py @@ -17,8 +17,6 @@ class AccountJournal(models.Model): 'res.partner', 'AFIP POS Address', help='This is the address used for invoice reports of this POS', domain="['|', ('id', '=', company_partner), '&', ('id', 'child_of', company_partner), ('type', '!=', 'contact')]" ) - l10n_ar_share_sequences = fields.Boolean( - 'Unified Book', help='Use same sequence for documents with the same letter') def _get_l10n_ar_afip_pos_types_selection(self): """ Return the list of values of the selection field. """ @@ -100,8 +98,7 @@ class AccountJournal(models.Model): elif self.l10n_ar_afip_pos_system in ['FEERCEL', 'FEEWS', 'FEERCELP']: return expo_codes - @api.constrains('type', 'l10n_ar_afip_pos_system', 'l10n_ar_afip_pos_number', 'l10n_ar_share_sequences', - 'l10n_latam_use_documents') + @api.constrains('type', 'l10n_ar_afip_pos_system', 'l10n_ar_afip_pos_number', 'l10n_latam_use_documents') def _check_afip_configurations(self): """ Do not let the user update the journal if it already contains confirmed invoices """ journals = self.filtered(lambda x: x.company_id.account_fiscal_country_id.code == "AR" and x.type in ['sale', 'purchase']) @@ -123,11 +120,6 @@ class AccountJournal(models.Model): if to_review.filtered(lambda x: x.l10n_ar_afip_pos_number > 99999): raise ValidationError(_('Please define a valid AFIP POS number (5 digits max)')) - @api.onchange('l10n_ar_afip_pos_system') - def _onchange_l10n_ar_afip_pos_system(self): - """ On 'Pre-printed Invoice' the usual is to share sequences. On other types, do not share """ - self.l10n_ar_share_sequences = bool(self.l10n_ar_afip_pos_system == 'II_IM') - @api.onchange('l10n_ar_afip_pos_number', 'type') def _onchange_set_short_name(self): """ Will define the AFIP POS Address field domain taking into account the company configured in the journal diff --git a/addons/l10n_ar/models/account_move.py b/addons/l10n_ar/models/account_move.py index 04f51dee83c..ff748f505d3 100644 --- a/addons/l10n_ar/models/account_move.py +++ b/addons/l10n_ar/models/account_move.py @@ -240,24 +240,12 @@ class AccountMove(models.Model): return self._get_formatted_sequence() return super()._get_starting_sequence() - def _get_last_sequence(self, relaxed=False, with_prefix=None): - """ If use share sequences we need to recompute the sequence to add the proper document code prefix """ - res = super()._get_last_sequence(relaxed=relaxed, with_prefix=with_prefix) - if res and self.journal_id.l10n_ar_share_sequences and self.l10n_latam_document_type_id.doc_code_prefix not in res: - res = self._get_formatted_sequence(number=self._l10n_ar_get_document_number_parts( - res.split()[-1], self.l10n_latam_document_type_id.code)['invoice_number']) - return res def _get_last_sequence_domain(self, relaxed=False): where_string, param = super(AccountMove, self)._get_last_sequence_domain(relaxed) if self.company_id.account_fiscal_country_id.code == "AR" and self.l10n_latam_use_documents: - if not self.journal_id.l10n_ar_share_sequences: - where_string += " AND l10n_latam_document_type_id = %(l10n_latam_document_type_id)s" - param['l10n_latam_document_type_id'] = self.l10n_latam_document_type_id.id or 0 - elif self.journal_id.l10n_ar_share_sequences: - where_string += " AND l10n_latam_document_type_id in %(l10n_latam_document_type_ids)s" - param['l10n_latam_document_type_ids'] = tuple(self.l10n_latam_document_type_id.search( - [('l10n_ar_letter', '=', self.l10n_latam_document_type_id.l10n_ar_letter)]).ids) + where_string += " AND l10n_latam_document_type_id = %(l10n_latam_document_type_id)s" + param['l10n_latam_document_type_id'] = self.l10n_latam_document_type_id.id or 0 return where_string, param def _l10n_ar_get_amounts(self, company_currency=False): diff --git a/addons/l10n_ar/views/account_journal_view.xml b/addons/l10n_ar/views/account_journal_view.xml index 3e9c1375af9..665cfa13558 100644 --- a/addons/l10n_ar/views/account_journal_view.xml +++ b/addons/l10n_ar/views/account_journal_view.xml @@ -11,7 +11,6 @@ -