-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[12.0] REF l10n_it_website_portal_fatturapa_sale for higher control #1556
[12.0] REF l10n_it_website_portal_fatturapa_sale for higher control #1556
Conversation
f768e52
to
8c758e0
Compare
@eLBati Passi fatti:
|
Accessing to online quote with anonymous: odoo.exceptions.AccessError: ('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Contact, Operation: read) - (Records: [7], User: 4)', None) Error to render compiling AST AccessError: ('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Contact, Operation: read) - (Records: [7], User: 4)', None) Template: payment.payment_tokens_list Path: /templates/t/form/div[2]/label/input Node: <input type="checkbox" name="electronic_invoice_subjected" t-att-checked="'checked' if request.env['res.partner'].browse(partner_id).electronic_invoice_subjected else None"/> I request to receive electronic invoice - - - Refactored without nested ajax calls to get more control and handle anonymous requests Add support for signature flow
…onfigure "Mandatory e-invoicing for portal customers" Avoid to block TIN and FC editing for sent quotations
8c758e0
to
497e657
Compare
@mrcast dovrei aver risolto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funzionalità OK
grazie
@SimoRubi vuoi dare un'occhiata? |
Essendo modulo beta, intanto faccio merge. |
/ocabot merge minor |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 3cc9c7a. Thanks a lot for contributing to OCA. ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purtroppo sono riuscito a dare un'occhiata solo ora, anche se la PR è già mergiata, ho trovato un paio di cose su cui ho dei dubbi.
|
||
portal_mandatory_e_invoicing = fields.Boolean( | ||
related='company_id.portal_mandatory_e_invoicing', | ||
string="Mandatory e-invoicing for portal customers", readonly=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meglio rimuovere l'attributo string
: viene recuperato automaticamente dal campo related (https://github.com/odoo/odoo/blob/81f4e69c27afa8e0fa55f8870ca4788d87596b37/odoo/fields.py#L238).
SaleOrder = self.env['sale.order'] | ||
has_so = SaleOrder.search([ | ||
('partner_id', 'child_of', self.commercial_partner_id.id), | ||
('state', 'in', ['sale', 'done']) # removing 'sent' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forse sbaglio, ma mi sembra che questo metodo non possa mai cambiare il risultato di super
..
Il codice qui è lo stesso del metodo in super
, l'unica modifica è che recuperi meno ordini (solo ordini sale
e done
invece di sent
, sale
e done
).
Se il super
trova un sale.order in stato sent
, sale
o done
, ritorna False
quindi qui non ci arriviamo nemmeno, a cosa serve fare di nuovo questa ricerca su un sottinsieme degli ordini già cercati in super
?
Mi potresti chiarire a cosa serve questo metodo in pratica?
}) | ||
except ValidationError: | ||
return False | ||
ResPartner.can_edit_vat = can_edit_vat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Come mai non usi l'ereditarietà di Odoo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proprio per ovviare al problema che descrivi in https://github.com/OCA/l10n-italy/pull/1556/files/497e657ae470f013c01297c3ffb05944cc68c5f9#r359441273
In pratica sto sostituendo la can_edit_vat
di from odoo.addons.sale.models.res_partner.ResPartner
con la mia; quella del modulo sale
, per come è scritta nel modulo sale
non viene più eseguita.
Questo perchè, per come è strutturata la can_edit_vat
, l'unica alternativa era fare un override senza super
(come dici tu, se facessi un override normale, il mio codice non verrebbe mai eseguito).
Allora ho seguito la strada di "patchare" la can_edit_vat
di sale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avevo capito che c'era un problema ma non che c'era anche già una soluzione, beh dai meglio che niente, grazie!
@@ -9,11 +9,23 @@ | |||
name="Add e-invoice subjected in Payment Tokens list" | |||
inherit_id="payment.payment_tokens_list"> | |||
<xpath expr="//div[hasclass('card')]" position="after"> | |||
<div class="form-check"> | |||
<div class="form-check" t-att-style="'display:none;' if (sale_order and sale_order.company_id.portal_mandatory_e_invoicing) else ''"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attenzione che questo modulo opera sugli ordini "portal", quindi i preventivi online, e non sugli ordini dell'e-commerce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Giusto, ho provato su un ordine portale ed è tutto ok, grazie!
Refactored without nested ajax calls to get more control and handle anonymous requests
Add support for signature flow
Add the possibility to configure "Mandatory e-invoicing for portal customers"
FIX Accessing to online quote with anonymous user:
odoo.exceptions.AccessError: ('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Contact, Operation: read) - (Records: [7], User: 4)', None)
Error to render compiling AST
AccessError: ('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Contact, Operation: read) - (Records: [7], User: 4)', None)
Template: payment.payment_tokens_list
Path: /templates/t/form/div[2]/label/input
Node:
I request to receive electronic invoice - - -
Also FIX:
And:
--
Confermo di aver firmato il CLA https://odoo-community.org/page/cla e di aver letto le linee guida su https://odoo-community.org/page/contributing