Skip to content

Commit

Permalink
Integrate l10n_it_website_sale_fatturapa, otherwise "I want invoice" …
Browse files Browse the repository at this point in the history
…would not give company the possibility to issue e-invoice

Improve README and description
ADD setup dir
auto_install module
  • Loading branch information
eLBati committed Apr 9, 2019
1 parent b616e47 commit 0822f99
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 55 deletions.
32 changes: 16 additions & 16 deletions l10n_it_website_sale_corrispettivi/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=================================================
Italian localization - Website Sale Corrispettivi
=================================================
===========================
ITA - E-commerce - Ricevute
===========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
Expand All @@ -27,17 +27,17 @@ Italian localization - Website Sale Corrispettivi

**Italiano**

Questo modulo aggiunge la spunta *Voglio fattura* nella pagina dell'indirizzo all'interno del flusso di checkout,
il suo valore è l'opposto di *Usa corrispettivi* nel partner.
Questo modulo aggiunge la spunta *Richiedi fattura* nella pagina dell'indirizzo all'interno del flusso di checkout,
il suo valore è l'opposto di *Usare ricevute* nel partner.

Per gli utenti non loggati, il default del flag *Voglio fattura* è sempre vuoto.
Per gli utenti non autenticati, il valore predefinito della casella *Richiedi fattura* è sempre vuoto.

**English**

This module adds the *Want invoice* check in partner's address form of checkout flow,
its value is the opposite of *Use corrispettivi* in partner.
This module adds the *Request invoice* check in partner's address form of checkout flow,
its value is the opposite of *Use receipts* in partner.

For unlogged users the default value for *Want invoice* flag is always empty.
For unlogged users the default value for *Request invoice* flag is always empty.

**Table of contents**

Expand All @@ -49,29 +49,29 @@ Configuration

**Italiano**

Il comportamento dipende da come è configurato il partner associato all'utente loggato, ad esempio:
Il comportamento dipende da come è configurato il partner associato all'utente autenticato, ad esempio:

* Se il partner associato all'utente loggato ha il flag *Usa corrispettivi* abilitato, la spunta *Voglio fattura* sarà disabilitata;
* Se il partner associato all'utente loggato ha il flag *Usa corrispettivi* disabilitato, la spunta *Voglio fattura* sarà abilitata;
* Se il partner associato all'utente che ha effettuato il login ha la spunta *Usare ricevute* abilitata, la spunta *Richiedi fattura* sarà disabilitata;
* Se il partner associato all'utente che ha effettuato il login ha la spunta *Usare ricevute* disabilitata, la spunta *Richiedi fattura* sarà abilitata;

**English**

The behavior depends on how the partner associated with the logged in user is configured, for example:

* If the partner associated with the logged in user has the *Use corrispettivi* flag enabled, the check *Want invoice* will be disabled;
* If the partner associated with the logged in user has the *Use corrispettivi* flag disabled, the check *Want invoice* will be enabled;
* If the partner associated with the logged in user has the *Use receipts* flag enabled, the check *Request invoice* will be disabled;
* If the partner associated with the logged in user has the *Use receipts* flag disabled, the check *Request invoice* will be enabled;


Known issues / Roadmap
======================

**Italiano**

Per gli utenti non loggati il default del flag *Voglio fattura* è sempre vuoto, dovrebbe dipendere dal flag *Usa corrispettivi* nel partner dell'utente pubblico.
Per gli utenti non autenticati il valore predefinito della casella *Richiedi fattura* è sempre vuoto, dovrebbe dipendere dalla casella *Usare ricevute* nel partner dell'utente pubblico.

**English**

For unlogged users the default value for *Want invoice* flag is always empty, it should depend on the *Use corrispettivi* flag in the partner of the public user.
For unlogged users the default value for *Request invoice* flag is always empty, it should depend on the *Use receipts* flag in the partner of the public user.

