def make_item_gl_entries(self, gl_entries): # income account gl entries for item in self.get("items"): if flt(item.base_net_amount): if item.is_fixed_asset: asset = frappe.get_doc("Asset", item.asset) fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount) for gle in fixed_asset_gl_entries: gle["against"] = self.customer gl_entries.append(self.get_gl_dict(gle)) asset.db_set("disposal_date", self.posting_date) asset.set_status("Sold" if self.docstatus==1 else None) else: account_currency = get_account_currency(item.income_account) gl_entries.append( self.get_gl_dict({ "account": item.income_account, "against": self.customer, "credit": item.base_net_amount, "credit_in_account_currency": item.base_net_amount \ if account_currency==self.company_currency else item.net_amount, "cost_center": item.cost_center }, account_currency) ) # expense account gl entries if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \ and cint(self.update_stock): gl_entries += super(SalesInvoice, self).get_gl_entries()
def make_item_gl_entries(self, gl_entries): # income account gl entries for item in self.get("items"): if flt(item.base_net_amount): if item.is_fixed_asset: asset = frappe.get_doc("Asset", item.asset) fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount) for gle in fixed_asset_gl_entries: gle["against"] = self.customer gl_entries.append(self.get_gl_dict(gle)) asset.db_set("disposal_date", self.posting_date) asset.set_status("Sold" if self.docstatus==1 else None) else: account_currency = get_account_currency(item.income_account) gl_entries.append( self.get_gl_dict({ "account": item.income_account, "against": self.customer, "credit": item.base_net_amount, "credit_in_account_currency": item.base_net_amount \ if account_currency==self.company_currency else item.net_amount, "cost_center": item.cost_center, "project": self.project, "support_ticket": self.support_ticket }, account_currency) ) # expense account gl entries if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \ and cint(self.update_stock): gl_entries += super(SalesInvoice, self).get_gl_entries()
def make_item_gl_entries(self, gl_entries): # income account gl entries for item in self.get("items"): if flt(item.base_net_amount): if item.is_fixed_asset: asset = frappe.get_doc("Asset", item.asset) fixed_asset_gl_entries = get_gl_entries_on_asset_disposal( asset, item.base_net_amount) for gle in fixed_asset_gl_entries: gle["against"] = self.customer gl_entries.append(self.get_gl_dict(gle)) asset.db_set("disposal_date", self.posting_date) asset.set_status("Sold" if self.docstatus == 1 else None) else: account_currency = get_account_currency( item.income_account) gl_entries.append( self.get_gl_dict({ "account": item.income_account, "against": self.customer, "credit": item.base_net_amount, "credit_in_account_currency": item.base_net_amount \ if account_currency==self.company_currency else item.net_amount, "cost_center": item.cost_center }, account_currency) ) if item.normal_loss_amt: normal_account = frappe.db.get_value( 'Company', self.company, 'normal_loss_account') account_currency = get_account_currency(normal_account) gl_entries.append( self.get_gl_dict({ "account": normal_account, "against": self.customer, #"party_type": "Customer", #"party": self.customer, "debit": item.normal_loss_amt, "debit_in_account_currency": item.normal_loss_amt \ if account_currency==self.company_currency else (item.normal_loss_amt * self.conversion_rate, self.precision("grand_total")) , "cost_center": item.cost_center, }, account_currency) ) gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "against": self.against_income_account, "party_type": "Customer", "party": self.customer, "credit": item.normal_loss_amt, "credit_in_account_currency": item.normal_loss_amt \ if account_currency==self.company_currency else (item.normal_loss_amt * self.conversion_rate, self.precision("grand_total")) , #"cost_center": item.cost_center "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype }, account_currency) ) if item.abnormal_loss_amt: abnormal_account = frappe.db.get_value( 'Company', self.company, 'abnormal_loss_account') account_currency = get_account_currency( abnormal_account) gl_entries.append( self.get_gl_dict({ "account": abnormal_account, "against": self.customer, #"party_type": "Customer", #"party": self.customer, "debit": item.abnormal_loss_amt, "debit_in_account_currency": item.abnormal_loss_amt \ if account_currency==self.company_currency else (item.abnormal_loss_amt * self.conversion_rate, self.precision("grand_total")) , "cost_center": item.cost_center, }, account_currency) ) gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "against": self.against_income_account, "party_type": "Customer", "party": self.customer, "credit": item.abnormal_loss_amt, "credit_in_account_currency": item.abnormal_loss_amt \ if account_currency==self.company_currency else (item.abnormal_loss_amt * self.conversion_rate, self.precision("grand_total")) , #"cost_center": item.cost_center "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype }, account_currency) ) if item.excess_qty: excess_account = item.income_account excess_amount = flt(item.excess_qty) * flt(item.rate) remark = "Excess Amount due to weight difference by " + str( item.excess_qty) + "MT", account_currency = get_account_currency(excess_account) gl_entries.append( self.get_gl_dict({ "account": excess_account, "against": self.customer, #"party_type": "Customer", #"party": self.customer, "credit": excess_amount, "credit_in_account_currency": excess_amount \ if account_currency==self.company_currency else (excess_amount * self.conversion_rate, self.precision("grand_total")) , "cost_center": item.cost_center, "remark": remark, "remarks": remark, }, account_currency) ) gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "party_type": "Customer", "party": self.customer, "debit": excess_amount, "debit_in_account_currency": excess_amount \ if account_currency==self.company_currency else (excess_amount * self.conversion_rate, self.precision("grand_total")) , "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype, "remark": remark, "remarks": remark, }, account_currency) ) # expense account gl entries if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \ and cint(self.update_stock): gl_entries += super(SalesInvoice, self).get_gl_entries()
def make_item_gl_entries(self, gl_entries): # income account gl entries for item in self.get("items"): if flt(item.base_net_amount): if item.is_fixed_asset: asset = frappe.get_doc("Asset", item.asset) fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount) for gle in fixed_asset_gl_entries: gle["against"] = self.customer gl_entries.append(self.get_gl_dict(gle)) asset.db_set("disposal_date", self.posting_date) asset.set_status("Sold" if self.docstatus==1 else None) else: account_currency = get_account_currency(item.income_account) gl_entries.append( self.get_gl_dict({ "account": item.income_account, "against": self.customer, "credit": item.base_net_amount, "credit_in_account_currency": item.base_net_amount \ if account_currency==self.company_currency else item.net_amount, "cost_center": item.cost_center }, account_currency) ) if item.normal_loss_amt: normal_account = frappe.db.get_value('Company', self.company, 'normal_loss_account') account_currency = get_account_currency(normal_account) gl_entries.append( self.get_gl_dict({ "account": normal_account, "against": self.customer, #"party_type": "Customer", #"party": self.customer, "debit": item.normal_loss_amt, "debit_in_account_currency": item.normal_loss_amt \ if account_currency==self.company_currency else (item.normal_loss_amt * self.conversion_rate, self.precision("grand_total")) , "cost_center": item.cost_center, }, account_currency) ) gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "against": self.against_income_account, "party_type": "Customer", "party": self.customer, "credit": item.normal_loss_amt, "credit_in_account_currency": item.normal_loss_amt \ if account_currency==self.company_currency else (item.normal_loss_amt * self.conversion_rate, self.precision("grand_total")) , #"cost_center": item.cost_center "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype }, account_currency) ) if item.abnormal_loss_amt: abnormal_account = frappe.db.get_value('Company', self.company, 'abnormal_loss_account') account_currency = get_account_currency(abnormal_account) gl_entries.append( self.get_gl_dict({ "account": abnormal_account, "against": self.customer, #"party_type": "Customer", #"party": self.customer, "debit": item.abnormal_loss_amt, "debit_in_account_currency": item.abnormal_loss_amt \ if account_currency==self.company_currency else (item.abnormal_loss_amt * self.conversion_rate, self.precision("grand_total")) , "cost_center": item.cost_center, }, account_currency) ) gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "against": self.against_income_account, "party_type": "Customer", "party": self.customer, "credit": item.abnormal_loss_amt, "credit_in_account_currency": item.abnormal_loss_amt \ if account_currency==self.company_currency else (item.abnormal_loss_amt * self.conversion_rate, self.precision("grand_total")) , #"cost_center": item.cost_center "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype }, account_currency) ) if item.excess_qty: excess_account = item.income_account excess_amount = flt(item.excess_qty) * flt(item.rate) remark = "Excess Amount due to weight difference by " + str(item.excess_qty) + "MT", account_currency = get_account_currency(excess_account) gl_entries.append( self.get_gl_dict({ "account": excess_account, "against": self.customer, #"party_type": "Customer", #"party": self.customer, "credit": excess_amount, "credit_in_account_currency": excess_amount \ if account_currency==self.company_currency else (excess_amount * self.conversion_rate, self.precision("grand_total")) , "cost_center": item.cost_center, "remark": remark, "remarks": remark, }, account_currency) ) gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "party_type": "Customer", "party": self.customer, "debit": excess_amount, "debit_in_account_currency": excess_amount \ if account_currency==self.company_currency else (excess_amount * self.conversion_rate, self.precision("grand_total")) , "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype, "remark": remark, "remarks": remark, }, account_currency) ) # expense account gl entries if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \ and cint(self.update_stock): gl_entries += super(SalesInvoice, self).get_gl_entries()