Commit 0a6664a2 authored by Nicolas Wavrant's avatar Nicolas Wavrant

fxup! erp5_pdm: support calculation of base_price applying to all items of a same slice

parent fb899455
supply_line = state_change['object']
# Currently state_change.kwargs['workflow_method_args'] contains
# a list of string, so this script is called every time.
# As it is not the intent, let's return early if nothing changes
if [float(x) for x in sorted(state_change.kwargs['workflow_method_args'][0], key=lambda x: float(x))] == sorted(supply_line.getQuantityStepList()):
return
if supply_line.isBasePricePerSlice():
price_parameter = 'slice_base_price'
else:
......
supply_line = state_change['object']
base_id = 'path'
supply_line.updateCellSliceParameterList(base_id=base_id)
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.updateCellRange(base_id='path')
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