Keep stock moves when credit or correct an invoice
issue9140 review273041002
This commit is contained in:
1 parent
7c2eeaf7ab
commit
b40fe7c968
2 files changed
+15
-12
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Add _account_invoice_correction context keyword when copying for correction
|
||||
|
||||
Version 5.4.0 - 2019-11-04
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
|
||||
+13
-12
@@ -68,19 +68,20 @@ class InvoiceCorrect(Wizard):
|
||||
Line = pool.get('account.invoice.line')
|
||||
|
||||
invoice = Invoice(Transaction().context['active_id'])
|
||||
correction, = Invoice.copy([invoice], default={
|
||||
'lines': [],
|
||||
})
|
||||
# Copy each line one by one to get negative and positive lines
|
||||
# following each other
|
||||
for line in self.start.lines:
|
||||
Line.copy([line], default={
|
||||
'invoice': correction.id,
|
||||
'quantity': -line.quantity,
|
||||
})
|
||||
Line.copy([line], default={
|
||||
'invoice': correction.id,
|
||||
with Transaction().set_context(_account_invoice_correction=True):
|
||||
correction, = Invoice.copy([invoice], default={
|
||||
'lines': [],
|
||||
})
|
||||
# Copy each line one by one to get negative and positive lines
|
||||
# following each other
|
||||
for line in self.start.lines:
|
||||
Line.copy([line], default={
|
||||
'invoice': correction.id,
|
||||
'quantity': -line.quantity,
|
||||
})
|
||||
Line.copy([line], default={
|
||||
'invoice': correction.id,
|
||||
})
|
||||
Invoice.update_taxes([correction])
|
||||
data = {'res_id': [correction.id]}
|
||||
return action, data
|
||||
Reference in new issue
Block a user