Skip to content

Commit 4ad891a

Browse files
committed
[MIG] l10n_es_pos_sii: Migration to 17.0
1 parent bf3487e commit 4ad891a

File tree

14 files changed

+164
-176
lines changed

14 files changed

+164
-176
lines changed

l10n_es_pos_sii/README.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Envío de pedidos del TPV al SII
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
20-
:target: https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_sii
20+
:target: https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_oca_sii
2121
:alt: OCA/l10n-spain
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_pos_sii
23+
:target: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_pos_oca_sii
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
2626
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=17.0
@@ -39,7 +39,7 @@ Configuration
3939
=============
4040

4141
No se requieren pasos adicionales de configuración, ver configuración de
42-
los módulos l10n_es_pos, l10n_es_aeat_sii_oca y pos_default_partner.
42+
los módulos l10n_es_pos_oca, l10n_es_aeat_sii_oca y pos_default_partner.
4343

4444
Known issues / Roadmap
4545
======================
@@ -62,7 +62,7 @@ Bug Tracker
6262
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/issues>`_.
6363
In case of trouble, please check there if your issue has already been reported.
6464
If you spotted it first, help us to smash it by providing a detailed and welcomed
65-
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_pos_sii%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
65+
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_pos_oca_sii%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6666

6767
Do not contact contributors directly about support or help with technical issues.
6868

@@ -82,6 +82,10 @@ Contributors
8282
- Almudena de la Puente <[email protected]>
8383
- Jose Zambudio <[email protected]>
8484

85+
- `APSL-Nagarro <https://apsl.tech>`__:
86+
87+
- Bernat Obrador <[email protected]>
88+
8589
Maintainers
8690
-----------
8791

@@ -95,6 +99,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9599
mission is to support the collaborative development of Odoo features and
96100
promote its widespread use.
97101

98-
This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_sii>`_ project on GitHub.
102+
This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_oca_sii>`_ project on GitHub.
99103

