mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
feat: Inter warehouse stock transfer on valuation rate with taxation (#20083)
* fix: Validation for target warehouse * feat: Get items on valuation rate in delivery note on Internal transfers * fix: Create Inter company purchase receipt from delivery note * feat: Inter company stock transfer on valuation rate with taxation * fix: Add from warehouse in purchase invoice * fix: Use get_value instead of get_cached_value * fix: Get incoming rate instead of valuation rate * fix: GL entry for from warehouse in purchase receipt * fix: GL Entries fixes in purchase invoice * fix: Address and tax fetching fixes * fix: Add test case for stock transfer via purchase receipt * fix: Code cleanup, added validations and test cases * fix: Validation for supplier warehouse * fix: Test Cases * fix: Change validation condition * fix: Address fixes while creating Purchase Receipt from delivery note * fix: Set taxes while creating Purchase Receipt from Delivery Note * fix: Update set_missing_value function Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -43,6 +43,7 @@ class BuyingController(StockController):
|
||||
self.set_qty_as_per_stock_uom()
|
||||
self.validate_stock_or_nonstock_items()
|
||||
self.validate_warehouse()
|
||||
self.validate_from_warehouse()
|
||||
self.set_supplier_address()
|
||||
|
||||
if self.doctype=="Purchase Invoice":
|
||||
@@ -115,6 +116,14 @@ class BuyingController(StockController):
|
||||
if not d.cost_center and lc_voucher_data and lc_voucher_data[0][1]:
|
||||
d.db_set('cost_center', lc_voucher_data[0][1])
|
||||
|
||||
def validate_from_warehouse(self):
|
||||
for item in self.get('items'):
|
||||
if item.get('from_warehouse') and (item.get('from_warehouse') == item.get('warehouse')):
|
||||
frappe.throw(_("Row #{0}: Accepted Warehouse and Supplier Warehouse cannot be same").format(item.idx))
|
||||
|
||||
if item.get('from_warehouse') and self.get('is_subcontracted') == 'Yes':
|
||||
frappe.throw(_("Row #{0}: Cannot select Supplier Warehouse while suppling raw materials to subcontractor").format(item.idx))
|
||||
|
||||
def set_supplier_address(self):
|
||||
address_dict = {
|
||||
'supplier_address': 'address_display',
|
||||
@@ -521,6 +530,16 @@ class BuyingController(StockController):
|
||||
pr_qty = flt(d.qty) * flt(d.conversion_factor)
|
||||
|
||||
if pr_qty:
|
||||
|
||||
if d.from_warehouse and ((not cint(self.is_return) and self.docstatus==1)
|
||||
or (cint(self.is_return) and self.docstatus==2)):
|
||||
from_warehouse_sle = self.get_sl_entries(d, {
|
||||
"actual_qty": -1 * pr_qty,
|
||||
"warehouse": d.from_warehouse
|
||||
})
|
||||
|
||||
sl_entries.append(from_warehouse_sle)
|
||||
|
||||
sle = self.get_sl_entries(d, {
|
||||
"actual_qty": flt(pr_qty),
|
||||
"serial_no": cstr(d.serial_no).strip()
|
||||
@@ -541,6 +560,15 @@ class BuyingController(StockController):
|
||||
})
|
||||
sl_entries.append(sle)
|
||||
|
||||
if d.from_warehouse and ((not cint(self.is_return) and self.docstatus==2)
|
||||
or (cint(self.is_return) and self.docstatus==1)):
|
||||
from_warehouse_sle = self.get_sl_entries(d, {
|
||||
"actual_qty": -1 * pr_qty,
|
||||
"warehouse": d.from_warehouse
|
||||
})
|
||||
|
||||
sl_entries.append(from_warehouse_sle)
|
||||
|
||||
if flt(d.rejected_qty) != 0:
|
||||
sl_entries.append(self.get_sl_entries(d, {
|
||||
"warehouse": d.rejected_warehouse,
|
||||
|
||||
Reference in New Issue
Block a user