Minor fix
This commit is contained in:
parent
98e5413fb6
commit
ce9d8d84df
18
sale.py
18
sale.py
|
@ -492,6 +492,7 @@ class Sale(metaclass=PoolMeta):
|
|||
def report_fulfillment_goal_year(cls, args, ctx=None):
|
||||
pool = Pool()
|
||||
Fiscalyear = pool.get('account.fiscalyear')
|
||||
Goal = pool.get('goal')
|
||||
# Currency = pool.get('currency.currency')
|
||||
today = date.today()
|
||||
fiscalyear, = Fiscalyear.search([
|
||||
|
@ -518,9 +519,20 @@ class Sale(metaclass=PoolMeta):
|
|||
values.append(val)
|
||||
|
||||
sum_values = sum(values)
|
||||
goal = 520000
|
||||
missing = goal - sum_values
|
||||
goal_rate = int((sum_values / goal) * 100)
|
||||
print(' fiscalyear.id ...', fiscalyear.id)
|
||||
goals = Goal.search([
|
||||
('fiscalyear', '=', fiscalyear.id),
|
||||
('type_', '=', 'sales'),
|
||||
], limit=1)
|
||||
if not goals:
|
||||
goal_rate = 0
|
||||
missing = 0
|
||||
else:
|
||||
goal = goals[0].total_amount / 1000
|
||||
missing = goal - sum_values
|
||||
goal_rate = int((sum_values / goal) * 100)
|
||||
|
||||
print('============', goals, goal_rate, missing)
|
||||
res = {
|
||||
'labels': ["Sales", "Missing"],
|
||||
'values': [sum(values), missing],
|
||||
|
|
Loading…
Reference in New Issue