forked from OCA/l10n-italy
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD l10n_it_website_portal_corrispettivi: Aggiunge ricevuta o fattura…
… come opzione nel profilo dell'utente portale
- Loading branch information
Showing
10 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import controllers | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2021 Lorenzo Battistini @ TAKOBI | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "ITA - Ricevute - Portale", | ||
"summary": "Aggiunge ricevuta o fattura come opzione nel profilo dell'utente" | ||
" portale", | ||
"version": "12.0.1.0.0", | ||
"author": "Odoo Community Association (OCA), TAKOBI", | ||
"category": "Localization/Italy", | ||
"website": "https://github.com/OCA/l10n-italy/tree/12.0", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"l10n_it_corrispettivi", | ||
"portal" | ||
], | ||
"data": [ | ||
"views/l10n_it_website_portal_corrispettivi_templates.xml" | ||
], | ||
"auto_install": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from odoo.addons.portal.controllers.portal import CustomerPortal | ||
|
||
CustomerPortal.OPTIONAL_BILLING_FIELDS.extend(["use_corrispettivi", "use_invoices"]) | ||
|
||
|
||
class WebsitePortalCorrispettivi(CustomerPortal): | ||
|
||
def details_form_validate(self, data): | ||
if data.get("use_invoices", False): | ||
data["use_corrispettivi"] = False | ||
else: | ||
data["use_corrispettivi"] = True | ||
return super(WebsitePortalCorrispettivi, self).details_form_validate(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import res_partner |
18 changes: 18 additions & 0 deletions
18
l10n_it_website_portal_corrispettivi/models/res_partner.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from odoo import models, api | ||
|
||
|
||
class Partner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
@api.multi | ||
def write(self, vals): | ||
if "use_invoices" in vals: | ||
del vals["use_invoices"] | ||
res = super(Partner, self).write(vals) | ||
if "use_corrispettivi" in vals: | ||
for p in self: | ||
p.onchange_use_corrispettivi() | ||
vals = p._convert_to_write(p._cache) | ||
del vals["use_corrispettivi"] | ||
p.write(vals) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Allow frontend users to set "Request invoices" from their *details* page. |
18 changes: 18 additions & 0 deletions
18
..._it_website_portal_corrispettivi/views/l10n_it_website_portal_corrispettivi_templates.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<template id="corrispettivi_details" name="Add use_invoices" inherit_id="portal.portal_my_details"> | ||
<xpath expr="//div[hasclass('o_portal_details')]/div[1]/div[1]" position="after"> | ||
<!-- after state_id --> | ||
<div class="row"> | ||
<div class="col-xl-6 form-group div_use_invoices"> | ||
<input type="checkbox" name="use_invoices" | ||
style="width: auto; margin:0px" | ||
t-att-checked="use_invoices or not partner.use_corrispettivi"/> | ||
<label for="use_invoices" style="margin-left:5px"> | ||
Request invoices | ||
</label> | ||
</div> | ||
</div> | ||
</xpath> | ||
</template> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/l10n_it_website_portal_corrispettivi/odoo/addons/l10n_it_website_portal_corrispettivi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../l10n_it_website_portal_corrispettivi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |