Skip to content
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

Merged

Conversation

eLBati
Copy link
Member

@eLBati eLBati commented Dec 7, 2019

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:

sale

And:

image

--
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

@eLBati eLBati force-pushed the 12.0-fix-l10n_it_website_portal_fatturapa_sale branch 8 times, most recently from f768e52 to 8c758e0 Compare December 9, 2019 18:29
@mrcast
Copy link
Contributor

mrcast commented Dec 10, 2019

@eLBati Passi fatti:

  • da backend creato un partner Mario Rossi, inseriti i dati anagrafici tranne codice fiscale
  • fatta offerta
  • inviata via email
  • lato portale cliccato su Accetta Paga ho messo flag su "I request to receive electronic invoice"
  • mi viene chiesto login
  • dato accesso di portale e seguito link per registrarmi
  • rientrato su offerta e fatto Accetta Paga e ho messo flag su "I request to receive electronic invoice"
  • vengo portato alla compilazione dati profilo perchè manca il codice fiscale ma:
  • CF e partita IVA non sono editabili
  • mi viene richiesto obbligatoriamente il telefono (è necessario?)

image

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
@eLBati eLBati force-pushed the 12.0-fix-l10n_it_website_portal_fatturapa_sale branch from 8c758e0 to 497e657 Compare December 11, 2019 15:53
@eLBati
Copy link
Member Author

eLBati commented Dec 11, 2019

@mrcast dovrei aver risolto

Copy link
Contributor

@mrcast mrcast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funzionalità OK
grazie

@eLBati
Copy link
Member Author

eLBati commented Dec 11, 2019

@SimoRubi vuoi dare un'occhiata?

@eLBati
Copy link
Member Author

eLBati commented Dec 13, 2019

Essendo modulo beta, intanto faccio merge.

@eLBati
Copy link
Member Author

eLBati commented Dec 13, 2019

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 12.0-ocabot-merge-pr-1556-by-eLBati-bump-minor, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Dec 13, 2019
Signed-off-by eLBati
@OCA-git-bot OCA-git-bot merged commit 497e657 into OCA:12.0 Dec 13, 2019
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 3cc9c7a. Thanks a lot for contributing to OCA. ❤️

Copy link
Member

@SimoRubi SimoRubi left a 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)
Copy link
Member

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'
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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 ''">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se ho ben capito, questo dovrebbe far sì che abilitando portal_mandatory.. non viene visualizzato il check I request to receive.. ma 'sotto-sotto' il check è True.
Se è così, non mi pare funzionare (ho provato nel runbot della PR):
Peek 2019-12-18 18-01

Copy link
Member Author

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

Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants