Fix
This commit is contained in:
parent
4636aa4490
commit
6f2ea1ba21
|
@ -3,7 +3,6 @@
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from . import sale
|
from . import sale
|
||||||
from . import dash
|
from . import dash
|
||||||
from . import product
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
@ -15,5 +14,4 @@ def register():
|
||||||
sale.AppOrderViewer,
|
sale.AppOrderViewer,
|
||||||
sale.AppSelfServiceSale,
|
sale.AppSelfServiceSale,
|
||||||
dash.DashApp,
|
dash.DashApp,
|
||||||
# product.Product,
|
|
||||||
module='dash_sale', type_='model')
|
module='dash_sale', type_='model')
|
||||||
|
|
12
product.py
12
product.py
|
@ -1,17 +1,9 @@
|
||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from decimal import Decimal
|
from trytond.model import fields
|
||||||
from datetime import date
|
from trytond.pool import PoolMeta
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
class Product(metaclass=PoolMeta):
|
class Product(metaclass=PoolMeta):
|
||||||
__name__ = 'product.product'
|
__name__ = 'product.product'
|
||||||
short_name = fields.Char('Short Name')
|
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
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?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="dash.report" id="dash_report_sales_month">
|
||||||
|
<field name="name">Sales Month</field>
|
||||||
|
<field name="model">sale.sale</field>
|
||||||
|
<field name="type">card_info</field>
|
||||||
|
<field name="method">report_sales_month</field>
|
||||||
|
<field name="in_thousands">True</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="dash.report" id="dash_report_sales_by_month">
|
||||||
|
<field name="name">Sales By Month</field>
|
||||||
|
<field name="model">sale.sale</field>
|
||||||
|
<field name="type">bar</field>
|
||||||
|
<field name="method">report_sales_by_month</field>
|
||||||
|
<field name="in_thousands">True</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</tryton>
|
22
sale.py
22
sale.py
|
@ -8,18 +8,13 @@ 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
|
from trytond.model import fields
|
||||||
from trytond.modules.dash.dash import DashAppBase
|
from trytond.modules.dash.dash import DashAppBase
|
||||||
|
|
||||||
|
|
||||||
class Sale(metaclass=PoolMeta):
|
class Sale(metaclass=PoolMeta):
|
||||||
__name__ = 'sale.sale'
|
__name__ = 'sale.sale'
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __setup__(cls):
|
|
||||||
super(Sale, cls).__setup__()
|
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def dash_faster_process(cls, records):
|
def dash_faster_process(cls, records):
|
||||||
for rec in records:
|
for rec in records:
|
||||||
|
@ -213,9 +208,6 @@ class Sale(metaclass=PoolMeta):
|
||||||
def command(cls, args):
|
def command(cls, args):
|
||||||
Shop = Pool().get('sale.shop')
|
Shop = Pool().get('sale.shop')
|
||||||
ShopTable = Pool().get('sale.shop.table')
|
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')
|
User = Pool().get('res.user')
|
||||||
context = Transaction().context
|
context = Transaction().context
|
||||||
today = date.today()
|
today = date.today()
|
||||||
|
@ -242,7 +234,7 @@ class Sale(metaclass=PoolMeta):
|
||||||
to_create = {
|
to_create = {
|
||||||
'shop': shop.id,
|
'shop': shop.id,
|
||||||
'party': party.id,
|
'party': party.id,
|
||||||
'invoice_type':'P',
|
'invoice_type': 'P',
|
||||||
'table_assigned': args['table_assigned']['id'],
|
'table_assigned': args['table_assigned']['id'],
|
||||||
'shipment_address': party.addresses[0].id,
|
'shipment_address': party.addresses[0].id,
|
||||||
'invoice_address': party.addresses[0].id,
|
'invoice_address': party.addresses[0].id,
|
||||||
|
@ -298,7 +290,6 @@ class Sale(metaclass=PoolMeta):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, 'error')
|
print(e, 'error')
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def report_sales_day(cls, args, ctx):
|
def report_sales_day(cls, args, ctx):
|
||||||
pass
|
pass
|
||||||
|
@ -346,7 +337,6 @@ class Sale(metaclass=PoolMeta):
|
||||||
if not periods:
|
if not periods:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
report = args.get('report', None)
|
|
||||||
period = periods[0]
|
period = periods[0]
|
||||||
selector_periods = Period.search([
|
selector_periods = Period.search([
|
||||||
('fiscalyear', '=', period.fiscalyear.id),
|
('fiscalyear', '=', period.fiscalyear.id),
|
||||||
|
@ -362,7 +352,8 @@ class Sale(metaclass=PoolMeta):
|
||||||
selector = {p.id: p.name for p in selector_periods}
|
selector = {p.id: p.name for p in selector_periods}
|
||||||
|
|
||||||
description = currency.code
|
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 = {
|
res = {
|
||||||
'value': value,
|
'value': value,
|
||||||
|
@ -398,7 +389,6 @@ class Sale(metaclass=PoolMeta):
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
labels = []
|
labels = []
|
||||||
report = args.get('report', None)
|
|
||||||
for p in periods:
|
for p in periods:
|
||||||
val = cls._get_sales_in_period(p, currency_id, True)
|
val = cls._get_sales_in_period(p, currency_id, True)
|
||||||
if val > 0:
|
if val > 0:
|
||||||
|
@ -468,9 +458,9 @@ class AppOrderViewer(DashAppBase):
|
||||||
class AppSaleOrder(DashAppBase):
|
class AppSaleOrder(DashAppBase):
|
||||||
'App Sale Order'
|
'App Sale Order'
|
||||||
__name__ = 'dash.app.sale_order'
|
__name__ = 'dash.app.sale_order'
|
||||||
|
|
||||||
allow_discount = fields.Boolean('Allow Discount')
|
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):
|
class AppSelfServiceSale(DashAppBase):
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -28,6 +28,7 @@ def get_require_version(name):
|
||||||
major_version, minor_version + 1)
|
major_version, minor_version + 1)
|
||||||
return require
|
return require
|
||||||
|
|
||||||
|
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.readfp(open('tryton.cfg'))
|
config.readfp(open('tryton.cfg'))
|
||||||
info = dict(config.items('tryton'))
|
info = dict(config.items('tryton'))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=6.0.6
|
version=6.0.7
|
||||||
depends:
|
depends:
|
||||||
party
|
party
|
||||||
product
|
product
|
||||||
|
@ -11,3 +11,4 @@ depends:
|
||||||
dash
|
dash
|
||||||
xml:
|
xml:
|
||||||
sale.xml
|
sale.xml
|
||||||
|
reports.xml
|
||||||
|
|
|
@ -1,19 +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. -->
|
|
||||||
<data>
|
|
||||||
<xpath
|
|
||||||
expr="/form/notebook/page[@id='sale']/field[@name='sale_price_list']"
|
|
||||||
position="after">
|
|
||||||
<!-- remove temporaly fix me -->
|
|
||||||
<!-- <label name="zone"/>
|
|
||||||
<field name="zone"/> -->
|
|
||||||
</xpath>
|
|
||||||
|
|
||||||
<xpath
|
|
||||||
expr="/form/notebook/page[@id='sale']/field[@name='sale_price_list']"
|
|
||||||
position="after">
|
|
||||||
<label name="agent"/>
|
|
||||||
<field name="agent"/>
|
|
||||||
</xpath>
|
|
||||||
</data>
|
|
Loading…
Reference in New Issue