Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] l10n_it_vat_registries #4376

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions l10n_it_vat_registries/models/account_tax_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -25,3 +32,4 @@ class AccountTaxRegistry(models.Model):
"Layout",
required=True,
)
show_full_contact_addess = fields.Boolean()
2 changes: 2 additions & 0 deletions l10n_it_vat_registries/models/vat_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ 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"),
"show_full_contact_addess": data["form"]["show_full_contact_addess"],
"date_format": date_format,
"year_footer": data["form"]["year_footer"],
}
Expand Down
32 changes: 28 additions & 4 deletions l10n_it_vat_registries/report/report_registro_iva.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@
t-value="total_used_taxes | used_taxes"
/>
<t t-foreach="inv_taxes" t-as="line">
<t t-if="entry_order == 'journal_date_name'">
<t t-if="move.journal_id.id != sv_journal_id">
<tr>
<td colspan='9'>
<h5
style="page-break-inside: avoid;border-top:1px solid;border-bottom:1px solid; color:DimGrey;"
t-esc="move.journal_id.name"
/>
</td>
</tr>
</t>
</t>
<t t-set="sv_journal_id" t-value="move.journal_id.id" />
<t t-if="print_details > 0 ">
<t
t-set="line_class_left"
Expand Down Expand Up @@ -142,14 +155,25 @@
/></td>
</t>
<!-- Ragione sociale -->
<td class="left_without_line_bold"><div
<td class="left_without_line_bold">
<t
t-set="partner"
t-value="move.partner_id"
/>
<div
style="page-break-inside: avoid"
t-esc="move.partner_id.name"
/></td>
t-esc="partner.name"
/>
<div
t-if="show_full_contact_addess"
style="page-break-inside: avoid"
t-esc="partner._display_address(without_company=True)"
/>
</td>
<!-- PIVA -->
<td class="left_without_line_bold"><div
style="page-break-inside: avoid"
t-esc="move.partner_id.vat"
t-esc="partner.vat"
/></td>
</t>
<td class="left_without_line" />
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_vat_registries/views/account_tax_registry_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<group>
<field name="name" />
<field name="layout_type" />
<field name="entry_order" />
<field name="show_full_contact_addess" />
</group>
<separator string="Journals" />
<field name="journal_ids" />
Expand Down
19 changes: 18 additions & 1 deletion l10n_it_vat_registries/wizard/print_registro_iva.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ class WizardRegistroIva(models.TransientModel):
required=True,
default="customer",
)
show_full_contact_addess = fields.Boolean()
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",
Expand All @@ -41,6 +49,8 @@ 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
self.show_full_contact_addess = self.tax_registry_id.show_full_contact_addess

@api.onchange("date_range_id")
def on_change_date_range_id(self):
Expand All @@ -54,14 +64,19 @@ 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),
("date", "<=", self.to_date),
("journal_id", "in", [j.id for j in self.journal_ids]),
("state", "=", "posted"),
],
order="date, name",
order=order,
)
return moves.ids

Expand Down Expand Up @@ -96,6 +111,8 @@ def print_registro(self):
else:
datas_form["tax_registry_name"] = ""
datas_form["only_totals"] = wizard.only_totals
datas_form["entry_order"] = wizard.entry_order
datas_form["show_full_contact_addess"] = wizard.show_full_contact_addess
# 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}
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_vat_registries/wizard/print_registro_iva.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<separator string="Journals" colspan="2" />
<group>
<field name="tax_registry_id" />
<field name="entry_order" />
</group>
<field
name="journal_ids"
Expand All @@ -33,6 +34,7 @@
/>
<group string="Layout">
<field name="layout_type" />
<field name="show_full_contact_addess" />
<field name="only_totals" />
<field name="fiscal_page_base" />
</group>
Expand Down
Loading