* refactor: DB independent quoting and truthy/falsy values
* style: reformat to black spec
* fix: ifnull -> coalesce
* fix: coalesce -> Coalesce
* fix: revert pypika comparison
* refactor: convert queries to QB
* fix: incorrect value types for query
`=` query makes no sense with list of values
* fix: remove warehouse docstatus condition
* fix: keep using base rate as rate
Co-authored-by: Ankush Menat <ankush@frappe.io>
- Use `get_default_bom` in sales_order.py (reduce duplicate utility functions)
- Remove redundant if else in `get_work_order_items`
- `get_default_bom`: If no BOM and template exists try to fetch template BOM
- test: `get_work_order_items` via SO and if right BOM is picked
* fix: Auto Insert Item Price If Missing when discount and blank UOM
fixes wrong item price insert when discount is used and adds uom=stock_uom instead of blank as price is converted to stock uom
* unit tests added for item with discount
I have added test for auto_insert_price where discount is used.
* unit test issue fixed
fixed make_sales_order as some of the test that depended on it were failing due to passing of incorrect parameters.
Co-authored-by: Ankush Menat <me@ankush.dev>
* fix: auto update price list rate
* fix: hide field when auto insert isn't enabled
(cherry picked from commit bb3957eba35a5204a1a01e412dee596532bd525e)
Co-authored-by: Sagar Sharma <63660334+s-aga-r@users.noreply.github.com>
[skip ci]
* fix: price list with 0 value are ignored
Steps to reproduce:
1. Create 2 item price for two different supplier. One of them should be
zero.
2. Create PO
3. Add supplier with non-zero price and add item.
4. change supplier. Price won't change. If price was non-zero it
would've changed.
Root cause: falsiness check instead of null value check is used for
checking if price list value exists. 0 is evaluated as false.
* refactor: make get_price_list_rate function pure
* fix: Assign Item's default weight_per_unit as its weight_per_unit in get_item_details
* fix: Set weight_uom in get_item_details as Item's default weight_uom