fix: default value for allow neg stock in repost_item_valuation

Negative stock can be toggled back after queuing transactions, this
causes failure when repost is executed.

Now allow_negative_stock stock is set at time of queuing the repost job.
This means setting changes done afterwards won't affect already
submitted reposts.

(cherry picked from commit 12e81df2b7)
This commit is contained in:
Ankush Menat
2021-11-10 12:36:00 +05:30
committed by Ankush Menat
parent a40b21cd20
commit 5f29cd8685

View File

@@ -33,6 +33,9 @@ class RepostItemValuation(Document):
self.voucher_type = None
self.voucher_no = None
self.allow_negative_stock = self.allow_negative_stock or \
cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock"))
def set_company(self):
if self.voucher_type and self.voucher_no:
self.company = frappe.get_cached_value(self.voucher_type, self.voucher_no, "company")