Set complaint as origin to credit note lines

issue4756
review19261002
This commit is contained in:
Cédric Krier committed 2015-06-01 22:55:46 +02:00
1 parent eede2c6934
commit 3e3b19a0fc
3 files changed
+22 -2

No files matched your search

+2
View File
@@ -4,6 +4,7 @@
from trytond.pool import Pool
from .complaint import *
from .sale import *
from .account import *
def register():
@@ -15,4 +16,5 @@ def register():
Action_InvoiceLine,
Configuration,
Sale,
InvoiceLine,
module='sale_complaint', type_='model')
+16
View File
@@ -0,0 +1,16 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from __future__ import unicode_literals
from trytond.pool import PoolMeta
__all__ = ['InvoiceLine']
class InvoiceLine:
__name__ = 'account.invoice.line'
__metaclass__ = PoolMeta
@classmethod
def _get_origin(cls):
return super(InvoiceLine, cls)._get_origin() + ['sale.complaint']
+4 -2
View File
@@ -427,9 +427,11 @@ class Action(ModelSQL, ModelView):
values = invoice._credit()
lines_values = []
for invoice_line in invoice_lines:
lines_values.append(invoice_line._credit())
credit_line = invoice_line._credit()
lines_values.append(credit_line)
# Remove product as it is not a return
lines_values[0].pop('product', None)
credit_line.pop('product', None)
credit_line['origin'] = str(self.complaint)
if isinstance(self.complaint.origin, Line):
if self.quantity is not None:
lines_values[0]['quantity'] = self.quantity