Merge branch 'master' into develop
This commit is contained in:
commit
c8cd4ba6f7
@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '10.1.12'
|
__version__ = '10.1.13'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -25,8 +25,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
|||||||
#Cost Center & Warehouse Map
|
#Cost Center & Warehouse Map
|
||||||
invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
|
invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
|
||||||
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
||||||
customers = list(set([inv.customer for inv in invoice_list]))
|
|
||||||
customer_map = get_customer_details(customers)
|
|
||||||
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
|
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
|
||||||
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
|
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
|
||||||
|
|
||||||
@ -38,7 +36,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
|||||||
cost_center = list(set(invoice_cc_wh_map.get(inv.name, {}).get("cost_center", [])))
|
cost_center = list(set(invoice_cc_wh_map.get(inv.name, {}).get("cost_center", [])))
|
||||||
warehouse = list(set(invoice_cc_wh_map.get(inv.name, {}).get("warehouse", [])))
|
warehouse = list(set(invoice_cc_wh_map.get(inv.name, {}).get("warehouse", [])))
|
||||||
|
|
||||||
customer_details = customer_map.get(inv.customer, {})
|
|
||||||
row = [
|
row = [
|
||||||
inv.name, inv.posting_date, inv.customer, inv.customer_name
|
inv.name, inv.posting_date, inv.customer, inv.customer_name
|
||||||
]
|
]
|
||||||
@ -48,8 +45,8 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
|||||||
row.append(inv.get(col))
|
row.append(inv.get(col))
|
||||||
|
|
||||||
row +=[
|
row +=[
|
||||||
customer_details.get("customer_group"),
|
inv.get("customer_group"),
|
||||||
customer_details.get("territory"),
|
inv.get("territory"),
|
||||||
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
|
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
|
||||||
inv.project, inv.owner, inv.remarks,
|
inv.project, inv.owner, inv.remarks,
|
||||||
", ".join(sales_order), ", ".join(delivery_note),", ".join(cost_center),
|
", ".join(sales_order), ", ".join(delivery_note),", ".join(cost_center),
|
||||||
@ -162,7 +159,9 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
additional_query_columns = ', ' + ', '.join(additional_query_columns)
|
additional_query_columns = ', ' + ', '.join(additional_query_columns)
|
||||||
|
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, owner, remarks,
|
return frappe.db.sql("""
|
||||||
|
select name, posting_date, debit_to, project, customer,
|
||||||
|
customer_name, owner, remarks, territory, customer_group,
|
||||||
base_net_total, base_grand_total, base_rounded_total, outstanding_amount {0}
|
base_net_total, base_grand_total, base_rounded_total, outstanding_amount {0}
|
||||||
from `tabSales Invoice`
|
from `tabSales Invoice`
|
||||||
where docstatus = 1 %s order by posting_date desc, name desc""".format(additional_query_columns or '') %
|
where docstatus = 1 %s order by posting_date desc, name desc""".format(additional_query_columns or '') %
|
||||||
@ -241,15 +240,6 @@ def get_invoice_cc_wh_map(invoice_list):
|
|||||||
|
|
||||||
return invoice_cc_wh_map
|
return invoice_cc_wh_map
|
||||||
|
|
||||||
def get_customer_details(customers):
|
|
||||||
customer_map = {}
|
|
||||||
for cust in frappe.db.sql("""select name, territory, customer_group from `tabCustomer`
|
|
||||||
where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1):
|
|
||||||
customer_map.setdefault(cust.name, cust)
|
|
||||||
|
|
||||||
return customer_map
|
|
||||||
|
|
||||||
|
|
||||||
def get_mode_of_payments(invoice_list):
|
def get_mode_of_payments(invoice_list):
|
||||||
mode_of_payments = {}
|
mode_of_payments = {}
|
||||||
if invoice_list:
|
if invoice_list:
|
||||||
|
@ -332,7 +332,7 @@ class SellingController(StockController):
|
|||||||
def set_po_nos(self):
|
def set_po_nos(self):
|
||||||
if self.doctype in ("Delivery Note", "Sales Invoice"):
|
if self.doctype in ("Delivery Note", "Sales Invoice"):
|
||||||
ref_fieldname = "against_sales_order" if self.doctype == "Delivery Note" else "sales_order"
|
ref_fieldname = "against_sales_order" if self.doctype == "Delivery Note" else "sales_order"
|
||||||
sales_orders = list(set([d.get(ref_fieldname) for d in self.items]))
|
sales_orders = list(set([d.get(ref_fieldname) for d in self.items if d.get(ref_fieldname)]))
|
||||||
if sales_orders:
|
if sales_orders:
|
||||||
po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)})
|
po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)})
|
||||||
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user