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 authored and manuelregidor committed Sep 27, 2024
1 parent 1c803e4 commit 192e3ee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion l10n_es_aeat_sii_oca/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def _get_aeat_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._aeat_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 @@ -345,7 +345,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"
return period

def _get_document_product_exempt(self, applied_taxes):
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 192e3ee

Please sign in to comment.