Commit ec926ea5 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_pdm: It is never the good solution to delete matrix cells directly.

This breaks matrix index consistency.
Also, call isBasePricePerSlice rather than introspecting wrapped method
arguments - the only wrapped method is _setBasePricePerSlice anyway !
Also, trigger SupplyCell_updateSliceBasePrice as it depends on
isBasePricePerSlice value on this line, and it just changed, and that
workflow does not trigger on line changes (which is a bug).
Also, get rid of a trivial local variable.
parent ebfad4b1
supply_line = state_change['object']
to_delete_cell_list = [
cell for cell in supply_line.getCellIdList(base_id='path')
if hasattr(supply_line, cell)
]
supply_line.manage_delObjects(ids=to_delete_cell_list)
if state_change.kwargs['workflow_method_args'][0]:
price_parameter = 'slice_base_price'
else:
price_parameter = 'base_price'
supply_line.updateQuantityPredicate(price_parameter)
supply_line.updateQuantityPredicate(
'slice_base_price'
if supply_line.isBasePricePerSlice() else
'base_price'
)
supply_line.updateCellRange(base_id='path')
for cell_value in supply_line.getCellValueList(base_id='path'):
# XXX: only to trigger supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice
cell_value.setBasePrice(cell_value.getBasePrice())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment