mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 15:12:51 +00:00
fix: incorrect gl entries for standalone debit note with update stock
This commit is contained in:
@@ -26,6 +26,8 @@ class BuyingController(SubcontractingController):
|
|||||||
self.flags.ignore_permlevel_for_fields = ["buying_price_list", "price_list_currency"]
|
self.flags.ignore_permlevel_for_fields = ["buying_price_list", "price_list_currency"]
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
self.set_rate_for_standalone_debit_note()
|
||||||
|
|
||||||
super(BuyingController, self).validate()
|
super(BuyingController, self).validate()
|
||||||
if getattr(self, "supplier", None) and not self.supplier_name:
|
if getattr(self, "supplier", None) and not self.supplier_name:
|
||||||
self.supplier_name = frappe.db.get_value("Supplier", self.supplier, "supplier_name")
|
self.supplier_name = frappe.db.get_value("Supplier", self.supplier, "supplier_name")
|
||||||
@@ -100,6 +102,28 @@ class BuyingController(SubcontractingController):
|
|||||||
do_not_submit=True,
|
do_not_submit=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def set_rate_for_standalone_debit_note(self):
|
||||||
|
if self.get("is_return") and self.get("update_stock") and not self.return_against:
|
||||||
|
for row in self.items:
|
||||||
|
row.rate = get_incoming_rate(
|
||||||
|
{
|
||||||
|
"item_code": row.item_code,
|
||||||
|
"warehouse": row.warehouse,
|
||||||
|
"posting_date": self.get("posting_date"),
|
||||||
|
"posting_time": self.get("posting_time"),
|
||||||
|
"qty": row.qty,
|
||||||
|
"serial_and_batch_bundle": row.get("serial_and_batch_bundle"),
|
||||||
|
"company": self.company,
|
||||||
|
"voucher_type": self.doctype,
|
||||||
|
"voucher_no": self.name,
|
||||||
|
},
|
||||||
|
raise_error_if_no_rate=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
row.discount_percentage = 0.0
|
||||||
|
row.discount_amount = 0.0
|
||||||
|
row.margin_rate_or_amount = 0.0
|
||||||
|
|
||||||
def set_missing_values(self, for_validate=False):
|
def set_missing_values(self, for_validate=False):
|
||||||
super(BuyingController, self).set_missing_values(for_validate)
|
super(BuyingController, self).set_missing_values(for_validate)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user