-
-
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
[16.0] FIX access error to e-invoices for users who did not create the attachment #3827
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.
Functional test ok!
In generale mi piaceve di più l'idea di creare gli allegati correttamente, e non con Non vorrei che un giorno qualcuno in odoo / OCA / * pensasse che sia una buona idea rimuovere tutti gli allegati "orfani". |
si in effetti e' pericoloso lasciarli orfani perche' diventerebbero soggeti a eliminazione |
Questo lo vedo difficile, perchè di |
Non mi risulta, vedi sopra. Provate a cercare in un DB di produzione, magari con website, attachment dove |
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!
Come mai il commit non rispetta le linee guida? Vedi https://github.com/OCA/odoo-community.org/blob/8afdb5a5ebfd3314e2fc836c9b9f644468ee044e/website/Contribution/CONTRIBUTING.rst#L1114.
Puoi aggiungere un test? Così si evitano regressioni
@api.model | ||
def check(self, mode, values=None): | ||
for attachment in self: |
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 una nota per dire che normalmente nei metodi api.model
self
è un recordset vuoto, questo metodo però viene anche chiamato su dei record, ad esempio in https://github.com/odoo/odoo/blob/d752abb24d9b25bb6d10e411961447c8c8e28bba/odoo/addons/base/models/ir_attachment.py#L503
ftpa_attachment = ( | ||
self.env["fatturapa.attachment.in"] | ||
.sudo() | ||
.search([("ir_attachment_id", "=", attachment.id)]) |
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.
Cercare all'interno di un loop è molto dispendioso, si può spostare la ricerca fuori dal loop?
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.
In questo caso non saprei come
class Attachment(models.Model): | ||
_inherit = "ir.attachment" | ||
|
||
@api.model |
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.
Tutto questo è duplicato di quanto sopra, non sono tante righe ma dici che è possibile ridurre la duplicazione del codice?
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.
Modificato
1504a9c
to
27d81f2
Compare
… e-invoices for users who did not create the attachment
modificato |
Sposto in #3785 a causa del refactoring |
Perchè le 2 PR toccavano gli stessi file e da separate, se mergiate, non funzionavano, vedi ad es |
Capito grazie, quindi le PR di per sé non hanno problemi: ci sono problemi solo quando cerchi di usarle entrambe |
Risolve #3623 e #3336