Files
tryton/account.py
T
Cédric Krier 9637f47783 Initial commit
issue5215
review24591002
2017-04-02 10:37:33 +02:00

32 lines
899 B
Python

# 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 trytond.pool import Pool, PoolMeta
__all__ = ['Invoice', 'InvoiceLine']
class Invoice:
__name__ = 'account.invoice'
__metaclass__ = PoolMeta
def get_sales(self, name):
pool = Pool()
AdvancePaymentCondition = pool.get('sale.advance_payment.condition')
sales = set(super(Invoice, self).get_sales(name))
for line in self.lines:
if isinstance(line.origin, AdvancePaymentCondition):
sales.add(line.origin.sale.id)
return list(sales)
class InvoiceLine:
__name__ = 'account.invoice.line'
__metaclass__ = PoolMeta
@classmethod
def _get_origin(cls):
return (super(InvoiceLine, cls)._get_origin()
+ ['sale.advance_payment.condition'])