Add sale apps

This commit is contained in:
oscar 2021-04-14 12:19:41 -05:00
parent 0a69b178db
commit 13996b0065
11 changed files with 140 additions and 63 deletions

View File

@ -2,13 +2,11 @@
# copyright notices and license terms. # copyright notices and license terms.
from trytond.pool import Pool from trytond.pool import Pool
import sale import sale
import configuration
def register(): def register():
Pool.register( Pool.register(
sale.Sale, sale.Sale,
sale.DashAppDelivery,
sale.DashAppSaleOrder,
module='dash_sale', type_='model') module='dash_sale', type_='model')
# Pool.register(
# configuration.ConfigurationDashSale,
# module='dash_sale', type_='model')

View File

@ -1,30 +0,0 @@
# 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

View File

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="dash_configuration_view_form">
<field name="model">dash.configuration</field>
<field name="type">form</field>
<field name="name">configuration_form</field>
</record>
<record model="ir.action.act_window" id="act_dash_configuration_form">
<field name="name">Dash Configuration</field>
<field name="res_model">dash.configuration</field>
</record>
<record model="ir.action.act_window.view"
id="act_dash_configuration_view1">
<field name="sequence" eval="1"/>
<field name="view" ref="dash_configuration_view_form"/>
<field name="act_window" ref="act_dash_configuration_form"/>
</record>
<menuitem name="General Configuration" parent="menu_configuration"
action="act_dash_configuration_form" sequence="20"
id="menu_dash_configuration" icon="tryton-list"/>
</data>
</tryton>

15
dash.py Normal file
View File

@ -0,0 +1,15 @@
# 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.pool import PoolMeta
__all__ = ['DashApp']
class DashApp(metaclass=PoolMeta):
__name__ = 'dash.app'
@classmethod
def _get_origin(cls):
origins = super(DashApp, cls)._get_origin()
origins.extend(['dash.app.delivery', 'dash.app.sale_order'])
return origins

31
sale.py
View File

@ -8,8 +8,9 @@ from sql.aggregate import Sum
from datetime import date from datetime import date
from trytond.pool import Pool, PoolMeta from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.model import ModelView, ModelSQL, fields
__all__ = ['Sale'] __all__ = ['Sale', 'DashAppDelivery', 'DashAppSaleOrder']
class Sale(metaclass=PoolMeta): class Sale(metaclass=PoolMeta):
@ -230,3 +231,31 @@ class Sale(metaclass=PoolMeta):
} }
return res return res
class DashAppDelivery(ModelSQL, ModelView):
'Dash App Delivery'
__name__ = 'dash.app.delivery'
company = fields.Many2One('company.company', 'Company', required=True)
@classmethod
def __setup__(cls):
super(DashAppDelivery, cls).__setup__()
@staticmethod
def default_company():
return Transaction().context.get('company') or None
class DashAppSaleOrder(ModelSQL, ModelView):
'Dash App Sale Order'
__name__ = 'dash.app.sale_order'
company = fields.Many2One('company.company', 'Company', required=True)
@classmethod
def __setup__(cls):
super(DashAppSaleOrder, cls).__setup__()
@staticmethod
def default_company():
return Transaction().context.get('company') or None

62
sale.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="dash_app_delivery_view_form">
<field name="model">dash.app.delivery</field>
<field name="type">form</field>
<field name="name">app_delivery_form</field>
</record>
<record model="ir.ui.view" id="dash_app_delivery_view_tree">
<field name="model">dash.app.delivery</field>
<field name="type">tree</field>
<field name="name">app_delivery_tree</field>
</record>
<record model="ir.action.act_window" id="act_dash_app_delivery_form">
<field name="name">App Delivery</field>
<field name="res_model">dash.app.delivery</field>
</record>
<record model="ir.action.act_window.view" id="act_dash_app_delivery_form_view1">
<field name="sequence" eval="1"/>
<field name="view" ref="dash_app_delivery_view_tree"/>
<field name="act_window" ref="act_dash_app_delivery_form"/>
</record>
<record model="ir.action.act_window.view" id="act_dash_app_delivery_form_view2">
<field name="sequence" eval="2"/>
<field name="view" ref="dash_app_delivery_view_form"/>
<field name="act_window" ref="act_dash_app_delivery_form"/>
</record>
<menuitem parent="dash.menu_dash" sequence="10"
action="act_dash_app_delivery_form" id="menu_dash_app_delivery_form"/>
<record model="ir.ui.view" id="dash_app_sale_order_view_form">
<field name="model">dash.app.sale_order</field>
<field name="type">form</field>
<field name="name">app_sale_order_form</field>
</record>
<record model="ir.ui.view" id="dash_app_sale_order_view_tree">
<field name="model">dash.app.sale_order</field>
<field name="type">tree</field>
<field name="name">app_sale_order_tree</field>
</record>
<record model="ir.action.act_window" id="act_dash_app_sale_order_form">
<field name="name">App Sale Order</field>
<field name="res_model">dash.app.sale_order</field>
</record>
<record model="ir.action.act_window.view" id="act_dash_app_sale_order_form_view1">
<field name="sequence" eval="1"/>
<field name="view" ref="dash_app_sale_order_view_tree"/>
<field name="act_window" ref="act_dash_app_sale_order_form"/>
</record>
<record model="ir.action.act_window.view" id="act_dash_app_sale_order_form_view2">
<field name="sequence" eval="2"/>
<field name="view" ref="dash_app_sale_order_view_form"/>
<field name="act_window" ref="act_dash_app_sale_order_form"/>
</record>
<menuitem parent="dash.menu_dash" sequence="10"
action="act_dash_app_sale_order_form" id="menu_dash_app_sale_order_form"/>
</data>
</tryton>

View File

@ -1,9 +1,13 @@
[tryton] [tryton]
version=5.0.2 version=5.0.3
depends: depends:
party party
product product
account account
stock
sale sale
sale_salesman
commission
dash dash
xml: xml:
sale.xml

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!-- This file is part sale_shop module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<form>
<label name="company"/>
<field name="company"/>
</form>

View File

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!-- This file is part sale_shop module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tree >
<field name="company"/>
</tree>

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!-- This file is part sale_shop module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<form>
<label name="company"/>
<field name="company"/>
</form>

View File

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!-- This file is part sale_shop module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tree >
<field name="company"/>
</tree>