Files
tryton/invoice.py
T

26 lines
889 B
Python
Raw Normal View History

#This file is part of Tryton. The COPYRIGHT file at the top level
#of this repository contains the full copyright notices and license terms.
2012-09-24 22:18:10 +02:00
from trytond.pool import Pool, PoolMeta
__all__ = ['InvoiceLine']
__metaclass__ = PoolMeta
2012-09-24 22:18:10 +02:00
class InvoiceLine:
__name__ = 'account.invoice.line'
2012-09-24 22:18:10 +02:00
@classmethod
def __setup__(cls):
super(InvoiceLine, cls).__setup__()
cls._error_messages.update({
2013-02-24 15:47:27 +01:00
'delete_purchase_invoice_line': ('You can not delete '
'invoice lines that comes from a purchase.'),
2013-02-24 15:47:27 +01:00
})
2012-09-24 22:18:10 +02:00
@classmethod
def delete(cls, lines):
2013-03-24 23:23:32 +01:00
PurchaseLine = Pool().get('purchase.line')
if any(l for l in lines
if isinstance(l.origin, PurchaseLine) and l.type == 'line'):
2013-03-24 23:23:32 +01:00
cls.raise_user_error('delete_purchase_invoice_line')
2012-09-24 22:18:10 +02:00
super(InvoiceLine, cls).delete(lines)