mirror of
https://gitlab.com/datalifeit/trytond-ir_sequence_period
synced 2023-12-14 06:22:52 +01:00
24 lines
661 B
Python
24 lines
661 B
Python
|
# 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
|
||
|
from trytond.transaction import Transaction
|
||
|
|
||
|
__all__ = ['Sale']
|
||
|
|
||
|
|
||
|
class Sale:
|
||
|
__name__ = 'sale.sale'
|
||
|
__metaclass__ = PoolMeta
|
||
|
|
||
|
@classmethod
|
||
|
def __setup__(cls):
|
||
|
super(Sale, cls).__setup__()
|
||
|
cls.sale_date.states['required'] |= (Eval('state') == 'quotation')
|
||
|
|
||
|
@classmethod
|
||
|
def set_number(cls, sales):
|
||
|
for sale in sales:
|
||
|
with Transaction().set_context(date=sale.sale_date):
|
||
|
super(Sale, cls).set_number([sale])
|