Minor fix
This commit is contained in:
parent
b2046aff89
commit
69ed78c861
46
sale.py
46
sale.py
|
@ -181,7 +181,6 @@ class Sale(metaclass=PoolMeta):
|
|||
This method mark as commanded all products in sale, previous
|
||||
positive response of local printer
|
||||
"""
|
||||
print(args)
|
||||
sale = cls(args['sale_id'])
|
||||
for line in sale.lines:
|
||||
line.order_sended = True
|
||||
|
@ -329,6 +328,7 @@ class Sale(metaclass=PoolMeta):
|
|||
|
||||
@classmethod
|
||||
def report_sales_month(cls, args, ctx=None):
|
||||
# Dash Report
|
||||
pool = Pool()
|
||||
Period = pool.get('account.period')
|
||||
Currency = pool.get('currency.currency')
|
||||
|
@ -353,34 +353,33 @@ class Sale(metaclass=PoolMeta):
|
|||
currency_id = ctx.get('currency')
|
||||
currency = Currency(currency_id)
|
||||
|
||||
description = currency.code
|
||||
dates = {'period': period}
|
||||
value = cls._get_sales_report(dates, currency_id, in_thousands=True)
|
||||
|
||||
res = {
|
||||
'value': value,
|
||||
'description': description,
|
||||
'selector': selector,
|
||||
'default_option': period.id,
|
||||
'meta': period.name,
|
||||
'in_thousands': True
|
||||
'header_meta': str(TODAY),
|
||||
'desc': 'In thousands',
|
||||
'desc_meta': currency.code,
|
||||
}
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def report_sales_by_month(cls, args, ctx=None):
|
||||
# Dash Report
|
||||
pool = Pool()
|
||||
Fiscalyear = pool.get('account.fiscalyear')
|
||||
Currency = pool.get('currency.currency')
|
||||
|
||||
fiscalyears = Fiscalyear.search([
|
||||
fiscalyear, = Fiscalyear.search([
|
||||
('start_date', '<=', TODAY),
|
||||
('end_date', '>=', TODAY),
|
||||
])
|
||||
if not fiscalyears:
|
||||
], limit=1)
|
||||
if not fiscalyear:
|
||||
return {}
|
||||
|
||||
periods = [p for p in fiscalyears[0].periods if p.type == 'standard']
|
||||
periods = [p for p in fiscalyear.periods if p.type == 'standard']
|
||||
currency_id = Transaction().context.get('currency')
|
||||
if args.get('currency'):
|
||||
currency_id = args.get('currency')
|
||||
|
@ -399,14 +398,15 @@ class Sale(metaclass=PoolMeta):
|
|||
res = {
|
||||
'values': values,
|
||||
'labels': labels,
|
||||
'description': 'report_sales_by_month',
|
||||
'meta': currency.code,
|
||||
'in_thousands': True
|
||||
'header_meta': fiscalyear.name,
|
||||
'desc': 'In thousands',
|
||||
'desc_meta': currency.code,
|
||||
}
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def report_sales_year(cls, args, ctx=None):
|
||||
# Dash Report
|
||||
pool = Pool()
|
||||
Fiscalyear = pool.get('account.fiscalyear')
|
||||
Currency = pool.get('currency.currency')
|
||||
|
@ -442,14 +442,15 @@ class Sale(metaclass=PoolMeta):
|
|||
res = {
|
||||
'value': sum(values),
|
||||
'selector': selector,
|
||||
'description': currency.code,
|
||||
'meta': fiscalyear.name,
|
||||
'in_thousands': True
|
||||
'header_meta': str(TODAY),
|
||||
'desc': 'In thousands',
|
||||
'desc_meta': currency.code,
|
||||
}
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def report_sales_day(cls, args, ctx=None):
|
||||
# Dash Report
|
||||
pool = Pool()
|
||||
Currency = pool.get('currency.currency')
|
||||
|
||||
|
@ -469,9 +470,9 @@ class Sale(metaclass=PoolMeta):
|
|||
res = {
|
||||
'value': values,
|
||||
'selector': selector,
|
||||
'description': currency.code,
|
||||
'meta': str(TODAY),
|
||||
'in_thousands': True
|
||||
'header_meta': str(TODAY),
|
||||
'desc': 'In thousands',
|
||||
'desc_meta': currency.code,
|
||||
}
|
||||
return res
|
||||
|
||||
|
@ -507,13 +508,12 @@ class Sale(metaclass=PoolMeta):
|
|||
sum_values = sum(values)
|
||||
goal = 520000
|
||||
missing = goal - sum_values
|
||||
goal_rate = int(sum_values / goal)
|
||||
goal_rate = int((sum_values / goal) * 100)
|
||||
res = {
|
||||
'labels': ["Sales", "Missing"],
|
||||
'values': [sum(values), missing],
|
||||
'goal': goal_rate,
|
||||
'meta': fiscalyear.name,
|
||||
'in_thousands': True
|
||||
'center_label': str(goal_rate) + '%',
|
||||
'header_meta': fiscalyear.name,
|
||||
}
|
||||
return res
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.8
|
||||
version=6.0.9
|
||||
depends:
|
||||
party
|
||||
product
|
||||
|
|
Loading…
Reference in New Issue