odoo-addon-l10n-es-aeat-sii-oca 16.0.1.8.5__py3-none-any.whl → 16.0.2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/l10n_es_aeat_sii_oca/README.rst +1 -1
- odoo/addons/l10n_es_aeat_sii_oca/__manifest__.py +1 -1
- odoo/addons/l10n_es_aeat_sii_oca/i18n/bg.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/ca.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/cs.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/de.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/es.po +8 -11
- odoo/addons/l10n_es_aeat_sii_oca/i18n/es_CO.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/es_CR.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/eu.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/fr.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/gl.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/hr.po +2 -11
- odoo/addons/l10n_es_aeat_sii_oca/i18n/l10n_es_aeat_sii_oca.pot +42 -111
- odoo/addons/l10n_es_aeat_sii_oca/i18n/nl.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/pl.po +3 -12
- odoo/addons/l10n_es_aeat_sii_oca/i18n/pt.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/pt_BR.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/ru.po +3 -12
- odoo/addons/l10n_es_aeat_sii_oca/i18n/sl.po +2 -11
- odoo/addons/l10n_es_aeat_sii_oca/i18n/sv.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/tr.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/i18n/vi.po +0 -9
- odoo/addons/l10n_es_aeat_sii_oca/models/account_fiscal_position.py +0 -6
- odoo/addons/l10n_es_aeat_sii_oca/models/account_move.py +61 -60
- odoo/addons/l10n_es_aeat_sii_oca/models/res_company.py +1 -1
- odoo/addons/l10n_es_aeat_sii_oca/models/res_partner.py +8 -8
- odoo/addons/l10n_es_aeat_sii_oca/models/sii_mixin.py +72 -168
- odoo/addons/l10n_es_aeat_sii_oca/static/description/index.html +1 -1
- odoo/addons/l10n_es_aeat_sii_oca/tests/test_l10n_es_aeat_sii.py +14 -14
- odoo/addons/l10n_es_aeat_sii_oca/views/account_fiscal_position_view.xml +6 -6
- odoo/addons/l10n_es_aeat_sii_oca/views/account_move_views.xml +19 -19
- odoo/addons/l10n_es_aeat_sii_oca/views/res_partner_views.xml +2 -6
- {odoo_addon_l10n_es_aeat_sii_oca-16.0.1.8.5.dist-info → odoo_addon_l10n_es_aeat_sii_oca-16.0.2.0.0.dist-info}/METADATA +2 -2
- {odoo_addon_l10n_es_aeat_sii_oca-16.0.1.8.5.dist-info → odoo_addon_l10n_es_aeat_sii_oca-16.0.2.0.0.dist-info}/RECORD +37 -37
- {odoo_addon_l10n_es_aeat_sii_oca-16.0.1.8.5.dist-info → odoo_addon_l10n_es_aeat_sii_oca-16.0.2.0.0.dist-info}/WHEEL +0 -0
- {odoo_addon_l10n_es_aeat_sii_oca-16.0.1.8.5.dist-info → odoo_addon_l10n_es_aeat_sii_oca-16.0.2.0.0.dist-info}/top_level.txt +0 -0
@@ -1104,15 +1104,6 @@ msgid ""
|
|
1104
1104
|
"because there is a job running!"
|
1105
1105
|
msgstr ""
|
1106
1106
|
|
1107
|
-
#. module: l10n_es_aeat_sii_oca
|
1108
|
-
#. odoo-python
|
1109
|
-
#: code:addons/l10n_es_aeat_sii_oca/models/sii_mixin.py:0
|
1110
|
-
#, python-format
|
1111
|
-
msgid ""
|
1112
|
-
"You can not communicate this document at this moment because there is a job "
|
1113
|
-
"running!"
|
1114
|
-
msgstr ""
|
1115
|
-
|
1116
1107
|
#. module: l10n_es_aeat_sii_oca
|
1117
1108
|
#. odoo-python
|
1118
1109
|
#: code:addons/l10n_es_aeat_sii_oca/models/account_move.py:0
|
@@ -1104,15 +1104,6 @@ msgid ""
|
|
1104
1104
|
"because there is a job running!"
|
1105
1105
|
msgstr ""
|
1106
1106
|
|
1107
|
-
#. module: l10n_es_aeat_sii_oca
|
1108
|
-
#. odoo-python
|
1109
|
-
#: code:addons/l10n_es_aeat_sii_oca/models/sii_mixin.py:0
|
1110
|
-
#, python-format
|
1111
|
-
msgid ""
|
1112
|
-
"You can not communicate this document at this moment because there is a job "
|
1113
|
-
"running!"
|
1114
|
-
msgstr ""
|
1115
|
-
|
1116
1107
|
#. module: l10n_es_aeat_sii_oca
|
1117
1108
|
#. odoo-python
|
1118
1109
|
#: code:addons/l10n_es_aeat_sii_oca/models/account_move.py:0
|
@@ -32,12 +32,6 @@ class AccountFiscalPosition(models.Model):
|
|
32
32
|
"Default SII Registration Key for Purchases",
|
33
33
|
domain=[("type", "=", "purchase")],
|
34
34
|
)
|
35
|
-
sii_active = fields.Boolean(
|
36
|
-
string="SII Active",
|
37
|
-
copy=False,
|
38
|
-
default=True,
|
39
|
-
help="Enable SII for this fiscal position?",
|
40
|
-
)
|
41
35
|
sii_no_taxable_cause = fields.Selection(
|
42
36
|
selection=[
|
43
37
|
(
|
@@ -123,7 +123,7 @@ class AccountMove(models.Model):
|
|
123
123
|
def _compute_macrodata(self):
|
124
124
|
return super()._compute_macrodata()
|
125
125
|
|
126
|
-
def
|
126
|
+
def _aeat_get_partner(self):
|
127
127
|
return self.commercial_partner_id
|
128
128
|
|
129
129
|
def _raise_exception_sii(self, field_name):
|
@@ -141,7 +141,7 @@ class AccountMove(models.Model):
|
|
141
141
|
VAT/ID Otro and the supplier invoice number. Cannot let change these
|
142
142
|
values in a SII registered supplier invoice"""
|
143
143
|
for invoice in self.filtered(
|
144
|
-
lambda x: x.is_invoice() and x.
|
144
|
+
lambda x: x.is_invoice() and x.aeat_state != "not_sent"
|
145
145
|
):
|
146
146
|
if "invoice_date" in vals:
|
147
147
|
self._raise_exception_sii(_("invoice date"))
|
@@ -149,7 +149,7 @@ class AccountMove(models.Model):
|
|
149
149
|
self._raise_exception_sii(_("third-party number"))
|
150
150
|
if invoice.move_type in ["in_invoice", "in_refund"]:
|
151
151
|
if "partner_id" in vals:
|
152
|
-
correct_partners = invoice.
|
152
|
+
correct_partners = invoice._aeat_get_partner()
|
153
153
|
correct_partners |= correct_partners.child_ids
|
154
154
|
if vals["partner_id"] not in correct_partners.ids:
|
155
155
|
self._raise_exception_sii(_("supplier"))
|
@@ -173,7 +173,7 @@ class AccountMove(models.Model):
|
|
173
173
|
:return: REQ tax (or empty recordset) linked to the provided tax.
|
174
174
|
"""
|
175
175
|
self.ensure_one()
|
176
|
-
taxes_req = self.
|
176
|
+
taxes_req = self._get_aeat_taxes_map(["RE"], self._get_document_fiscal_date())
|
177
177
|
re_lines = self.line_ids.filtered(
|
178
178
|
lambda x: tax in x.tax_ids and x.tax_ids & taxes_req
|
179
179
|
)
|
@@ -223,19 +223,19 @@ class AccountMove(models.Model):
|
|
223
223
|
"""
|
224
224
|
self.ensure_one()
|
225
225
|
taxes_dict = {}
|
226
|
-
taxes_sfesb = self.
|
227
|
-
taxes_sfesbe = self.
|
228
|
-
taxes_sfesisp = self.
|
226
|
+
taxes_sfesb = self._get_aeat_taxes_map(["SFESB"], self.date)
|
227
|
+
taxes_sfesbe = self._get_aeat_taxes_map(["SFESBE"], self.date)
|
228
|
+
taxes_sfesisp = self._get_aeat_taxes_map(["SFESISP"], self.date)
|
229
229
|
# taxes_sfesisps = self._get_taxes_map(['SFESISPS'])
|
230
|
-
taxes_sfens = self.
|
231
|
-
taxes_sfess = self.
|
232
|
-
taxes_sfesse = self.
|
233
|
-
taxes_sfesns = self.
|
234
|
-
taxes_not_in_total = self.
|
235
|
-
taxes_not_in_total_neg = self.
|
230
|
+
taxes_sfens = self._get_aeat_taxes_map(["SFENS"], self.date)
|
231
|
+
taxes_sfess = self._get_aeat_taxes_map(["SFESS"], self.date)
|
232
|
+
taxes_sfesse = self._get_aeat_taxes_map(["SFESSE"], self.date)
|
233
|
+
taxes_sfesns = self._get_aeat_taxes_map(["SFESNS"], self.date)
|
234
|
+
taxes_not_in_total = self._get_aeat_taxes_map(["NotIncludedInTotal"], self.date)
|
235
|
+
taxes_not_in_total_neg = self._get_aeat_taxes_map(
|
236
236
|
["NotIncludedInTotalNegative"], self.date
|
237
237
|
)
|
238
|
-
base_not_in_total = self.
|
238
|
+
base_not_in_total = self._get_aeat_taxes_map(
|
239
239
|
["BaseNotIncludedInTotal"], self.date
|
240
240
|
)
|
241
241
|
not_in_amount_total = 0
|
@@ -356,17 +356,17 @@ class AccountMove(models.Model):
|
|
356
356
|
"""
|
357
357
|
self.ensure_one()
|
358
358
|
taxes_dict = {}
|
359
|
-
taxes_sfrs = self.
|
360
|
-
taxes_sfrsa = self.
|
361
|
-
taxes_sfrisp = self.
|
362
|
-
taxes_sfrns = self.
|
363
|
-
taxes_sfrnd = self.
|
364
|
-
taxes_sfrbi = self.
|
365
|
-
taxes_not_in_total = self.
|
366
|
-
taxes_not_in_total_neg = self.
|
359
|
+
taxes_sfrs = self._get_aeat_taxes_map(["SFRS"], self.date)
|
360
|
+
taxes_sfrsa = self._get_aeat_taxes_map(["SFRSA"], self.date)
|
361
|
+
taxes_sfrisp = self._get_aeat_taxes_map(["SFRISP"], self.date)
|
362
|
+
taxes_sfrns = self._get_aeat_taxes_map(["SFRNS"], self.date)
|
363
|
+
taxes_sfrnd = self._get_aeat_taxes_map(["SFRND"], self.date)
|
364
|
+
taxes_sfrbi = self._get_aeat_taxes_map(["SFRBI"], self.date)
|
365
|
+
taxes_not_in_total = self._get_aeat_taxes_map(["NotIncludedInTotal"], self.date)
|
366
|
+
taxes_not_in_total_neg = self._get_aeat_taxes_map(
|
367
367
|
["NotIncludedInTotalNegative"], self.date
|
368
368
|
)
|
369
|
-
base_not_in_total = self.
|
369
|
+
base_not_in_total = self._get_aeat_taxes_map(
|
370
370
|
["BaseNotIncludedInTotal"], self.date
|
371
371
|
)
|
372
372
|
tax_amount = 0.0
|
@@ -415,9 +415,9 @@ class AccountMove(models.Model):
|
|
415
415
|
def _get_mapping_key(self):
|
416
416
|
return self.move_type
|
417
417
|
|
418
|
-
def
|
419
|
-
res = super().
|
420
|
-
is_simplified_invoice = self.
|
418
|
+
def _aeat_check_exceptions(self):
|
419
|
+
res = super()._aeat_check_exceptions()
|
420
|
+
is_simplified_invoice = self._is_aeat_simplified_invoice()
|
421
421
|
if is_simplified_invoice and self.move_type[:2] == "in":
|
422
422
|
raise exceptions.UserError(
|
423
423
|
_("You can't make a supplier simplified invoice.")
|
@@ -433,7 +433,7 @@ class AccountMove(models.Model):
|
|
433
433
|
if self.move_type in ["in_invoice", "in_refund"]:
|
434
434
|
invoice_type = "R4" if self.move_type == "in_refund" else "F1"
|
435
435
|
elif self.move_type in ["out_invoice", "out_refund"]:
|
436
|
-
is_simplified = self.
|
436
|
+
is_simplified = self._is_aeat_simplified_invoice()
|
437
437
|
invoice_type = "F2" if is_simplified else "F1"
|
438
438
|
if self.move_type == "out_refund":
|
439
439
|
if self.sii_refund_specific_invoice_type:
|
@@ -442,8 +442,8 @@ class AccountMove(models.Model):
|
|
442
442
|
invoice_type = "R5" if is_simplified else "R1"
|
443
443
|
return invoice_type
|
444
444
|
|
445
|
-
def
|
446
|
-
inv_dict = super().
|
445
|
+
def _get_aeat_invoice_dict_out(self, cancel=False):
|
446
|
+
inv_dict = super()._get_aeat_invoice_dict_out(cancel=cancel)
|
447
447
|
if cancel:
|
448
448
|
return inv_dict
|
449
449
|
if self.thirdparty_invoice:
|
@@ -496,7 +496,7 @@ class AccountMove(models.Model):
|
|
496
496
|
serial_number = self.thirdparty_number[0:60]
|
497
497
|
return serial_number
|
498
498
|
|
499
|
-
def
|
499
|
+
def _get_aeat_invoice_dict_in(self, cancel=False):
|
500
500
|
"""Build dict with data to send to AEAT WS for invoice types:
|
501
501
|
in_invoice and in_refund.
|
502
502
|
|
@@ -509,7 +509,7 @@ class AccountMove(models.Model):
|
|
509
509
|
reg_date = self._change_date_format(self._get_account_registration_date())
|
510
510
|
ejercicio = fields.Date.to_date(self.date).year
|
511
511
|
periodo = "%02d" % fields.Date.to_date(self.date).month
|
512
|
-
partner = self.
|
512
|
+
partner = self._aeat_get_partner()
|
513
513
|
desglose_factura, tax_amount, not_in_amount_total = self._get_sii_in_taxes()
|
514
514
|
inv_dict = {
|
515
515
|
"IDFactura": {
|
@@ -574,34 +574,34 @@ class AccountMove(models.Model):
|
|
574
574
|
|
575
575
|
def _get_cancel_sii_invoice_dict(self):
|
576
576
|
self.ensure_one()
|
577
|
-
self.
|
577
|
+
self._aeat_check_exceptions()
|
578
578
|
if self.move_type in ["out_invoice", "out_refund"]:
|
579
|
-
return self.
|
579
|
+
return self._get_aeat_invoice_dict_out(cancel=True)
|
580
580
|
elif self.move_type in ["in_invoice", "in_refund"]:
|
581
|
-
return self.
|
581
|
+
return self._get_aeat_invoice_dict_in(cancel=True)
|
582
582
|
return {}
|
583
583
|
|
584
584
|
def _sii_invoice_dict_not_modified(self):
|
585
585
|
self.ensure_one()
|
586
|
-
to_send = self.
|
587
|
-
content_sent = json.loads(self.
|
586
|
+
to_send = self._get_aeat_invoice_dict()
|
587
|
+
content_sent = json.loads(self.aeat_content_sent)
|
588
588
|
return to_send == content_sent
|
589
589
|
|
590
590
|
def _post(self, soft=True):
|
591
591
|
res = super()._post(soft=soft)
|
592
592
|
for invoice in self.filtered(lambda x: x.sii_enabled and x.is_invoice()):
|
593
|
-
invoice.
|
593
|
+
invoice._aeat_check_exceptions()
|
594
594
|
if (
|
595
|
-
invoice.
|
595
|
+
invoice.aeat_state in ["sent_modified", "sent"]
|
596
596
|
and invoice._sii_invoice_dict_not_modified()
|
597
597
|
):
|
598
|
-
if invoice.
|
599
|
-
invoice.
|
598
|
+
if invoice.aeat_state == "sent_modified":
|
599
|
+
invoice.aeat_state = "sent"
|
600
600
|
continue
|
601
|
-
if invoice.
|
602
|
-
invoice.
|
603
|
-
elif invoice.
|
604
|
-
invoice.
|
601
|
+
if invoice.aeat_state == "sent":
|
602
|
+
invoice.aeat_state = "sent_modified"
|
603
|
+
elif invoice.aeat_state == "cancelled":
|
604
|
+
invoice.aeat_state = "cancelled_modified"
|
605
605
|
company = invoice.company_id
|
606
606
|
if company.sii_method != "auto":
|
607
607
|
continue
|
@@ -627,11 +627,11 @@ class AccountMove(models.Model):
|
|
627
627
|
|
628
628
|
def _cancel_invoice_to_sii(self):
|
629
629
|
for invoice in self.filtered(lambda i: i.state in ["cancel"]):
|
630
|
-
serv = invoice.
|
631
|
-
header = invoice.
|
630
|
+
serv = invoice._connect_aeat(invoice.move_type)
|
631
|
+
header = invoice._get_aeat_header(cancellation=True)
|
632
632
|
inv_vals = {
|
633
|
-
"
|
634
|
-
"
|
633
|
+
"aeat_send_failed": True,
|
634
|
+
"aeat_send_error": False,
|
635
635
|
}
|
636
636
|
try:
|
637
637
|
inv_dict = invoice._get_cancel_sii_invoice_dict()
|
@@ -648,14 +648,14 @@ class AccountMove(models.Model):
|
|
648
648
|
if res["EstadoEnvio"] == "Correcto":
|
649
649
|
inv_vals.update(
|
650
650
|
{
|
651
|
-
"
|
651
|
+
"aeat_state": "cancelled",
|
652
652
|
"sii_csv": res["CSV"],
|
653
|
-
"
|
653
|
+
"aeat_send_failed": False,
|
654
654
|
}
|
655
655
|
)
|
656
656
|
res_line = res["RespuestaLinea"][0]
|
657
657
|
if res_line["CodigoErrorRegistro"]:
|
658
|
-
inv_vals["
|
658
|
+
inv_vals["aeat_send_error"] = "{} | {}".format(
|
659
659
|
str(res_line["CodigoErrorRegistro"]),
|
660
660
|
str(res_line["DescripcionErrorRegistro"])[:60],
|
661
661
|
)
|
@@ -666,8 +666,8 @@ class AccountMove(models.Model):
|
|
666
666
|
invoice = env["account.move"].browse(invoice.id)
|
667
667
|
inv_vals.update(
|
668
668
|
{
|
669
|
-
"
|
670
|
-
"
|
669
|
+
"aeat_send_failed": True,
|
670
|
+
"aeat_send_error": repr(fault)[:60],
|
671
671
|
"sii_return": repr(fault),
|
672
672
|
}
|
673
673
|
)
|
@@ -681,7 +681,7 @@ class AccountMove(models.Model):
|
|
681
681
|
lambda i: (
|
682
682
|
i.sii_enabled
|
683
683
|
and i.state in ["cancel"]
|
684
|
-
and i.
|
684
|
+
and i.aeat_state in ["sent", "sent_w_errors", "sent_modified"]
|
685
685
|
)
|
686
686
|
)
|
687
687
|
if not invoices._cancel_sii_jobs():
|
@@ -714,12 +714,12 @@ class AccountMove(models.Model):
|
|
714
714
|
)
|
715
715
|
res = super().button_cancel()
|
716
716
|
for invoice in self.filtered(lambda x: x.sii_enabled):
|
717
|
-
if invoice.
|
718
|
-
invoice.
|
719
|
-
elif invoice.
|
717
|
+
if invoice.aeat_state == "sent":
|
718
|
+
invoice.aeat_state = "sent_modified"
|
719
|
+
elif invoice.aeat_state == "cancelled_modified":
|
720
720
|
# Case when repoen a cancelled invoice, validate and cancel
|
721
721
|
# again without any SII communication.
|
722
|
-
invoice.
|
722
|
+
invoice.aeat_state = "cancelled"
|
723
723
|
return res
|
724
724
|
|
725
725
|
def button_draft(self):
|
@@ -791,14 +791,15 @@ class AccountMove(models.Model):
|
|
791
791
|
"company_id.sii_enabled",
|
792
792
|
"move_type",
|
793
793
|
"fiscal_position_id",
|
794
|
-
"fiscal_position_id.
|
794
|
+
"fiscal_position_id.aeat_active",
|
795
795
|
)
|
796
796
|
def _compute_sii_enabled(self):
|
797
797
|
"""Compute if the invoice is enabled for the SII"""
|
798
798
|
for invoice in self:
|
799
799
|
if invoice.company_id.sii_enabled and invoice.is_invoice():
|
800
800
|
invoice.sii_enabled = (
|
801
|
-
invoice.fiscal_position_id
|
801
|
+
invoice.fiscal_position_id
|
802
|
+
and invoice.fiscal_position_id.aeat_active
|
802
803
|
) or not invoice.fiscal_position_id
|
803
804
|
else:
|
804
805
|
invoice.sii_enabled = False
|
@@ -15,7 +15,7 @@ class ResCompany(models.Model):
|
|
15
15
|
_inherit = "res.company"
|
16
16
|
|
17
17
|
sii_enabled = fields.Boolean(string="Enable SII")
|
18
|
-
sii_test = fields.Boolean(string="Is
|
18
|
+
sii_test = fields.Boolean(string="Is it the SII test environment?")
|
19
19
|
sii_description_method = fields.Selection(
|
20
20
|
string="SII Description Method",
|
21
21
|
selection=[("auto", "Automatic"), ("fixed", "Fixed"), ("manual", "Manual")],
|
@@ -8,18 +8,18 @@ class ResPartner(models.Model):
|
|
8
8
|
_inherit = "res.partner"
|
9
9
|
|
10
10
|
sii_enabled = fields.Boolean(
|
11
|
-
compute="
|
12
|
-
)
|
13
|
-
sii_simplified_invoice = fields.Boolean(
|
14
|
-
string="Simplified invoices in SII?",
|
15
|
-
help="Checking this mark, invoices done to this partner will be "
|
16
|
-
"sent to SII as simplified invoices.",
|
11
|
+
compute="_compute_aeat_sending_enabled",
|
17
12
|
)
|
18
13
|
|
19
14
|
@api.depends("company_id")
|
20
|
-
def
|
15
|
+
def _compute_aeat_sending_enabled(self):
|
16
|
+
res = super()._compute_aeat_sending_enabled()
|
21
17
|
sii_enabled = any(self.env.companies.mapped("sii_enabled"))
|
22
18
|
for partner in self:
|
23
|
-
|
19
|
+
sii_enabled = (
|
24
20
|
partner.company_id.sii_enabled if partner.company_id else sii_enabled
|
25
21
|
)
|
22
|
+
partner.sii_enabled = sii_enabled
|
23
|
+
if sii_enabled:
|
24
|
+
partner.aeat_sending_enabled = True
|
25
|
+
return res
|