Merge pull request #8657 from rohitwaghchaure/pos_email_id_issue
[fix] Contact not creating if only email id has entered in the POS
This commit is contained in:
commit
a1923574c6
@ -325,8 +325,10 @@ def make_customer_and_address(customers):
|
|||||||
if not frappe.db.exists('Customer', name):
|
if not frappe.db.exists('Customer', name):
|
||||||
name = add_customer(name)
|
name = add_customer(name)
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
|
make_contact(data, name)
|
||||||
make_address(data, name)
|
make_address(data, name)
|
||||||
customer_list.append(name)
|
customer_list.append(name)
|
||||||
|
frappe.db.commit()
|
||||||
return customer_list
|
return customer_list
|
||||||
|
|
||||||
def add_customer(name):
|
def add_customer(name):
|
||||||
@ -340,6 +342,29 @@ def add_customer(name):
|
|||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
return customer_doc.name
|
return customer_doc.name
|
||||||
|
|
||||||
|
def make_contact(args,customer):
|
||||||
|
if args.get('email_id') or args.get('phone'):
|
||||||
|
name = frappe.db.get_value('Dynamic Link',
|
||||||
|
{'link_doctype': 'Customer', 'link_name': customer, 'parenttype': 'Contact'}, 'parent')
|
||||||
|
|
||||||
|
args = {
|
||||||
|
'email_id': args.get('email_id'),
|
||||||
|
'phone': args.get('phone')
|
||||||
|
}
|
||||||
|
|
||||||
|
doc = frappe.new_doc('Contact')
|
||||||
|
if name:
|
||||||
|
doc = frappe.get_doc('Contact', name)
|
||||||
|
|
||||||
|
doc.update(args)
|
||||||
|
if not name:
|
||||||
|
doc.first_name = customer
|
||||||
|
doc.append('links',{
|
||||||
|
'link_doctype': 'Customer',
|
||||||
|
'link_name': customer
|
||||||
|
})
|
||||||
|
doc.save(ignore_permissions=True)
|
||||||
|
|
||||||
def make_address(args, customer):
|
def make_address(args, customer):
|
||||||
if not args.get('address_line1'): return
|
if not args.get('address_line1'): return
|
||||||
|
|
||||||
|
|||||||
@ -866,6 +866,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.customer_doc.set_primary_action(__("Save"), function () {
|
this.customer_doc.set_primary_action(__("Save"), function () {
|
||||||
me.make_offline_customer(new_customer);
|
me.make_offline_customer(new_customer);
|
||||||
me.pos_bill.show();
|
me.pos_bill.show();
|
||||||
|
me.list_customers.hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user