100104
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_es_pos_sii/__manifest__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@
66
"author": "Aures Tic, Odoo Community Association (OCA)",
77
"website": "https://github.com/OCA/l10n-spain",
88
"license": "AGPL-3",
9-
"version": "16.0.2.1.1",
9+
"version": "17.0.1.0.0",
1010
"depends": [
1111
"point_of_sale",
12-
"l10n_es_pos",
12+
"l10n_es_pos_oca",
1313
"l10n_es_aeat_sii_oca",
14-
"pos_default_partner",
1514
],
1615
"data": [
17-
"data/aeat_sii_queue_job.xml",
16+
"data/ir_cron.xml",
1817
"views/pos_order.xml",
1918
"views/res_company.xml",
2019
],
2120
"assets": {
22-
"point_of_sale.assets": [
21+
"point_of_sale._assets_pos": [
2322
"l10n_es_pos_sii/static/src/js/**/*.js",
2423
],
2524
},

l10n_es_pos_sii/data/aeat_sii_queue_job.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

l10n_es_pos_sii/data/ir_cron.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo noupdate="1">
3+
<record forcecreate="True" id="pos_order_send_to_sii" model="ir.cron">
4+
<field name="name">Send Invoices to SII (POS)</field>
5+
<field name="model_id" ref="model_pos_order" />
6+
<field name="state">code</field>
7+
<field name="code">model._send_to_sii()</field>
8+
<field name='interval_number'>5</field>
9+
<field name='interval_type'>minutes</field>
10+
<field name="numbercall">-1</field>
11+
</record>
12+
</odoo>

l10n_es_pos_sii/models/pos_order.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ class PosOrder(models.Model):
1212
_name = "pos.order"
1313
_inherit = ["pos.order", "sii.mixin"]
1414

15-
order_jobs_ids = fields.Many2many(
16-
comodel_name="queue.job",
17-
column1="pos_order_id",
18-
column2="job_id",
19-
relation="pos_order_queue_job_rel",
20-
string="Connector Jobs",
21-
copy=False,
22-
)
23-
2415
@api.depends("company_id", "state")
2516
def _compute_sii_description(self):
2617
for order in self:
@@ -75,19 +66,14 @@ def _is_sii_type_breakdown_required(self, taxes_dict):
7566
"""
7667
return False
7768

78-
def _get_sii_jobs_field_name(self):
79-
return "order_jobs_ids"
80-
8169
def _get_valid_document_states(self):
8270
return SII_VALID_POS_ORDER_STATES
8371

8472
def _aeat_get_partner(self):
85-
partner = self.session_id.config_id.default_partner_id
73+
partner = self.env.ref('l10n_es.partner_simplified', raise_if_not_found=False)
8674
if not partner:
8775
raise UserError(
88-
_("You must define a default partner for POS {}").format(
89-
self.session_id.config_id.display_name,
90-
)
76+
_("Simplified Invoice Partner not found. Please update l10n_es module.")
9177
)
9278
return partner
9379

@@ -171,3 +157,20 @@ def _get_aeat_invoice_dict_out(self, cancel=False):
171157
if self.amount_total < 0.0:
172158
inv_dict["FacturaExpedida"]["TipoRectificativa"] = "I"
173159
return inv_dict
160+
161+
@api.model
162+
def _send_to_sii_valid(self):
163+
documents = self.search(
164+
[
165+
("state", "in", self._get_valid_document_states()),
166+
("aeat_state", "not in", ["sent", "cancelled"]),
167+
("sii_enabled", "=", True),
168+
("sii_send_date", "<=", fields.Datetime.now()),
169+
]
170+
)
171+
if documents:
172+
documents.confirm_one_document()
173+
174+
@api.model
175+
def _send_to_sii(self):
176+
self._send_to_sii_valid()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
No se requieren pasos adicionales de configuración, ver configuración de
2-
los módulos l10n_es_pos, l10n_es_aeat_sii_oca y pos_default_partner.
2+
los módulos l10n_es_pos_oca, l10n_es_aeat_sii_oca y pos_default_partner.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
- [Aures Tic](https://aurestic.es):
22
- Almudena de la Puente \<<[email protected]>\>
33
- Jose Zambudio \<<[email protected]>\>
4+
- [APSL-Nagarro](<https://apsl.tech>):
5+
- Bernat Obrador \<<[email protected]>\>

l10n_es_pos_sii/static/description/index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Envío de pedidos del TPV al SII</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:be4fd959e6a7dda853164de82e35a74a964042a5233e6b5ecb0ed8c33b35a7ba
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_sii"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_pos_sii"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_oca_sii"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_pos_oca_sii"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>Envío al SII de pedidos del TPV de forma individual.</p>
374374
<p><strong>Table of contents</strong></p>
375375
<div class="contents local topic" id="contents">
@@ -388,7 +388,7 @@ <h1 class="title">Envío de pedidos del TPV al SII</h1>
388388
<div class="section" id="configuration">
389389
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
390390
<p>No se requieren pasos adicionales de configuración, ver configuración de
391-
los módulos l10n_es_pos, l10n_es_aeat_sii_oca y pos_default_partner.</p>
391+
los módulos l10n_es_pos_oca, l10n_es_aeat_sii_oca y pos_default_partner.</p>
392392
</div>
393393
<div class="section" id="known-issues-roadmap">
394394
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
@@ -411,7 +411,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
411411
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-spain/issues">GitHub Issues</a>.
412412
In case of trouble, please check there if your issue has already been reported.
413413
If you spotted it first, help us to smash it by providing a detailed and welcomed
414-
<a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_pos_sii%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
414+
<a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_pos_oca_sii%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
415415
<p>Do not contact contributors directly about support or help with technical issues.</p>
416416
</div>
417417
<div class="section" id="credits">
@@ -430,6 +430,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
430430
<li>Jose Zambudio &lt;<a class="reference external" href="mailto:jose&#64;aurestic.es">jose&#64;aurestic.es</a>&gt;</li>
431431
</ul>
432432
</li>
433+
<li><a class="reference external" href="https://apsl.tech">APSL-Nagarro</a>:<ul>
434+
<li>Bernat Obrador &lt;<a class="reference external" href="mailto:bobrador&#64;apsl.net">bobrador&#64;apsl.net</a>&gt;</li>
435+
</ul>
436+
</li>
433437
</ul>
434438
</div>
435439
<div class="section" id="maintainers">
@@ -441,7 +445,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
441445
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
442446
mission is to support the collaborative development of Odoo features and
443447
promote its widespread use.</p>
444-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_sii">OCA/l10n-spain</a> project on GitHub.</p>
448+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_pos_oca_sii">OCA/l10n-spain</a> project on GitHub.</p>
445449
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
446450
</div>
447451
</div>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/** @odoo-module **/
2+
3+
import {ErrorPopup} from "@point_of_sale/app/errors/popups/error_popup";
4+
import {InvoiceButton} from "@point_of_sale/app/screens/ticket_screen/invoice_button/invoice_button";
5+
import {_t} from "@web/core/l10n/translation";
6+
import {patch} from "@web/core/utils/patch";
7+
import {useService} from "@web/core/utils/hooks";
8+
9+
patch(InvoiceButton.prototype, {
10+
setup() {
11+
super.setup(...arguments);
12+
this.popup = useService("popup");
13+
},
14+
15+
get commandName() {
16+
let cName = super.commandName;
17+
const order = this.props?.order;
18+
if (order) {
19+
cName = this.isAlreadyInvoiced
20+
? _t("Reprint Invoice")
21+
: order.siiSessionClosed
22+
? _t("Cannot Invoice")
23+
: _t("Invoice");
24+
}
25+
return cName;
26+
},
27+
28+
async _invoiceOrder() {
29+
const order = this.props?.order;
30+
if (!order) {
31+
return;
32+
}
33+
34+
if (order.siiSessionClosed) {
35+
this.popup.add(ErrorPopup, {
36+
title: _t("Session is closed"),
37+
body: _t("Cannot invoice order from closed session."),
38+
});
39+
return;
40+
}
41+
42+
return await super._invoiceOrder(...arguments);
43+
},
44+
});

l10n_es_pos_sii/static/src/js/Screens/TicketScreen/ControlButtons/InvoiceButton.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)