mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-06 06:58:27 +00:00
aii: gl_entries for sales invoice
This commit is contained in:
@@ -21,7 +21,7 @@ from webnotes.utils import flt
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class AccountsController(TransactionBase):
|
||||
def get_gl_dict(self, args, cancel):
|
||||
def get_gl_dict(self, args, cancel=None):
|
||||
"""this method populates the common properties of a gl entry record"""
|
||||
gl_dict = {
|
||||
'company': self.doc.company,
|
||||
@@ -30,7 +30,7 @@ class AccountsController(TransactionBase):
|
||||
'voucher_no': self.doc.name,
|
||||
'aging_date': self.doc.fields.get("aging_date") or self.doc.posting_date,
|
||||
'remarks': self.doc.remarks,
|
||||
'is_cancelled': cancel and "Yes" or "No",
|
||||
'is_cancelled': self.doc.docstatus == 2 and "Yes" or "No",
|
||||
'fiscal_year': self.doc.fiscal_year,
|
||||
'debit': 0,
|
||||
'credit': 0,
|
||||
|
||||
@@ -37,4 +37,27 @@ class SellingController(AccountsController):
|
||||
self.doc.grand_total or self.doc.rounded_total, company_currency)
|
||||
if self.meta.get_field("in_words_export"):
|
||||
self.doc.in_words_export = money_in_words(disable_rounded_total and
|
||||
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
|
||||
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
|
||||
|
||||
def get_stock_ledger_entries(self):
|
||||
item_list, warehouse_list = self.get_distinct_item_warehouse()
|
||||
if item_list and warehouse_list:
|
||||
return webnotes.conn.sql("""select item_code, voucher_type, voucher_no,
|
||||
voucher_detail_no, posting_date, posting_time, stock_value,
|
||||
warehouse, actual_qty as qty from `tabStock Ledger Entry`
|
||||
where ifnull(`is_cancelled`, "No") = "No" and company = %s
|
||||
and item_code in (%s) and warehouse in (%s)
|
||||
order by item_code desc, warehouse desc, posting_date desc,
|
||||
posting_time desc, name desc""" %
|
||||
('%s', ', '.join(['%s']*len(item_list)), ', '.join(['%s']*len(warehouse_list))),
|
||||
tuple([self.doc.company] + item_list + warehouse_list), as_dict=1)
|
||||
|
||||
def get_distinct_item_warehouse(self):
|
||||
item_list = []
|
||||
warehouse_list = []
|
||||
for item in self.doclist.get({"parentfield": self.fname}) \
|
||||
+ self.doclist.get({"parentfield": "packing_details"}):
|
||||
item_list.append(item.item_code)
|
||||
warehouse_list.append(item.warehouse)
|
||||
|
||||
return list(set(item_list)), list(set(warehouse_list))
|
||||
Reference in New Issue
Block a user