diff --git a/__init__.py b/__init__.py index 6f3a927..f6017f3 100644 --- a/__init__.py +++ b/__init__.py @@ -3,7 +3,6 @@ from trytond.pool import Pool from . import sale from . import dash -from . import product def register(): @@ -15,5 +14,4 @@ def register(): sale.AppOrderViewer, sale.AppSelfServiceSale, dash.DashApp, - # product.Product, module='dash_sale', type_='model') diff --git a/product.py b/product.py index 2aaa3b9..8b39617 100644 --- a/product.py +++ b/product.py @@ -1,17 +1,9 @@ # 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 decimal import Decimal -from datetime import date -from trytond.model import fields, ModelSQL, ModelView -from trytond.pool import PoolMeta, Pool -from trytond.transaction import Transaction -from trytond.wizard import Wizard, StateTransition, StateView, Button +from trytond.model import fields +from trytond.pool import PoolMeta class Product(metaclass=PoolMeta): __name__ = 'product.product' short_name = fields.Char('Short Name') - - # def get_rec_name(self, name=None): - # super(Product, self).get_rec_name(name=name) - # return self.template.name diff --git a/reports.xml b/reports.xml new file mode 100644 index 0000000..0b1cf7c --- /dev/null +++ b/reports.xml @@ -0,0 +1,23 @@ + + + + + + Sales Month + sale.sale + card_info + report_sales_month + True + + + + Sales By Month + sale.sale + bar + report_sales_by_month + True + + + + diff --git a/sale.py b/sale.py index be3ece4..2e5be52 100644 --- a/sale.py +++ b/sale.py @@ -8,18 +8,13 @@ from sql.aggregate import Sum from datetime import date from trytond.pool import Pool, PoolMeta from trytond.transaction import Transaction -from trytond.model import ModelView, ModelSQL, fields +from trytond.model import fields from trytond.modules.dash.dash import DashAppBase class Sale(metaclass=PoolMeta): __name__ = 'sale.sale' - @classmethod - def __setup__(cls): - super(Sale, cls).__setup__() - - @classmethod def dash_faster_process(cls, records): for rec in records: @@ -213,9 +208,6 @@ class Sale(metaclass=PoolMeta): def command(cls, args): Shop = Pool().get('sale.shop') ShopTable = Pool().get('sale.shop.table') - Product = Pool().get('product.product') - Party = Pool().get('party.party') - Line = Pool().get('sale.line') User = Pool().get('res.user') context = Transaction().context today = date.today() @@ -242,7 +234,7 @@ class Sale(metaclass=PoolMeta): to_create = { 'shop': shop.id, 'party': party.id, - 'invoice_type':'P', + 'invoice_type': 'P', 'table_assigned': args['table_assigned']['id'], 'shipment_address': party.addresses[0].id, 'invoice_address': party.addresses[0].id, @@ -298,7 +290,6 @@ class Sale(metaclass=PoolMeta): except Exception as e: print(e, 'error') - @classmethod def report_sales_day(cls, args, ctx): pass @@ -346,7 +337,6 @@ class Sale(metaclass=PoolMeta): if not periods: return res - report = args.get('report', None) period = periods[0] selector_periods = Period.search([ ('fiscalyear', '=', period.fiscalyear.id), @@ -362,7 +352,8 @@ class Sale(metaclass=PoolMeta): selector = {p.id: p.name for p in selector_periods} description = currency.code - value = cls._get_sales_in_period(period, currency_id, in_thousands=True) + value = cls._get_sales_in_period( + period, currency_id, in_thousands=True) res = { 'value': value, @@ -398,7 +389,6 @@ class Sale(metaclass=PoolMeta): values = [] labels = [] - report = args.get('report', None) for p in periods: val = cls._get_sales_in_period(p, currency_id, True) if val > 0: @@ -468,9 +458,9 @@ class AppOrderViewer(DashAppBase): class AppSaleOrder(DashAppBase): 'App Sale Order' __name__ = 'dash.app.sale_order' - allow_discount = fields.Boolean('Allow Discount') - allow_manual_pricing = fields.Boolean('Allow Manual Pricing', help='Allow manual pricing to user') + allow_manual_pricing = fields.Boolean('Allow Manual Pricing', + help='Allow manual pricing to user') class AppSelfServiceSale(DashAppBase): diff --git a/setup.py b/setup.py index 41df57d..70d8b76 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ def get_require_version(name): major_version, minor_version + 1) return require + config = ConfigParser() config.readfp(open('tryton.cfg')) info = dict(config.items('tryton')) diff --git a/tryton.cfg b/tryton.cfg index 4a1896f..8899e3f 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.0.6 +version=6.0.7 depends: party product @@ -11,3 +11,4 @@ depends: dash xml: sale.xml + reports.xml diff --git a/view/party_form.xml b/view/party_form.xml deleted file mode 100644 index f565219..0000000 --- a/view/party_form.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - -