def make_gl_entries(self, repost_future_gle=True): gl_entries = self.get_gl_entries() if gl_entries: from accounts.general_ledger import make_gl_entries update_outstanding = cint(self.doc.is_pos) and self.doc.write_off_account \ and 'No' or 'Yes' make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2), update_outstanding=update_outstanding, merge_entries=False) if update_outstanding == "No": from accounts.doctype.gl_entry.gl_entry import update_outstanding_amt update_outstanding_amt(self.doc.debit_to, self.doc.doctype, self.doc.name) if repost_future_gle and cint(self.doc.update_stock) \ and cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")): items, warehouse_account = self.get_items_and_warehouse_accounts( ) from controllers.stock_controller import update_gl_entries_after update_gl_entries_after(self.doc.posting_date, self.doc.posting_time, warehouse_account, items)
def execute(): import webnotes from controllers.stock_controller import update_gl_entries_after webnotes.conn.auto_commit_on_many_writes = 1 for_items = webnotes.conn.sql_list("""select distinct sle.item_code from `tabStock Ledger Entry` sle where (select has_serial_no from tabItem where name=sle.item_code)='Yes'""") try: update_gl_entries_after("2013-08-01", "10:00", for_items=for_items) except: pass webnotes.conn.auto_commit_on_many_writes = 0
def make_gl_entries(self, repost_future_gle=True): gl_entries = self.get_gl_entries() if gl_entries: from accounts.general_ledger import make_gl_entries update_outstanding = cint(self.doc.is_pos) and self.doc.write_off_account \ and 'No' or 'Yes' make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2), update_outstanding=update_outstanding, merge_entries=False) if update_outstanding == "No": from accounts.doctype.gl_entry.gl_entry import update_outstanding_amt update_outstanding_amt(self.doc.debit_to, self.doc.doctype, self.doc.name) if repost_future_gle and cint(self.doc.update_stock) \ and cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")): items, warehouse_account = self.get_items_and_warehouse_accounts() from controllers.stock_controller import update_gl_entries_after update_gl_entries_after(self.doc.posting_date, self.doc.posting_time, warehouse_account, items)