feat: multiple company pos profile

This commit is contained in:
Mangesh-Khairnar
2019-11-01 22:35:08 +05:30
parent 50b6976c67
commit e3bc213262

View File

@@ -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();
@@ -495,7 +495,19 @@ erpnext.pos.PointOfSale = class PointOfSale {
} }
get_prompt_fields() { get_prompt_fields() {
var company_field = this.frm.doc.company;
return [{ return [{
fieldtype: 'Link',
label: __('Company'),
options: 'Company',
fieldname: 'company',
default: this.frm.doc.company,
reqd: 1,
onchange: function(e) {
company_field = this.value;
}
},
{
fieldtype: 'Link', fieldtype: 'Link',
label: __('POS Profile'), label: __('POS Profile'),
options: 'POS Profile', options: 'POS Profile',
@@ -505,7 +517,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
return { return {
query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query', query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query',
filters: { filters: {
company: this.frm.doc.company company: company_field
} }
}; };
} }