Use context to check model and field access
issue4081 review8481002
This commit is contained in:
+10
-12
@@ -53,18 +53,16 @@ class Purchase:
|
||||
if invoice:
|
||||
lines_to_delete = [l for l in invoice.lines if l.type != 'line']
|
||||
lines = [l for l in invoice.lines if l.type == 'line']
|
||||
invoice_line_ids = [l.id for l in lines]
|
||||
with Transaction().set_user(0, set_context=True):
|
||||
InvoiceLine.write(lines, {
|
||||
'invoice': None,
|
||||
'invoice_type': invoice.type,
|
||||
'party': invoice.party.id,
|
||||
'currency': invoice.currency.id,
|
||||
'company': invoice.company.id,
|
||||
})
|
||||
InvoiceLine.delete(lines_to_delete)
|
||||
Invoice.cancel([invoice])
|
||||
Invoice.delete([invoice])
|
||||
InvoiceLine.write(lines, {
|
||||
'invoice': None,
|
||||
'invoice_type': invoice.type,
|
||||
'party': invoice.party.id,
|
||||
'currency': invoice.currency.id,
|
||||
'company': invoice.company.id,
|
||||
})
|
||||
InvoiceLine.delete(lines_to_delete)
|
||||
Invoice.cancel([invoice])
|
||||
Invoice.delete([invoice])
|
||||
return None
|
||||
return invoice
|
||||
|
||||
|
||||
Reference in New Issue
Block a user