Skip to content

Commit

Permalink
[14.0][l10n_it_pos_fatturapa] Port to v14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robyf70 committed Mar 31, 2022
1 parent 4bcb3c4 commit 736e86b
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 92 deletions.
10 changes: 5 additions & 5 deletions l10n_it_pos_fatturapa/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ ITA - POS - Fattura elettronica
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_pos_fatturapa
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_pos_fatturapa
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_pos_fatturapa
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_pos_fatturapa
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/12.0
:target: https://runbot.odoo-community.org/runbot/122/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -46,7 +46,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_pos_fatturapa%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_pos_fatturapa%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand Down Expand Up @@ -84,6 +84,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|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.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_pos_fatturapa>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
14 changes: 6 additions & 8 deletions l10n_it_pos_fatturapa/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2019 Roberto Fichera
# Copyright 2019-2022 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 "
"dell'interfaccia del POS",
"version": "12.0.1.0.2",
"dell'interfaccia del POS",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Point Of Sale",
"website": "https://github.com/OCA/l10n-italy",
Expand All @@ -20,10 +20,8 @@
"l10n_it_pos_fiscalcode",
"l10n_it_fatturapa",
],
'qweb': [
'static/src/xml/pos.xml'
],
'data': [
'views/assets.xml',
"qweb": ["static/src/xml/pos.xml"],
"data": [
"views/assets.xml",
],
}
15 changes: 7 additions & 8 deletions l10n_it_pos_fatturapa/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@


class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"

