-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
[14.0][REF] l10n_it_delivery_note: refactoring compute invoice status #2327
[14.0][REF] l10n_it_delivery_note: refactoring compute invoice status #2327
Conversation
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.
Grazie della PR!
Puoi aggiungere un test automatico?
Vedo che il codice qui era uguale a com'è attualmente in 12.0
:
l10n-italy/l10n_it_delivery_note/models/stock_delivery_note.py
Lines 245 to 256 in 31eb0c8
if lines and all( | |
line.invoice_status == DOMAIN_INVOICE_STATUSES[2] | |
for line in lines): | |
note.state = DOMAIN_DELIVERY_NOTE_STATES[2] | |
note.invoice_status = DOMAIN_INVOICE_STATUSES[2] | |
elif any(line.invoice_status == DOMAIN_INVOICE_STATUSES[1] | |
for line in lines): | |
note.invoice_status = DOMAIN_INVOICE_STATUSES[1] | |
else: | |
note.invoice_status = DOMAIN_INVOICE_STATUSES[0] |
se il problema è anche in 12.0
puoi creare una issue di tracciamento come descritto in https://github.com/OCA/l10n-italy/wiki/Team-di-sviluppo#apertura-issue?
Occhio poi che attualmente queste modifiche vanno in conflitto con il codice di 14.0
260eeb3
to
baeb924
Compare
A me sfugge la differenza tra i due codici. In quale caso il comportamento del vecchio codice è diverso dal nuovo. Se lo identifichiamo aggiungere un test diventa + facile. |
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.
Se non è chiaro quale sia il problema che viene risolto, declasserei il tutto a un refactoring quindi REF
(da https://www.odoo.com/documentation/14.0/developer/misc/other/guidelines.html#tag-and-module-name) quantomeno nel commit.
Vedendolo come un refactoring, il codice mi pare effettivamente più leggibile così come lo vorresti cambiare.
Ho aggiunto un commento ma non è bloccante per la mia approvazione, l'unica cosa secondo me necessaria è cambiare il tipo di commit.
note.invoice_status = DOMAIN_INVOICE_STATUSES[0] | ||
if lines: | ||
if all( | ||
line.invoice_status == DOMAIN_INVOICE_STATUSES[2] for line in lines | ||
): | ||
note.state = DOMAIN_DELIVERY_NOTE_STATES[2] | ||
note.invoice_status = DOMAIN_INVOICE_STATUSES[2] | ||
elif any( | ||
line.invoice_status == DOMAIN_INVOICE_STATUSES[1] for line in lines | ||
): | ||
note.invoice_status = DOMAIN_INVOICE_STATUSES[1] |
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.
Riusciresti a evitare di assegnare più volte note.invoice_status
?
Per farlo potresti ad esempio salvare il valore che vuoi in una variabile ad esempio invoice_status
e poi assegnarlo subito dopo la conclusione del if lines
baeb924
to
fb484bf
Compare
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.
Grazie della PR!
Revisione del codice, per me è ok
This PR has the |
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at dd73db0. Thanks a lot for contributing to OCA. ❤️ |
FIX: create ddt without sale order
--
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