Bug Tracker
===========
Expand Down
7 changes: 5 additions & 2 deletions l10n_it_website_sale_corrispettivi/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
'name': 'Italian localization - Website Sale Corrispettivi',
'name': 'ITA - E-commerce - Ricevute',
'summary': 'Aggiunge la ricevuta come opzione per l\'utente e-commerce',
'category': 'e-commerce',
'author': 'Agile Business Group,'
'Odoo Community Association (OCA)',
Expand All @@ -12,10 +13,12 @@
'l10n_it_website_sale_corrispettivi',
'depends': [
'website_sale',
'l10n_it_corrispettivi_sale'
'l10n_it_corrispettivi_sale',
'l10n_it_website_sale_fatturapa'
],
'data': [
'views/templates.xml',
],
'installable': True,
'auto_install': True,
}
6 changes: 6 additions & 0 deletions l10n_it_website_sale_corrispettivi/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

class WebsiteSaleCorrispettivi(WebsiteSale):

def values_preprocess(self, order, mode, values):
pre_values = super().values_preprocess(order, mode, values)
pre_values['use_corrispettivi'] = not values.get(
'use_invoice', False)
return pre_values

def _checkout_form_save(self, mode, checkout, all_values):
partner_id = super(WebsiteSaleCorrispettivi, self) \
._checkout_form_save(mode, checkout, all_values)
Expand Down
4 changes: 2 additions & 2 deletions l10n_it_website_sale_corrispettivi/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ msgstr ""

#. module: l10n_it_website_sale_corrispettivi
#: model:ir.ui.view,arch_db:l10n_it_website_sale_corrispettivi.address
msgid "Want invoice"
msgstr "Voglio fattura"
msgid "Request invoice"
msgstr "Richiedi fattura"

#. module: l10n_it_website_sale_corrispettivi
#: model:ir.model,name:l10n_it_website_sale_corrispettivi.model_website
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ msgstr ""

#. module: l10n_it_website_sale_corrispettivi
#: model:ir.ui.view,arch_db:l10n_it_website_sale_corrispettivi.address
msgid "Want invoice"
msgid "Request invoice"
msgstr ""

#. module: l10n_it_website_sale_corrispettivi
Expand Down
10 changes: 5 additions & 5 deletions l10n_it_website_sale_corrispettivi/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
**Italiano**

Il comportamento dipende da come è configurato il partner associato all'utente loggato, ad esempio:
Il comportamento dipende da come è configurato il partner associato all'utente autenticato, ad esempio:

* Se il partner associato all'utente loggato ha il flag *Usa corrispettivi* abilitato, la spunta *Voglio fattura* sarà disabilitata;
* Se il partner associato all'utente loggato ha il flag *Usa corrispettivi* disabilitato, la spunta *Voglio fattura* sarà abilitata;
* Se il partner associato all'utente che ha effettuato il login ha la spunta *Usare ricevute* abilitata, la spunta *Richiedi fattura* sarà disabilitata;
* Se il partner associato all'utente che ha effettuato il login ha la spunta *Usare ricevute* disabilitata, la spunta *Richiedi fattura* sarà abilitata;

**English**

The behavior depends on how the partner associated with the logged in user is configured, for example:

* If the partner associated with the logged in user has the *Use corrispettivi* flag enabled, the check *Want invoice* will be disabled;
* If the partner associated with the logged in user has the *Use corrispettivi* flag disabled, the check *Want invoice* will be enabled;
* If the partner associated with the logged in user has the *Use receipts* flag enabled, the check *Request invoice* will be disabled;
* If the partner associated with the logged in user has the *Use receipts* flag disabled, the check *Request invoice* will be enabled;

12 changes: 6 additions & 6 deletions l10n_it_website_sale_corrispettivi/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
**Italiano**

Questo modulo aggiunge la spunta *Voglio fattura* nella pagina dell'indirizzo all'interno del flusso di checkout,
il suo valore è l'opposto di *Usa corrispettivi* nel partner.
Questo modulo aggiunge la spunta *Richiedi fattura* nella pagina dell'indirizzo all'interno del flusso di checkout,
il suo valore è l'opposto di *Usare ricevute* nel partner.

Per gli utenti non loggati, il default del flag *Voglio fattura* è sempre vuoto.
Per gli utenti non autenticati, il valore predefinito della casella *Richiedi fattura* è sempre vuoto.

