[fix] Repost only distinct purchase receipts and invoices
This commit is contained in:
parent
e4fb7b1b2f
commit
3b6dc141c6
@ -204,10 +204,10 @@ class StockController(AccountsController):
|
||||
from erpnext.stock.stock_ledger import make_sl_entries
|
||||
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
|
||||
|
||||
def make_gl_entries_on_cancel(self):
|
||||
def make_gl_entries_on_cancel(self, repost_future_gle=True):
|
||||
if frappe.db.sql("""select name from `tabGL Entry` where voucher_type=%s
|
||||
and voucher_no=%s""", (self.doctype, self.name)):
|
||||
self.make_gl_entries()
|
||||
self.make_gl_entries(repost_future_gle)
|
||||
|
||||
def get_serialized_items(self):
|
||||
serialized_items = []
|
||||
|
@ -84,7 +84,7 @@ class LandedCostVoucher(Document):
|
||||
self.update_landed_cost()
|
||||
|
||||
def update_landed_cost(self):
|
||||
for d in self.get("items"):
|
||||
for d in self.get("purchase_receipts"):
|
||||
doc = frappe.get_doc(d.receipt_document_type, d.receipt_document)
|
||||
|
||||
# set landed cost voucher amount in pr item
|
||||
@ -103,7 +103,7 @@ class LandedCostVoucher(Document):
|
||||
# update stock & gl entries for cancelled state of PR
|
||||
doc.docstatus = 2
|
||||
doc.update_stock_ledger(allow_negative_stock=True, via_landed_cost_voucher=True)
|
||||
doc.make_gl_entries_on_cancel()
|
||||
doc.make_gl_entries_on_cancel(repost_future_gle=False)
|
||||
|
||||
|
||||
# update stock & gl entries for submit state of PR
|
||||
|
Loading…
Reference in New Issue
Block a user