diff --git a/__init__.py b/__init__.py index 5f0e991..05d2cde 100644 --- a/__init__.py +++ b/__init__.py @@ -2,9 +2,13 @@ # copyright notices and license terms. from trytond.pool import Pool import sale +import configuration def register(): Pool.register( sale.Sale, module='dash_sale', type_='model') + # Pool.register( + # configuration.ConfigurationDashSale, + # module='dash_sale', type_='model') diff --git a/configuration.py b/configuration.py new file mode 100644 index 0000000..0695cc9 --- /dev/null +++ b/configuration.py @@ -0,0 +1,32 @@ +# 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', states={ + 'required': Bool(Eval('context', {}).get('company', 0)), + }) + + @classmethod + def __setup__(cls): + super(ConfigurationDashSale, cls).__setup__() + + @staticmethod + def default_company(): + return Transaction().context.get('company') or None diff --git a/configuration.xml b/configuration.xml new file mode 100644 index 0000000..41ecbab --- /dev/null +++ b/configuration.xml @@ -0,0 +1,27 @@ + + + + + + + dash.configuration + form + configuration_form + + + Dash Configuration + dash.configuration + + + + + + + + + + diff --git a/tryton.cfg b/tryton.cfg index 0ee2864..1593518 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=5.0.1 +version=5.0.2 depends: party product