[fix] [refactor] pos hangs in multi-company, if company is not set
This commit is contained in:
parent
e7b37af525
commit
88655890be
@ -23,7 +23,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
this.frm.set_value("is_pos", 1);
|
this.frm.set_value("is_pos", 1);
|
||||||
this.is_pos(function() {
|
this.is_pos(function() {
|
||||||
if (cint(frappe.defaults.get_user_defaults("fs_pos_view"))===1)
|
if (cint(frappe.defaults.get_user_defaults("fs_pos_view"))===1)
|
||||||
erpnext.pos.toggle(me.frm);
|
erpnext.pos.toggle(me.frm, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show buttons only when pos view is active
|
// Show buttons only when pos view is active
|
||||||
if (doc.docstatus===0 && !this.pos_active) {
|
if (doc.docstatus===0 && !cur_frm.page.current_view_name!=="pos") {
|
||||||
cur_frm.cscript.sales_order_btn();
|
cur_frm.cscript.sales_order_btn();
|
||||||
cur_frm.cscript.delivery_note_btn();
|
cur_frm.cscript.delivery_note_btn();
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ erpnext.pos.PointOfSale = Class.extend({
|
|||||||
},
|
},
|
||||||
set_primary_action: function() {
|
set_primary_action: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (!this.frm.pos_active) return;
|
if (this.frm.page.current_view_name==="main") return;
|
||||||
|
|
||||||
if (this.frm.doctype == "Sales Invoice" && this.frm.doc.docstatus===0) {
|
if (this.frm.doctype == "Sales Invoice" && this.frm.doc.docstatus===0) {
|
||||||
if (!this.frm.doc.is_pos) {
|
if (!this.frm.doc.is_pos) {
|
||||||
@ -342,7 +342,6 @@ erpnext.pos.PointOfSale = Class.extend({
|
|||||||
});
|
});
|
||||||
} else if (this.frm.doc.docstatus===1) {
|
} else if (this.frm.doc.docstatus===1) {
|
||||||
this.frm.page.set_primary_action(__("New"), function() {
|
this.frm.page.set_primary_action(__("New"), function() {
|
||||||
me.frm.pos_active = false;
|
|
||||||
erpnext.open_as_pos = true;
|
erpnext.open_as_pos = true;
|
||||||
new_doc(me.frm.doctype);
|
new_doc(me.frm.doctype);
|
||||||
});
|
});
|
||||||
@ -498,8 +497,8 @@ erpnext.pos.make_pos_btn = function(frm) {
|
|||||||
erpnext.pos.toggle(frm) });
|
erpnext.pos.toggle(frm) });
|
||||||
}
|
}
|
||||||
|
|
||||||
if(erpnext.open_as_pos && !frm.pos_active) {
|
if(erpnext.open_as_pos && frm.page.current_view_name !== "pos") {
|
||||||
erpnext.pos.toggle(frm);
|
erpnext.pos.toggle(frm, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,14 +507,26 @@ erpnext.pos.toggle = function(frm, show) {
|
|||||||
var price_list = frappe.meta.has_field(cur_frm.doc.doctype, "selling_price_list") ?
|
var price_list = frappe.meta.has_field(cur_frm.doc.doctype, "selling_price_list") ?
|
||||||
frm.doc.selling_price_list : frm.doc.buying_price_list;
|
frm.doc.selling_price_list : frm.doc.buying_price_list;
|
||||||
|
|
||||||
if((show===true && frm.pos_active) || (show===false && !frm.pos_active)) {
|
if(show!==undefined) {
|
||||||
|
if((show===true && frm.page.current_view_name === "pos")
|
||||||
|
|| (show===false && frm.page.current_view_name === "main")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(show && !price_list) {
|
console.log(frm.page.current_view_name);
|
||||||
|
|
||||||
|
if(frm.page.current_view_name!=="pos") {
|
||||||
|
// before switching, ask for pos name
|
||||||
|
if(!price_list) {
|
||||||
frappe.throw(__("Please select Price List"));
|
frappe.throw(__("Please select Price List"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!frm.doc.company) {
|
||||||
|
frappe.throw(__("Please select Company"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// make pos
|
// make pos
|
||||||
if(!frm.pos) {
|
if(!frm.pos) {
|
||||||
var wrapper = frm.page.add_view("pos", "<div>");
|
var wrapper = frm.page.add_view("pos", "<div>");
|
||||||
@ -523,14 +534,13 @@ erpnext.pos.toggle = function(frm, show) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// toggle view
|
// toggle view
|
||||||
frm.page.set_view(frm.pos_active ? "main" : "pos");
|
frm.page.set_view(frm.page.current_view_name==="pos" ? "main" : "pos");
|
||||||
frm.pos_active = !frm.pos_active;
|
|
||||||
|
|
||||||
frm.toolbar.current_status = null;
|
frm.toolbar.current_status = null;
|
||||||
frm.refresh();
|
frm.refresh();
|
||||||
|
|
||||||
// refresh
|
// refresh
|
||||||
if(frm.pos_active) {
|
if(frm.page.current_view_name==="pos") {
|
||||||
frm.pos.refresh();
|
frm.pos.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{% if(actual_qty != null) { %}
|
{% if(actual_qty != null) { %}
|
||||||
<div style="margin-top: 5px;" class="text-muted small text-right">
|
<div style="margin-top: 5px;" class="text-muted small text-right">
|
||||||
<span title="{%= __("In Stock") %}">{%= actual_qty %}<span>
|
<span title="{%= __("In Stock") %}">{%= actual_qty || 0 %}<span>
|
||||||
<span title="{%= __("Projected") %}">({%= projected_qty %})<span>
|
<span title="{%= __("Projected") %}">({%= projected_qty || 0 %})<span>
|
||||||
</div>
|
</div>
|
||||||
{% } %}
|
{% } %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user