@api.model
def create_from_ui(self, partner):
if 'electronic_invoice_subjected' in partner:
electronic_invoice_subjected = \
partner['electronic_invoice_subjected'] == 'true'
partner['electronic_invoice_subjected'] = \
electronic_invoice_subjected
partner['electronic_invoice_obliged_subject'] = \
electronic_invoice_subjected
if "electronic_invoice_subjected" in partner:
electronic_invoice_subjected = (
partner["electronic_invoice_subjected"] == "true"
)
partner["electronic_invoice_subjected"] = electronic_invoice_subjected
partner["electronic_invoice_obliged_subject"] = electronic_invoice_subjected
return super(ResPartner, self).create_from_ui(partner)
8 changes: 4 additions & 4 deletions l10n_it_pos_fatturapa/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>ITA - POS - Fattura elettronica</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">ITA - POS - Fattura elettronica</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_pos_fatturapa"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_pos_fatturapa"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_pos_fatturapa"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_pos_fatturapa"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
<p>Il modulo aggiunge i campi per gestire i riferimenti della fatturazione elettronica nella schermata del cliente nell’interfaccia del punto vendita,
permettendo di visualizzarli e modificarli.</p>
Expand All @@ -391,7 +391,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_pos_fatturapa%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_pos_fatturapa%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -417,7 +417,7 @@ <h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/robyf70"><img alt="robyf70" src="https://github.com/robyf70.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_pos_fatturapa">OCA/l10n-italy</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_pos_fatturapa">OCA/l10n-italy</a> project on GitHub.</p>
<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>
</div>
</div>
Expand Down
17 changes: 10 additions & 7 deletions l10n_it_pos_fatturapa/static/src/js/models.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
odoo.define('l10n_it_pos_fatturapa.models', function (require) {
odoo.define("l10n_it_pos_fatturapa.models", function (require) {
"use strict";

var pos_models = require('point_of_sale.models');

pos_models.load_fields("res.partner",
["electronic_invoice_subjected", "eori_code",
"codice_destinatario", "pec_destinatario",
"pa_partner_code"]);
var pos_models = require("point_of_sale.models");

pos_models.load_fields("res.partner", [
"electronic_invoice_subjected",
"electronic_invoice_obliged_subject",
"eori_code",
"codice_destinatario",
"pec_destinatario",
"pa_partner_code",
]);
});
39 changes: 25 additions & 14 deletions l10n_it_pos_fatturapa/static/src/js/screens.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
odoo.define('l10n_it_pos_fatturapa.screens', function (require) {
odoo.define("l10n_it_pos_fatturapa.ClientDetailsEdit", function (require) {
"use strict";

var Screens = require('point_of_sale.screens');
var ClientDetailsEdit = require("point_of_sale.ClientDetailsEdit");
const Registries = require("point_of_sale.Registries");

Screens.ClientListScreenWidget.include({

display_client_details: function(visibility,partner,clickpos){
var self = this;
this._super.apply(self, arguments);
if (visibility === 'edit') {
this.$('.electronic_invoice_subjected').off('change').on('change', function(event) {
this.value = this.checked;
$('#electronic_invoice_subjected').css('display', this.checked ? 'block' : 'none');
});
const PosClientDetailsEdit = (ClientDetailsEdit) =>
class extends ClientDetailsEdit {
constructor() {
super(...arguments);
const partner = this.props.partner;
this.changes.electronic_invoice_obliged_subject =
partner.electronic_invoice_obliged_subject;
}
captureChange(event) {
super.captureChange(event);
if (event.target.name === "electronic_invoice_obliged_subject") {
$("#electronic_invoice_obliged_subject").css(
"display",
event.target.checked ? "block" : "none"
);
this.changes[event.target.name] = event.target.checked;
}
}
},
});
};

Registries.Component.extend(ClientDetailsEdit, PosClientDetailsEdit);

return ClientDetailsEdit;
});
89 changes: 46 additions & 43 deletions l10n_it_pos_fatturapa/static/src/xml/pos.xml
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">

<t t-extend="ClientDetails">
<t t-jquery=".client-details-right" t-operation="append">
<div class='client-detail'>
<t t-if="partner.electronic_invoice_subjected">
<span class='label'>e-Invoice</span>
<input type="checkbox" class='detail o_checkbox electronic_invoice_subjected'
t-att-checked="partner.electronic_invoice_subjected ? 'checked' : null" disabled="disabled"
t-att-value="partner.electronic_invoice_subjected"/><br/>

<div id="electronic_invoice_subjected" t-attf-style="display: #{partner.electronic_invoice_subjected ? 'block': 'none'};">
<div class="client-detail">
<span class='label'>Code</span>
<span class='detail codice_destinatario'><t t-esc='partner.codice_destinatario or ""'/></span><br/>

<span class='label'>PEC</span>
<span class='detail pec_destinatario'><t t-esc='partner.pec_destinatario or ""'/></span><br/>

<span class='label'>EORI</span>
<span class='detail eori_code'><t t-esc='partner.eori_code or ""'/></span><br/>

<span class='label'>iPA Code</span>
<span class='detail pa_partner_code'><t t-esc='partner.pa_partner_code or ""'/></span>
</div>
</div>
</t>
</div>
</t>
</t>

<t t-extend="ClientDetailsEdit">
<t t-jquery=".client-details-right" t-operation="append">
<t
t-name="ClientDetailsEdit"
t-inherit="point_of_sale.ClientDetailsEdit"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div[hasclass('client-details-right')]" t-operation="inside">
<div class='client-detail'>
<span class='label'>e-Invoice</span>
<input type='checkbox' class='detail o_checkbox checkbox electronic_invoice_subjected'
name='electronic_invoice_subjected' t-att-checked="partner.electronic_invoice_subjected ? 'checked' : null"
t-att-value="partner.electronic_invoice_subjected"/>

<div id="electronic_invoice_subjected" t-attf-style="display: #{partner.electronic_invoice_subjected ? 'block': 'none'};">
<input
type='checkbox'
class='detail o_checkbox checkbox electronic_invoice_obliged_subject'
name='electronic_invoice_obliged_subject'
t-on-change="captureChange"
t-att-checked="props.partner.electronic_invoice_obliged_subject ? 'checked' : null"
t-att-value="props.partner.electronic_invoice_obliged_subject"
/>

<div
id="electronic_invoice_obliged_subject"
t-attf-style="display: {{props.partner.electronic_invoice_obliged_subject ? 'block': 'none'}};"
>
<div class='client-detail'>
<span class='label'>Code</span>
<input class='detail codice_destinatario' name='codice_destinatario' t-att-value="partner.codice_destinatario or '0000000'"/>
<input
class='detail codice_destinatario'
name='codice_destinatario'
t-on-change="captureChange"
t-att-value="props.partner.codice_destinatario or '0000000'"
/>

<span class='label'>PEC</span>
<input class='detail pec_destinatario' name='pec_destinatario' t-att-value="partner.pec_destinatario or ''"/>
<input
class='detail pec_destinatario'
name='pec_destinatario'
t-on-change="captureChange"
t-att-value="props.partner.pec_destinatario or ''"
/>

<span class='label'>EORI</span>
<input class='detail eori_code' name='eori_code' t-att-value="partner.eori_code or ''"/>
<input
class='detail eori_code'
name='eori_code'
t-on-change="captureChange"
t-att-value="props.partner.eori_code or ''"
/>

<span class='label'>iPA Code</span>
<input class='detail pa_partner_code' name='pa_partner_code' t-att-value="partner.pa_partner_code or ''"/>
<input
class='detail pa_partner_code'
name='pa_partner_code'
t-on-change="captureChange"
t-att-value="props.partner.pa_partner_code or ''"
/>
</div>
</div>
</div>
</t>
</xpath>
</t>

</templates>
12 changes: 9 additions & 3 deletions l10n_it_pos_fatturapa/views/assets.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/l10n_it_pos_fatturapa/static/src/js/models.js"/>
<script type="text/javascript" src="/l10n_it_pos_fatturapa/static/src/js/screens.js"/>
<script
type="text/javascript"
src="/l10n_it_pos_fatturapa/static/src/js/models.js"
/>
<script
type="text/javascript"
src="/l10n_it_pos_fatturapa/static/src/js/screens.js"
/>
</xpath>
</template>

Expand Down
6 changes: 6 additions & 0 deletions setup/l10n_it_pos_fatturapa/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 736e86b

Please sign in to comment.