2022-10-19 15:47:47 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# This file is part of the cashbook-module from m-ds for Tryton.
|
|
|
|
# The COPYRIGHT file at the top level of this repository contains the
|
|
|
|
# full copyright notices and license terms.
|
|
|
|
|
|
|
|
from trytond.pool import PoolMeta
|
|
|
|
from trytond.pyson import Eval, And, Or
|
|
|
|
|
|
|
|
|
|
|
|
class InvoiceLine(metaclass=PoolMeta):
|
|
|
|
__name__ = 'account.invoice.line'
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def __setup__(cls):
|
|
|
|
super(InvoiceLine, cls).__setup__()
|
|
|
|
cls.unit.states['required'] = Or(
|
|
|
|
cls.unit.states['required'],
|
|
|
|
And(
|
|
|
|
Eval('type') == 'line',
|
|
|
|
Eval('quantity', None) != None,
|
|
|
|
),
|
|
|
|
)
|
2023-04-04 11:08:09 +00:00
|
|
|
cls.unit.depends.add('type')
|
|
|
|
cls.unit.depends.add('quantity')
|
2022-10-19 15:47:47 +00:00
|
|
|
|
|
|
|
# end Invoice
|