diff --git a/l10n_it_vat_registries/models/account_tax_registry.py b/l10n_it_vat_registries/models/account_tax_registry.py index 8c13c5896f45..bf861b307e47 100644 --- a/l10n_it_vat_registries/models/account_tax_registry.py +++ b/l10n_it_vat_registries/models/account_tax_registry.py @@ -13,6 +13,13 @@ class AccountTaxRegistry(models.Model): required=True, default=lambda self: self.env.company, ) + entry_order = fields.Selection( + [ + ("date_name", "Date - Number"), + ("journal_date_name", "Journal - Date - Number"), + ], + default="date_name", + ) journal_ids = fields.One2many( "account.journal", "tax_registry_id", "Journals", readonly=True ) diff --git a/l10n_it_vat_registries/models/vat_registry.py b/l10n_it_vat_registries/models/vat_registry.py index d543009c77cf..3bdb3f9a7eda 100644 --- a/l10n_it_vat_registries/models/vat_registry.py +++ b/l10n_it_vat_registries/models/vat_registry.py @@ -36,6 +36,7 @@ def _get_report_values(self, docids, data=None): "compute_totals_tax": self._compute_totals_tax, "l10n_it_count_fiscal_page_base": data["form"]["fiscal_page_base"], "only_totals": data["form"]["only_totals"], + "entry_order": data["form"].get("entry_order"), "date_format": date_format, "year_footer": data["form"]["year_footer"], } diff --git a/l10n_it_vat_registries/report/report_registro_iva.xml b/l10n_it_vat_registries/report/report_registro_iva.xml index 771e502c9ab3..f4934dc24cde 100644 --- a/l10n_it_vat_registries/report/report_registro_iva.xml +++ b/l10n_it_vat_registries/report/report_registro_iva.xml @@ -82,6 +82,19 @@ t-value="total_used_taxes | used_taxes" /> + + + + +
+ + + + + + diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index 9f8798af631d..15a3c2395d55 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -22,6 +22,13 @@ class WizardRegistroIva(models.TransientModel): default="customer", ) tax_registry_id = fields.Many2one("account.tax.registry", "VAT registry") + entry_order = fields.Selection( + [ + ("date_name", "Date - Number"), + ("journal_date_name", "Journal - Date - Number"), + ], + default="date_name", + ) journal_ids = fields.Many2many( "account.journal", "registro_iva_journals_rel", @@ -41,6 +48,7 @@ class WizardRegistroIva(models.TransientModel): def on_change_tax_registry_id(self): self.journal_ids = self.tax_registry_id.journal_ids self.layout_type = self.tax_registry_id.layout_type + self.entry_order = self.tax_registry_id.entry_order @api.onchange("date_range_id") def on_change_date_range_id(self): @@ -54,6 +62,11 @@ def get_year_footer(self): self.year_footer = self.from_date.year def _get_move_ids(self, wizard): + MAPPING = { + "journal_date_name": "journal_id, date, name", + "date_name": "date, name", + } + order = MAPPING[wizard.entry_order] moves = self.env["account.move"].search( [ ("date", ">=", self.from_date), @@ -61,7 +74,7 @@ def _get_move_ids(self, wizard): ("journal_id", "in", [j.id for j in self.journal_ids]), ("state", "=", "posted"), ], - order="date, name", + order=order, ) return moves.ids @@ -96,6 +109,7 @@ def print_registro(self): else: datas_form["tax_registry_name"] = "" datas_form["only_totals"] = wizard.only_totals + datas_form["entry_order"] = wizard.entry_order # report_name = 'l10n_it_vat_registries.report_registro_iva' report_name = "l10n_it_vat_registries.action_report_registro_iva" datas = {"ids": move_ids, "model": "account.move", "form": datas_form} diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.xml b/l10n_it_vat_registries/wizard/print_registro_iva.xml index f5088a923827..b74259bd38fd 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.xml +++ b/l10n_it_vat_registries/wizard/print_registro_iva.xml @@ -23,6 +23,7 @@ +