trytonpsk-dash_sale/configuration.py

31 lines
1.0 KiB
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.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval, If, In, Get
from trytond.transaction import Transaction
__all__ = ['ConfigurationDashSale']
class ConfigurationDashSale(ModelSQL, ModelView):
'Configuration Dash Sale'
__name__ = 'dash.configuration.sale'
company = fields.Many2One('company.company', 'Company', required=True,
domain=[
('id', If(In('company',
Eval('context', {})), '=', '!='), Get(Eval('context', {}),
'company', 0))
])
app = fields.Selection([
('order', 'On Order Processed'),
('delivery', 'On Shipment Sent')
], 'Sale Invoice Method')
@classmethod
def __setup__(cls):
super(ConfigurationDashSale, cls).__setup__()
@staticmethod
def default_company():
return Transaction().context.get('company') or None