fix: reposting patch fixes (#24775)
This commit is contained in:
parent
f45756d821
commit
bd10d7c028
@ -1,13 +1,24 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import getdate, get_time
|
from frappe.utils import getdate, get_time, today
|
||||||
from erpnext.stock.stock_ledger import update_entries_after
|
from erpnext.stock.stock_ledger import update_entries_after
|
||||||
from erpnext.accounts.utils import update_gl_entries_after
|
from erpnext.accounts.utils import update_gl_entries_after
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc('stock', 'doctype', 'repost_item_valuation')
|
for doctype in ('repost_item_valuation', 'stock_entry_detail', 'purchase_receipt_item',
|
||||||
|
'purchase_invoice_item', 'delivery_note_item', 'sales_invoice_item', 'packed_item'):
|
||||||
|
frappe.reload_doc('stock', 'doctype', doctype)
|
||||||
|
frappe.reload_doc('buying', 'doctype', 'purchase_receipt_item_supplied')
|
||||||
|
|
||||||
reposting_project_deployed_on = get_creation_time()
|
reposting_project_deployed_on = get_creation_time()
|
||||||
|
posting_date = getdate(reposting_project_deployed_on)
|
||||||
|
posting_time = get_time(reposting_project_deployed_on)
|
||||||
|
|
||||||
|
if posting_date == today():
|
||||||
|
return
|
||||||
|
|
||||||
|
frappe.clear_cache()
|
||||||
|
frappe.flags.warehouse_account_map = {}
|
||||||
|
|
||||||
data = frappe.db.sql('''
|
data = frappe.db.sql('''
|
||||||
SELECT
|
SELECT
|
||||||
@ -41,8 +52,6 @@ def execute():
|
|||||||
|
|
||||||
|
|
||||||
print("Reposting General Ledger Entries...")
|
print("Reposting General Ledger Entries...")
|
||||||
posting_date = getdate(reposting_project_deployed_on)
|
|
||||||
posting_time = get_time(reposting_project_deployed_on)
|
|
||||||
|
|
||||||
for row in frappe.get_all('Company', filters= {'enable_perpetual_inventory': 1}):
|
for row in frappe.get_all('Company', filters= {'enable_perpetual_inventory': 1}):
|
||||||
update_gl_entries_after(posting_date, posting_time, company=row.name)
|
update_gl_entries_after(posting_date, posting_time, company=row.name)
|
||||||
|
@ -324,10 +324,12 @@ class PurchaseReceipt(BuyingController):
|
|||||||
else:
|
else:
|
||||||
loss_account = self.get_company_default("default_expense_account")
|
loss_account = self.get_company_default("default_expense_account")
|
||||||
|
|
||||||
|
cost_center = d.cost_center or frappe.get_cached_value("Company", self.company, "cost_center")
|
||||||
|
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": loss_account,
|
"account": loss_account,
|
||||||
"against": warehouse_account[d.warehouse]["account"],
|
"against": warehouse_account[d.warehouse]["account"],
|
||||||
"cost_center": d.cost_center,
|
"cost_center": cost_center,
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||||
"debit": divisional_loss,
|
"debit": divisional_loss,
|
||||||
"project": d.project
|
"project": d.project
|
||||||
|
Loading…
x
Reference in New Issue
Block a user