mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 07:02:54 +00:00
space to tabs
This commit is contained in:
@@ -140,7 +140,7 @@ def update_multi_mode_option(doc, pos_profile):
|
||||
|
||||
|
||||
def get_mode_of_payment(doc):
|
||||
return frappe.db.sql(""" select mpa.default_account, mpa.parent, mp.type as type from `tabMode of Payment Account` mpa,
|
||||
return frappe.db.sql(""" select mpa.default_account, mpa.parent, mp.type as type from `tabMode of Payment Account` mpa, \
|
||||
`tabMode of Payment` mp where mpa.parent = mp.name and mpa.company = %(company)s""", {'company': doc.company}, as_dict=1)
|
||||
|
||||
|
||||
@@ -206,7 +206,8 @@ def get_customers_address(customers):
|
||||
(select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s
|
||||
and parenttype = 'Address')""", data.name, as_dict=1)
|
||||
address_data = {}
|
||||
if address: address_data = address[0]
|
||||
if address:
|
||||
address_data = address[0]
|
||||
|
||||
address_data.update({'full_name': data.customer_name, 'customer_pos_id': data.customer_pos_id})
|
||||
customer_address[data.name] = address_data
|
||||
@@ -307,6 +308,7 @@ def get_item_tax_data():
|
||||
|
||||
return itemwise_tax
|
||||
|
||||
|
||||
def get_price_list_data(selling_price_list):
|
||||
itemwise_price_list = {}
|
||||
price_lists = frappe.db.sql("""Select ifnull(price_list_rate, 0) as price_list_rate,
|
||||
@@ -318,6 +320,7 @@ def get_price_list_data(selling_price_list):
|
||||
|
||||
return itemwise_price_list
|
||||
|
||||
|
||||
def get_bin_data(pos_profile):
|
||||
itemwise_bin_data = {}
|
||||
cond = "1=1"
|
||||
@@ -334,6 +337,7 @@ def get_bin_data(pos_profile):
|
||||
|
||||
return itemwise_bin_data
|
||||
|
||||
|
||||
def get_pricing_rule_data(doc):
|
||||
pricing_rules = ""
|
||||
if doc.ignore_pricing_rule == 0:
|
||||
@@ -345,6 +349,7 @@ def get_pricing_rule_data(doc):
|
||||
{'company': doc.company, 'price_list': doc.selling_price_list, 'date': nowdate()}, as_dict=1)
|
||||
return pricing_rules
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
||||
if isinstance(doc_list, basestring):
|
||||
@@ -383,9 +388,11 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
||||
'synced_contacts': get_contacts(customers)
|
||||
}
|
||||
|
||||
|
||||
def validate_records(doc):
|
||||
validate_item(doc)
|
||||
|
||||
|
||||
def get_customer_id(doc, customer=None):
|
||||
cust_id = None
|
||||
if doc.get('customer_pos_id'):
|
||||
@@ -401,6 +408,7 @@ def get_customer_id(doc, customer=None):
|
||||
|
||||
return cust_id
|
||||
|
||||
|
||||
def make_customer_and_address(customers):
|
||||
customers_list = []
|
||||
for customer, data in customers.items():
|
||||
@@ -417,6 +425,7 @@ def make_customer_and_address(customers):
|
||||
frappe.db.commit()
|
||||
return customers_list
|
||||
|
||||
|
||||
def add_customer(data):
|
||||
customer_doc = frappe.new_doc('Customer')
|
||||
customer_doc.customer_name = data.get('full_name') or data.get('customer')
|
||||
@@ -429,6 +438,7 @@ def add_customer(data):
|
||||
frappe.db.commit()
|
||||
return customer_doc.name
|
||||
|
||||
|
||||
def get_territory(data):
|
||||
if data.get('territory'):
|
||||
return data.get('territory')
|
||||
@@ -436,6 +446,7 @@ def get_territory(data):
|
||||
return frappe.db.get_single_value('Selling Settings',
|
||||
'territory') or _('All Territories')
|
||||
|
||||
|
||||
def get_customer_group(data):
|
||||
if data.get('customer_group'):
|
||||
return data.get('customer_group')
|
||||
@@ -443,6 +454,7 @@ def get_customer_group(data):
|
||||
return frappe.db.get_single_value('Selling Settings',
|
||||
'customer_group') or frappe.db.get_value('Customer Group', {'is_group': 0}, 'name')
|
||||
|
||||
|
||||
def make_contact(args, customer):
|
||||
if args.get('email_id') or args.get('phone'):
|
||||
name = frappe.db.get_value('Dynamic Link',
|
||||
@@ -468,8 +480,10 @@ def make_contact(args,customer):
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save(ignore_permissions=True)
|
||||
|
||||
|
||||
def make_address(args, customer):
|
||||
if not args.get('address_line1'): return
|
||||
if not args.get('address_line1'):
|
||||
return
|
||||
|
||||
name = args.get('name')
|
||||
|
||||
@@ -493,6 +507,7 @@ def make_address(args, customer):
|
||||
address.flags.ignore_mandatory = True
|
||||
address.save(ignore_permissions=True)
|
||||
|
||||
|
||||
def make_email_queue(email_queue):
|
||||
name_list = []
|
||||
for key, data in email_queue.items():
|
||||
@@ -509,6 +524,7 @@ def make_email_queue(email_queue):
|
||||
|
||||
return name_list
|
||||
|
||||
|
||||
def validate_item(doc):
|
||||
for item in doc.get('items'):
|
||||
if not frappe.db.exists('Item', item.get('item_code')):
|
||||
@@ -531,13 +547,15 @@ def submit_invoice(si_doc, name, doc, name_list):
|
||||
frappe.db.commit()
|
||||
name_list.append(name)
|
||||
except Exception as e:
|
||||
if frappe.message_log: frappe.message_log.pop()
|
||||
if frappe.message_log:
|
||||
frappe.message_log.pop()
|
||||
frappe.db.rollback()
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
name_list = save_invoice(doc, name, name_list)
|
||||
|
||||
return name_list
|
||||
|
||||
|
||||
def save_invoice(doc, name, name_list):
|
||||
try:
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||
|
||||
Reference in New Issue
Block a user