Merge invoice and credit note
issue5225 review18921002
This commit is contained in:
+3
-3
@@ -150,13 +150,13 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
'account.invoice': [
|
||||
('party', '=', Eval('customer')),
|
||||
('company', '=', Eval('company')),
|
||||
('type', '=', 'out_invoice'),
|
||||
('type', '=', 'out'),
|
||||
('state', 'in', ['posted', 'paid']),
|
||||
],
|
||||
'account.invoice.line': [
|
||||
('invoice.party', '=', Eval('customer')),
|
||||
('invoice.company', '=', Eval('company')),
|
||||
('invoice.type', '=', 'out_invoice'),
|
||||
('invoice.type', '=', 'out'),
|
||||
('invoice.state', 'in', ['posted', 'paid']),
|
||||
],
|
||||
}
|
||||
@@ -434,7 +434,7 @@ class Action(ModelSQL, ModelView):
|
||||
credit_line['origin'] = str(self.complaint)
|
||||
if isinstance(self.complaint.origin, Line):
|
||||
if self.quantity is not None:
|
||||
lines_values[0]['quantity'] = self.quantity
|
||||
lines_values[0]['quantity'] = -self.quantity
|
||||
if self.unit_price is not None:
|
||||
lines_values[0]['unit_price'] = self.unit_price
|
||||
values['lines'] = [('create', lines_values)]
|
||||
|
||||
@@ -186,11 +186,11 @@ Create a complaint to credit the invoice::
|
||||
>>> action, = complaint.actions
|
||||
>>> credit_note = action.result
|
||||
>>> credit_note.type
|
||||
u'out_credit_note'
|
||||
u'out'
|
||||
>>> len(credit_note.lines)
|
||||
2
|
||||
>>> sum(l.quantity for l in credit_note.lines)
|
||||
5.0
|
||||
-5.0
|
||||
|
||||
Create a complaint to credit a invoice line::
|
||||
|
||||
@@ -209,7 +209,7 @@ Create a complaint to credit a invoice line::
|
||||
>>> action, = complaint.actions
|
||||
>>> credit_note = action.result
|
||||
>>> credit_note.type
|
||||
u'out_credit_note'
|
||||
u'out'
|
||||
>>> credit_note_line, = credit_note.lines
|
||||
>>> credit_note_line.quantity
|
||||
1.0
|
||||
-1.0
|
||||
|
||||
Reference in New Issue
Block a user