Skip to content

Commit

Permalink
[MIG] l10n_it_pos_fatturapa: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
caiuka authored and aleuffre committed Jul 10, 2023
1 parent 29a81ca commit 8a442f2
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 137 deletions.
6 changes: 4 additions & 2 deletions l10n_it_pos_fatturapa/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ITA - POS - Fattura elettronica
:target: https://runbot.odoo-community.org/runbot/122/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

**Italiano**

Expand Down Expand Up @@ -62,6 +62,8 @@ Contributors
~~~~~~~~~~~~

* Roberto Fichera <roberto.fichera@levelprime.com>
* berim <info@berim.it>
* Ooops404 <info@ooops404.com>

Maintainers
~~~~~~~~~~~
Expand All @@ -82,7 +84,7 @@ promote its widespread use.

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-robyf70|
|maintainer-robyf70|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_pos_fatturapa>`_ project on GitHub.

Expand Down
12 changes: 5 additions & 7 deletions l10n_it_pos_fatturapa/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Copyright 2019 Roberto Fichera
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "ITA - POS - Fattura elettronica",
"summary": "Gestione dati fattura elettronica del cliente all'interno "
"summary": "Gestione dati fattura elettronica del cliente all'interno"
"dell'interfaccia del POS",
"version": "12.0.1.0.2",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Point Of Sale",
"website": "https://github.com/OCA/l10n-italy" "/tree/12.0/l10n_it_pos_fatturapa",
"author": "Roberto Fichera, Odoo Community Association (OCA)",
"maintainers": ["robyf70"],
"website": "https://github.com/OCA/l10n-italy",
"author": "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
Expand All @@ -20,7 +18,7 @@
"l10n_it_pos_fiscalcode",
"l10n_it_fatturapa",
],
"qweb": ["static/src/xml/pos.xml"],
"qweb": ["static/src/xml/pos_dump.xml"],
"data": [
"views/assets.xml",
],
Expand Down
14 changes: 9 additions & 5 deletions l10n_it_pos_fatturapa/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright 2019 Roberto Fichera
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
Expand All @@ -10,9 +9,14 @@ class ResPartner(models.Model):
@api.model
def create_from_ui(self, partner):
if "electronic_invoice_subjected" in partner:
electronic_invoice_subjected = (
partner["electronic_invoice_subjected"] == "true"
electronic_invoice_subjected = bool(
partner.get("electronic_invoice_subjected")
)

partner.update(
{
"electronic_invoice_subjected": electronic_invoice_subjected,
"electronic_invoice_obliged_subject": electronic_invoice_subjected,
}
)
partner["electronic_invoice_subjected"] = electronic_invoice_subjected
partner["electronic_invoice_obliged_subject"] = electronic_invoice_subjected
return super(ResPartner, self).create_from_ui(partner)
2 changes: 2 additions & 0 deletions l10n_it_pos_fatturapa/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* Roberto Fichera <roberto.fichera@levelprime.com>
* berim <info@berim.it>
* Ooops404 <info@ooops404.com>
26 changes: 26 additions & 0 deletions l10n_it_pos_fatturapa/static/src/js/ClientDetailsEdit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
odoo.define("l10n_it_pos_fatturapa.ClientDetailsEdit", function (require) {
"use strict";

const ClientDetailsEdit = require("point_of_sale.ClientDetailsEdit");
const Registries = require("point_of_sale.Registries");

const PosClientDetailsEditCode = (ClientDetailsEdit) =>
class extends ClientDetailsEdit {
captureChange(event) {
super.captureChange(event);
if (event.target.name === "electronic_invoice_subjected") {
const checked = event.currentTarget.checked;
this.changes[event.target.name] = checked;
$(".electronic_invoice_subjected")
.toArray()
.forEach(function (el) {
$(el).css("display", checked ? "block" : "none");
});
}
}
};

Registries.Component.extend(ClientDetailsEdit, PosClientDetailsEditCode);

return ClientDetailsEdit;
});
2 changes: 1 addition & 1 deletion l10n_it_pos_fatturapa/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ odoo.define("l10n_it_pos_fatturapa.models", function (require) {
"eori_code",
"codice_destinatario",
"pec_destinatario",
"pa_partner_code",
"ipa_code",
]);
});
23 changes: 0 additions & 23 deletions l10n_it_pos_fatturapa/static/src/js/screens.js

This file was deleted.

98 changes: 0 additions & 98 deletions l10n_it_pos_fatturapa/static/src/xml/pos.xml

This file was deleted.

62 changes: 62 additions & 0 deletions l10n_it_pos_fatturapa/static/src/xml/pos_dump.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">

<t t-inherit="point_of_sale.ClientDetailsEdit" t-inherit-mode="extension">
<xpath expr="//div[@class='client-details-right']" position="inside">
<div class="client-detail">
<span class='label'>e-Invoice</span>
<input
type='checkbox'
class='detail o_checkbox'
name='electronic_invoice_subjected'
t-att-checked="props.partner.electronic_invoice_subjected ? 'checked' : null"
t-on-change="captureChange"
t-att-value="props.partner.electronic_invoice_subjected"
/>
</div>
<div
class="electronic_invoice_subjected"
t-on-change="captureChange"
t-attf-style="display: {{props.partner.electronic_invoice_subjected ? 'block': 'none'}};"
>
<div class="client-detail">
<span class='label'>Code</span>
<input
class='detail codice_destinatario'
name='codice_destinatario'
t-on-change="captureChange"
t-att-value="props.partner.codice_destinatario || ''"
/>
</div>
<div class="client-detail">
<span class='label'>PEC</span>
<input
class='detail pec_destinatario'
name='pec_destinatario'
t-on-change="captureChange"
t-att-value="props.partner.pec_destinatario || ''"
/>
</div>
<div class="client-detail">
<span class='label'>EORI</span>
<input
class='detail eori_code'
name='eori_code'
t-on-change="captureChange"
t-att-value="props.partner.eori_code || ''"
/>
</div>
<div class="client-detail">
<span class='label'>iPA Code</span>
<input
class='detail pa_partner_code'
name='ipa_code'
t-on-change="captureChange"
t-att-value="props.partner.ipa_code || ''"
/>
</div>
</div>
</xpath>
</t>

</templates>
2 changes: 1 addition & 1 deletion l10n_it_pos_fatturapa/views/assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/>
<script
type="text/javascript"
src="/l10n_it_pos_fatturapa/static/src/js/screens.js"
src="/l10n_it_pos_fatturapa/static/src/js/ClientDetailsEdit.js"
/>
</xpath>
</template>
Expand Down

0 comments on commit 8a442f2

Please sign in to comment.