fix: do not validate batch qty for LCV

This commit is contained in:
Rohit Waghchaure
2024-04-12 11:25:34 +05:30
parent 140fdd4a7e
commit baf0c83cc5
4 changed files with 220 additions and 4 deletions

View File

@@ -1119,7 +1119,7 @@ class StockController(AccountsController):
message += _("Please adjust the qty or edit {0} to proceed.").format(rule_link)
return message
def repost_future_sle_and_gle(self, force=False):
def repost_future_sle_and_gle(self, force=False, via_landed_cost_voucher=False):
args = frappe._dict(
{
"posting_date": self.posting_date,
@@ -1127,6 +1127,7 @@ class StockController(AccountsController):
"voucher_type": self.doctype,
"voucher_no": self.name,
"company": self.company,
"via_landed_cost_voucher": via_landed_cost_voucher,
}
)
@@ -1138,7 +1139,11 @@ class StockController(AccountsController):
frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting")
)
if item_based_reposting:
create_item_wise_repost_entries(voucher_type=self.doctype, voucher_no=self.name)
create_item_wise_repost_entries(
voucher_type=self.doctype,
voucher_no=self.name,
via_landed_cost_voucher=via_landed_cost_voucher,
)
else:
create_repost_item_valuation_entry(args)
@@ -1510,11 +1515,14 @@ def create_repost_item_valuation_entry(args):
repost_entry.allow_zero_rate = args.allow_zero_rate
repost_entry.flags.ignore_links = True
repost_entry.flags.ignore_permissions = True
repost_entry.via_landed_cost_voucher = args.via_landed_cost_voucher
repost_entry.save()
repost_entry.submit()
def create_item_wise_repost_entries(voucher_type, voucher_no, allow_zero_rate=False):
def create_item_wise_repost_entries(
voucher_type, voucher_no, allow_zero_rate=False, via_landed_cost_voucher=False
):
"""Using a voucher create repost item valuation records for all item-warehouse pairs."""
stock_ledger_entries = get_items_to_be_repost(voucher_type, voucher_no)
@@ -1538,6 +1546,7 @@ def create_item_wise_repost_entries(voucher_type, voucher_no, allow_zero_rate=Fa
repost_entry.allow_zero_rate = allow_zero_rate
repost_entry.flags.ignore_links = True
repost_entry.flags.ignore_permissions = True
repost_entry.via_landed_cost_voucher = via_landed_cost_voucher
repost_entry.submit()
repost_entries.append(repost_entry)