About `Movement_isQuantityEditable` and `Movement_isQuantityEnabled` scripts
This is a half-serious MR about these Movement_isQuantityEditable
and Movement_isQuantityEnabled
scripts, which is more about asking questions, maybe none of it should get merged, or maybe just parts, I do not know. My main concerns are :
- why is
Movement_isQuantityEditable
checking for items? Quantity set by the quantity of items seems to have been invented for this script. To me, if I have a thread of electrical wire of 10 meters, and you use 22 cm of it for each ORS you produce, then the thread item is to be put on multiple ORS Manufacturing Execution Lines, without altering the quantity of these lines. - if it really should check for items, why then is is not checking for required items, because items are supposed to be optional by default; except otherwise defined on the product;
- then, once you have removed this constraint of items, why are there two different scripts for editable and enabled? There remains the difference of
omit_optional_variation=1
in editable, and the exclusion of Cells (ie. quantity is always editable on Cells, but not always enabled), which both look like what we also want in enabled; - why is there another script in
erp5_advanced_trade
? This one is not checking for cells, which seems wrong: I should not be able to edit the quantity of swimsuits if I already know that I sold 2 blue ones and 3 green ones, making a total of 5. Except if we allow mixing variated and unvariated products on the same line, but I'm quite sure it is supported nowhere.
As-is, the MR assumes no reason for any of the above, and:
- deletes both scripts from advanced trade;
- renames
Movement_isQuantityEditable
toMovement_isQuantityEnabled
, and use the latter everywhere; - removes item constraint from the script.
Will fix tests if any is failing, and we want to merge at least some parts. What’s for sure is that I have modified the script on Nexedi ERP5 and will again, so there’s at least one projet where the current behavior doesn’t fit.