fix(pos): customer group filter in customer selector
This commit is contained in:
parent
d5fd8e0ba6
commit
2f82e237ef
@ -8,7 +8,7 @@ import frappe
|
|||||||
from frappe.utils.nestedset import get_root_of
|
from frappe.utils.nestedset import get_root_of
|
||||||
|
|
||||||
from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability
|
from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability
|
||||||
from erpnext.accounts.doctype.pos_profile.pos_profile import get_item_groups
|
from erpnext.accounts.doctype.pos_profile.pos_profile import get_child_nodes, get_item_groups
|
||||||
|
|
||||||
|
|
||||||
def search_by_term(search_term, warehouse, price_list):
|
def search_by_term(search_term, warehouse, price_list):
|
||||||
@ -275,3 +275,16 @@ def set_customer_info(fieldname, customer, value=""):
|
|||||||
contact_doc.set('phone_nos', [{ 'phone': value, 'is_primary_mobile_no': 1}])
|
contact_doc.set('phone_nos', [{ 'phone': value, 'is_primary_mobile_no': 1}])
|
||||||
frappe.db.set_value('Customer', customer, 'mobile_no', value)
|
frappe.db.set_value('Customer', customer, 'mobile_no', value)
|
||||||
contact_doc.save()
|
contact_doc.save()
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_pos_profile_data(pos_profile):
|
||||||
|
pos_profile = frappe.get_doc('POS Profile', pos_profile)
|
||||||
|
pos_profile = pos_profile.as_dict()
|
||||||
|
|
||||||
|
_customer_groups_with_children = []
|
||||||
|
for row in pos_profile.customer_groups:
|
||||||
|
children = get_child_nodes('Customer Group', row.customer_group)
|
||||||
|
_customer_groups_with_children.extend(children)
|
||||||
|
|
||||||
|
pos_profile.customer_groups = _customer_groups_with_children
|
||||||
|
return pos_profile
|
@ -119,10 +119,15 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
this.allow_negative_stock = flt(message.allow_negative_stock) || false;
|
this.allow_negative_stock = flt(message.allow_negative_stock) || false;
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.db.get_doc("POS Profile", this.pos_profile).then((profile) => {
|
frappe.call({
|
||||||
|
method: "erpnext.selling.page.point_of_sale.point_of_sale.get_pos_profile_data",
|
||||||
|
args: { "pos_profile": this.pos_profile },
|
||||||
|
callback: (res) => {
|
||||||
|
const profile = res.message;
|
||||||
Object.assign(this.settings, profile);
|
Object.assign(this.settings, profile);
|
||||||
this.settings.customer_groups = profile.customer_groups.map(group => group.customer_group);
|
this.settings.customer_groups = profile.customer_groups.map(group => group.name);
|
||||||
this.make_app();
|
this.make_app();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user