Skip to content

Commit

Permalink
[IMP] l10n_it_pos_fatturapa: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
iwkse committed Dec 27, 2021
1 parent dcffd03 commit afd93f1
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 51 deletions.
10 changes: 4 additions & 6 deletions l10n_it_pos_fatturapa/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "ITA - POS - Fattura elettronica",
"summary": "Gestione dati fattura elettronica del cliente all'interno "
"dell'interfaccia del POS",
"dell'interfaccia del POS",
"version": "12.0.1.0.2",
"development_status": "Beta",
"category": "Point Of Sale",
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)
16 changes: 9 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,13 @@
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",
"eori_code",
"codice_destinatario",
"pec_destinatario",
"pa_partner_code",
]);
});
24 changes: 14 additions & 10 deletions l10n_it_pos_fatturapa/static/src/js/screens.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
odoo.define('l10n_it_pos_fatturapa.screens', function (require) {
odoo.define("l10n_it_pos_fatturapa.screens", function (require) {
"use strict";

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

Screens.ClientListScreenWidget.include({

display_client_details: function(visibility,partner,clickpos){
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');
});
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"
);
});
}
},
});
});
});
72 changes: 55 additions & 17 deletions l10n_it_pos_fatturapa/static/src/xml/pos.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
<?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/>
<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
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='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='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='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>
<span class='detail pa_partner_code'><t
t-esc='partner.pa_partner_code or ""'
/></span>
</div>
</div>
</t>
Expand All @@ -34,23 +49,46 @@
<t t-jquery=".client-details-right" t-operation="append">
<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"/>
<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'};">
<div
id="electronic_invoice_subjected"
t-attf-style="display: #{partner.electronic_invoice_subjected ? '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-att-value="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-att-value="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-att-value="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-att-value="partner.pa_partner_code or ''"
/>
</div>
</div>
</div>
Expand Down
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 afd93f1

Please sign in to comment.