account_invoice_xrechnung/invoice.py

24 lines
716 B
Python
Raw Normal View History

2022-10-19 15:47:47 +00:00
# -*- coding: utf-8 -*-
2023-06-30 09:21:48 +00:00
# This file is part of the account-invoice-xrechnung-module
# from m-ds for Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
2022-10-19 15:47:47 +00:00
from trytond.pool import PoolMeta
2024-11-21 13:34:17 +00:00
from trytond.pyson import Eval, And, Or, Bool
2022-10-19 15:47:47 +00:00
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',
2024-11-21 13:34:17 +00:00
Bool(Eval('quantity'))))
cls.unit.depends.update(['type', 'quantity'])
2022-10-19 15:47:47 +00:00
# end Invoice