fix: assign duplicate_items_msg outside conditional (#31639)
duplicate_items_msg was defined inside if the statement of stock_item so when duplicate was found in non_stock_item it raised referenced before assignment
(cherry picked from commit 8e23c6ad69dee213f0252d2b231317490fab760f)
Co-authored-by: Maharshi Patel <39730881+maharshivpatel@users.noreply.github.com>
- PIs for petty items (that do not need an Item record) are allowed using Item Name field
- If a different UOM is used in this case, conversion factor stays 0 and causes an error
- Fallback to 1 in `set_incoming_rate` for buying
- Selling will need a proper item, so this change is not needed there
Currently on PO update RM item table is auto computed again and again,
if there was any transfer/consumption against that then it will be lost.
This change:
1. Disables updating RM table if no change in qty of FG was made. Since
RM table can't possibly be different with same FG qty.
2. Blocks update completely if qty is changed and RM items are already
transferred.
* refactor: if() to CASE WHEN
* fix: remove duplicate order by
* fix: remove extraneous table
* style: reformat to black spec
Co-authored-by: Ankush Menat <ankush@frappe.io>
* 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>
If invoice is made without item code then UOM, Stock UOM and
conversion_factor all need to be manually added, this is confusing and
leads missing them out leads to errors.
Simplest solution:
- if either UOM exists then set both to same uom conversion factor to
- also set conversion factor based on UOM conversions