mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
Merge pull request #19501 from Mangesh-Khairnar/multiple-pos-profile
feat: multiple company pos profile
This commit is contained in:
@@ -451,7 +451,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
|
|
||||||
change_pos_profile() {
|
change_pos_profile() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const on_submit = ({ pos_profile, set_as_default }) => {
|
const on_submit = ({ company, pos_profile, set_as_default }) => {
|
||||||
if (pos_profile) {
|
if (pos_profile) {
|
||||||
this.pos_profile = pos_profile;
|
this.pos_profile = pos_profile;
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
method: "erpnext.accounts.doctype.pos_profile.pos_profile.set_default_profile",
|
method: "erpnext.accounts.doctype.pos_profile.pos_profile.set_default_profile",
|
||||||
args: {
|
args: {
|
||||||
'pos_profile': pos_profile,
|
'pos_profile': pos_profile,
|
||||||
'company': this.frm.doc.company
|
'company': company
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.on_change_pos_profile();
|
this.on_change_pos_profile();
|
||||||
@@ -471,7 +471,42 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frappe.prompt(this.get_prompt_fields(),
|
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
var dialog = frappe.prompt([{
|
||||||
|
fieldtype: 'Link',
|
||||||
|
label: __('Company'),
|
||||||
|
options: 'Company',
|
||||||
|
fieldname: 'company',
|
||||||
|
default: me.frm.doc.company,
|
||||||
|
reqd: 1,
|
||||||
|
onchange: function(e) {
|
||||||
|
me.get_default_pos_profile(this.value).then((r) => {
|
||||||
|
dialog.set_value('pos_profile', (r && r.name)? r.name : '');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldtype: 'Link',
|
||||||
|
label: __('POS Profile'),
|
||||||
|
options: 'POS Profile',
|
||||||
|
fieldname: 'pos_profile',
|
||||||
|
default: me.frm.doc.pos_profile,
|
||||||
|
reqd: 1,
|
||||||
|
get_query: () => {
|
||||||
|
return {
|
||||||
|
query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query',
|
||||||
|
filters: {
|
||||||
|
company: dialog.get_value('company')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
fieldtype: 'Check',
|
||||||
|
label: __('Set as default'),
|
||||||
|
fieldname: 'set_as_default'
|
||||||
|
}],
|
||||||
on_submit,
|
on_submit,
|
||||||
__('Select POS Profile')
|
__('Select POS Profile')
|
||||||
);
|
);
|
||||||
@@ -494,26 +529,9 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
get_prompt_fields() {
|
get_default_pos_profile(company) {
|
||||||
return [{
|
return frappe.xcall("erpnext.stock.get_item_details.get_pos_profile",
|
||||||
fieldtype: 'Link',
|
{'company': company})
|
||||||
label: __('POS Profile'),
|
|
||||||
options: 'POS Profile',
|
|
||||||
fieldname: 'pos_profile',
|
|
||||||
reqd: 1,
|
|
||||||
get_query: () => {
|
|
||||||
return {
|
|
||||||
query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query',
|
|
||||||
filters: {
|
|
||||||
company: this.frm.doc.company
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
fieldtype: 'Check',
|
|
||||||
label: __('Set as default'),
|
|
||||||
fieldname: 'set_as_default'
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_company() {
|
setup_company() {
|
||||||
|
|||||||
Reference in New Issue
Block a user