Add Warning.check() to UserWarning.
This commit is contained in:
parent
066c77501e
commit
78146822a5
6
plan.py
6
plan.py
|
@ -204,7 +204,9 @@ class Plan(ModelSQL, ModelView):
|
|||
('plan', 'in', [p.id for p in plans]),
|
||||
])
|
||||
if product_lines:
|
||||
UserWarning('remove_product_lines',
|
||||
key = 'task_product_lines_will_be_removed.%d' % product_lines[0].id
|
||||
if Warning.check(key):
|
||||
raise UserWarning('remove_product_lines',
|
||||
gettext('product_cost_plan.product_lines_will_be_removed'))
|
||||
ProductLine.delete(product_lines)
|
||||
|
||||
|
@ -739,6 +741,8 @@ class PlanCost(ModelSQL, ModelView):
|
|||
if not Transaction().context.get('reset_costs', False):
|
||||
for cost in costs:
|
||||
if cost.system:
|
||||
key = 'task_delete_system_cost.%d' % cost.id
|
||||
if Warning.check(key):
|
||||
raise UserWarning('delete_system_cost',
|
||||
gettext('product_cost_plan.delete_system_cost',
|
||||
cost=cost.rec_name,
|
||||
|
|
Loading…
Reference in New Issue