Skip to content

Commit

Permalink
[IMP] l10n_es_aeat_sii_oca: send with quarters only for voluntary
Browse files Browse the repository at this point in the history
  • Loading branch information
acysos committed Sep 24, 2024
1 parent d2ae952 commit ed63ad2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion l10n_es_aeat_sii_oca/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def _get_sii_invoice_dict_in(self, cancel=False):
"""Build dict with data to send to AEAT WS for invoice types:
in_invoice and in_refund.
:param cancel: It indicates if the dictionary if for sending a
:param cancel: It indicates if the dictionary if for sending a
cancellation of the invoice.
:return: invoices (dict) : Dict XML with data for this invoice.
Expand All @@ -508,7 +509,7 @@ def _get_sii_invoice_dict_in(self, cancel=False):
invoice_date = self._change_date_format(self.invoice_date)
reg_date = self._change_date_format(self._get_account_registration_date())
ejercicio = fields.Date.to_date(self.date).year
periodo = "%02d" % fields.Date.to_date(self.date).month
periodo = self._get_document_period()
partner = self._sii_get_partner()
desglose_factura, tax_amount, not_in_amount_total = self._get_sii_in_taxes()
inv_dict = {
Expand Down
7 changes: 7 additions & 0 deletions l10n_es_aeat_sii_oca/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ class ResCompany(models.Model):
)
sent_time = fields.Float()
delay_time = fields.Float()
sii_period = fields.Selection(
selection=[
("monthly", "Monthly"),
("quarterly", "Quarterly"),
],
default="monthly",
)

def _get_sii_eta(self):
if self.send_mode == "fixed":
Expand Down
7 changes: 6 additions & 1 deletion l10n_es_aeat_sii_oca/models/sii_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,12 @@ def _get_document_fiscal_year(self):
return fields.Date.to_date(self._get_document_fiscal_date()).year

def _get_document_period(self):
return "%02d" % fields.Date.to_date(self._get_document_fiscal_date()).month
month = fields.Date.to_date(self._get_document_fiscal_date()).month
if self.company_id.sii_period == "monthly":
period = "%02d" % month
else:
period = str(int(((month - 1) / 3) + 1)) + "T"

Check warning on line 433 in l10n_es_aeat_sii_oca/models/sii_mixin.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_aeat_sii_oca/models/sii_mixin.py#L433

Added line #L433 was not covered by tests
return period

def _get_document_serial_number(self):
raise NotImplementedError()
Expand Down
1 change: 1 addition & 0 deletions l10n_es_aeat_sii_oca/views/res_company_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<group name="sii_config">
<field name="sii_test" />
<field name="sii_method" />
<field name="sii_period" />
</group>
<group name="sii_description" string="Description config">
<field name="sii_description_method" />
Expand Down

0 comments on commit ed63ad2

Please sign in to comment.