**English**

This module adds the *Want invoice* check in partner's address form of checkout flow,
its value is the opposite of *Use corrispettivi* in partner.
This module adds the *Request invoice* check in partner's address form of checkout flow,
its value is the opposite of *Use receipts* in partner.

For unlogged users the default value for *Want invoice* flag is always empty.
For unlogged users the default value for *Request invoice* flag is always empty.
4 changes: 2 additions & 2 deletions l10n_it_website_sale_corrispettivi/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**Italiano**

Per gli utenti non loggati il default del flag *Voglio fattura* è sempre vuoto, dovrebbe dipendere dal flag *Usa corrispettivi* nel partner dell'utente pubblico.
Per gli utenti non autenticati il valore predefinito della casella *Richiedi fattura* è sempre vuoto, dovrebbe dipendere dalla casella *Usare ricevute* nel partner dell'utente pubblico.

**English**

For unlogged users the default value for *Want invoice* flag is always empty, it should depend on the *Use corrispettivi* flag in the partner of the public user.
For unlogged users the default value for *Request invoice* flag is always empty, it should depend on the *Use receipts* flag in the partner of the public user.
32 changes: 16 additions & 16 deletions l10n_it_website_sale_corrispettivi/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Italian localization - Website Sale Corrispettivi</title>
<title>ITA - E-commerce - Ricevute</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,22 +360,22 @@
</style>
</head>
<body>
<div class="document" id="italian-localization-website-sale-corrispettivi">
<h1 class="title">Italian localization - Website Sale Corrispettivi</h1>
<div class="document" id="ita-e-commerce-ricevute">
<h1 class="title">ITA - E-commerce - Ricevute</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_website_sale_corrispettivi"><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_website_sale_corrispettivi"><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><strong>Italiano</strong></p>
<p>Questo modulo aggiunge la spunta <em>Voglio fattura</em> nella pagina dell’indirizzo all’interno del flusso di checkout,
il suo valore è l’opposto di <em>Usa corrispettivi</em> nel partner.</p>
<p>Per gli utenti non loggati, il default del flag <em>Voglio fattura</em> è sempre vuoto.</p>
<p>Questo modulo aggiunge la spunta <em>Richiedi fattura</em> nella pagina dell’indirizzo all’interno del flusso di checkout,
il suo valore è l’opposto di <em>Usare ricevute</em> nel partner.</p>
<p>Per gli utenti non autenticati, il valore predefinito della casella <em>Richiedi fattura</em> è sempre vuoto.</p>
<p><strong>English</strong></p>
<p>This module adds the <em>Want invoice</em> check in partner’s address form of checkout flow,
its value is the opposite of <em>Use corrispettivi</em> in partner.</p>
<p>For unlogged users the default value for <em>Want invoice</em> flag is always empty.</p>
<p>This module adds the <em>Request invoice</em> check in partner’s address form of checkout flow,
its value is the opposite of <em>Use receipts</em> in partner.</p>
<p>For unlogged users the default value for <em>Request invoice</em> flag is always empty.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -393,24 +393,24 @@ <h1 class="title">Italian localization - Website Sale Corrispettivi</h1>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p><strong>Italiano</strong></p>
<p>Il comportamento dipende da come è configurato il partner associato all’utente loggato, ad esempio:</p>
<p>Il comportamento dipende da come è configurato il partner associato all’utente autenticato, ad esempio:</p>
<ul class="simple">
<li>Se il partner associato all’utente loggato ha il flag <em>Usa corrispettivi</em> abilitato, la spunta <em>Voglio fattura</em> sarà disabilitata;</li>
<li>Se il partner associato all’utente loggato ha il flag <em>Usa corrispettivi</em> disabilitato, la spunta <em>Voglio fattura</em> sarà abilitata;</li>
<li>Se il partner associato all’utente che ha effettuato il login ha la spunta <em>Usare ricevute</em> abilitata, la spunta <em>Richiedi fattura</em> sarà disabilitata;</li>
<li>Se il partner associato all’utente che ha effettuato il login ha la spunta <em>Usare ricevute</em> disabilitata, la spunta <em>Richiedi fattura</em> sarà abilitata;</li>
</ul>
<p><strong>English</strong></p>
<p>The behavior depends on how the partner associated with the logged in user is configured, for example:</p>
<ul class="simple">
<li>If the partner associated with the logged in user has the <em>Use corrispettivi</em> flag enabled, the check <em>Want invoice</em> will be disabled;</li>
<li>If the partner associated with the logged in user has the <em>Use corrispettivi</em> flag disabled, the check <em>Want invoice</em> will be enabled;</li>
<li>If the partner associated with the logged in user has the <em>Use receipts</em> flag enabled, the check <em>Request invoice</em> will be disabled;</li>
<li>If the partner associated with the logged in user has the <em>Use receipts</em> flag disabled, the check <em>Request invoice</em> will be enabled;</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<p><strong>Italiano</strong></p>
<p>Per gli utenti non loggati il default del flag <em>Voglio fattura</em> è sempre vuoto, dovrebbe dipendere dal flag <em>Usa corrispettivi</em> nel partner dell’utente pubblico.</p>
<p>Per gli utenti non autenticati il valore predefinito della casella <em>Richiedi fattura</em> è sempre vuoto, dovrebbe dipendere dalla casella <em>Usare ricevute</em> nel partner dell’utente pubblico.</p>
<p><strong>English</strong></p>
<p>For unlogged users the default value for <em>Want invoice</em> flag is always empty, it should depend on the <em>Use corrispettivi</em> flag in the partner of the public user.</p>
<p>For unlogged users the default value for <em>Request invoice</em> flag is always empty, it should depend on the <em>Use receipts</em> flag in the partner of the public user.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
odoo.define('l10n_it_website_sale_corrispettivi', function(require) {
'use strict';
require('web.core');

$(document).ready(function () {
var $container_div = $('.oe_website_sale');
var $use_invoice_input = $container_div.find("input[name='use_invoice'][type='checkbox']");
var $electronic_invoice_subjected_input = $container_div.find("input[name='electronic_invoice_subjected'][type='checkbox']");
var $electronic_invoice_subjected_div = $container_div.find("div.div_electronic_invoice_subjected");
var $div_codice_destinatario = $container_div.find("div.div_codice_destinatario");
var $div_pec_destinatario = $container_div.find("div.div_pec_destinatario");

var compute_invoice_subjected_fields_visibility = function(){
if ($use_invoice_input[0] != null) {
if ($use_invoice_input[0].checked) {
$electronic_invoice_subjected_div.show();
} else {
$electronic_invoice_subjected_input.prop('checked', false);
$electronic_invoice_subjected_div.hide();
$div_codice_destinatario.hide();
$div_pec_destinatario.hide();
}
}
};
compute_invoice_subjected_fields_visibility();
$use_invoice_input.change(compute_invoice_subjected_fields_visibility);

});
});
15 changes: 10 additions & 5 deletions l10n_it_website_sale_corrispettivi/views/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<odoo>
<template id="address" inherit_id="website_sale.address">
<xpath expr="//form[@name='/shop/checkout']/input[last()]" position="after">
<div class="clearfix"/>
<div t-attf-class="form-group col-md-6">
<template id="assets_frontend" inherit_id="website.assets_frontend">
<xpath expr="script[last()]" position="after">
<script type="text/javascript"
src="/l10n_it_website_sale_corrispettivi/static/src/js/l10n_it_website_sale_corrispettivi.js"/>
</xpath>
</template>
<template id="address" inherit_id="l10n_it_website_sale_fatturapa.address">
<xpath expr="//div[hasclass('div_electronic_invoice_subjected')]" position="before">
<div t-attf-class="col-lg-12" t-if="mode[1] != 'shipping'">
<div class="checkbox">
<label>
<input type="checkbox" name="use_invoice"
t-att-checked="'use_corrispettivi' in checkout and not checkout['use_corrispettivi']"/>
Want invoice
Request invoice
</label>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions setup/l10n_it_website_sale_corrispettivi/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 0822f99

Please sign in to comment.