Merge branch 'master' into develop
This commit is contained in:
commit
8919669ac2
@ -4,7 +4,7 @@ import inspect
|
|||||||
import frappe
|
import frappe
|
||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
|
|
||||||
__version__ = '9.0.5'
|
__version__ = '9.0.6'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -417,6 +417,7 @@ def make_contact(args,customer):
|
|||||||
'link_doctype': 'Customer',
|
'link_doctype': 'Customer',
|
||||||
'link_name': customer
|
'link_name': customer
|
||||||
})
|
})
|
||||||
|
doc.flags.ignore_mandatory = True
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
|
|
||||||
def make_address(args, customer):
|
def make_address(args, customer):
|
||||||
@ -441,6 +442,7 @@ def make_address(args, customer):
|
|||||||
address.is_primary_address = 1
|
address.is_primary_address = 1
|
||||||
address.is_shipping_address = 1
|
address.is_shipping_address = 1
|
||||||
address.update(args)
|
address.update(args)
|
||||||
|
address.flags.ignore_mandatory = True
|
||||||
address.save(ignore_permissions = True)
|
address.save(ignore_permissions = True)
|
||||||
|
|
||||||
def make_email_queue(email_queue):
|
def make_email_queue(email_queue):
|
||||||
|
@ -113,6 +113,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.page.add_menu_item(__("Sync Offline Invoices"), function () {
|
this.page.add_menu_item(__("Sync Offline Invoices"), function () {
|
||||||
|
me.freeze_screen = true;
|
||||||
me.sync_sales_invoice()
|
me.sync_sales_invoice()
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1684,6 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
set_interval_for_si_sync: function () {
|
set_interval_for_si_sync: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
|
me.freeze_screen = false;
|
||||||
me.sync_sales_invoice()
|
me.sync_sales_invoice()
|
||||||
}, 60000)
|
}, 60000)
|
||||||
},
|
},
|
||||||
@ -1697,9 +1699,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.freeze = this.customer_doc.display
|
this.freeze = this.customer_doc.display
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freeze_screen = this.freeze_screen || false;
|
||||||
|
|
||||||
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
||||||
|
freeze: freeze_screen,
|
||||||
args: {
|
args: {
|
||||||
doc_list: me.si_docs,
|
doc_list: me.si_docs,
|
||||||
email_queue_list: me.email_queue_list,
|
email_queue_list: me.email_queue_list,
|
||||||
|
@ -96,7 +96,17 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
|
|
||||||
if(this.show_dialog) {
|
if(this.show_dialog) {
|
||||||
let d = this.item;
|
let d = this.item;
|
||||||
|
if (d.has_serial_no && d.serial_no) {
|
||||||
this.dialog.set_value('serial_no', d.serial_no);
|
this.dialog.set_value('serial_no', d.serial_no);
|
||||||
|
} else if (d.batch_no) {
|
||||||
|
this.dialog.fields_dict.batches.df.data.push({
|
||||||
|
'batch_no': d.batch_no,
|
||||||
|
'actual_qty': d.actual_qty,
|
||||||
|
'selected_qty': d.qty
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dialog.fields_dict.batches.grid.refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dialog.show();
|
this.dialog.show();
|
||||||
@ -116,19 +126,23 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
}
|
}
|
||||||
values.batches.map((batch, i) => {
|
values.batches.map((batch, i) => {
|
||||||
if(!batch.selected_qty || batch.selected_qty === 0 ) {
|
if(!batch.selected_qty || batch.selected_qty === 0 ) {
|
||||||
|
if (!this.show_dialog) {
|
||||||
frappe.throw(__("Please select quantity on row " + (i+1)));
|
frappe.throw(__("Please select quantity on row " + (i+1)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let serial_nos = values.serial_no || '';
|
let serial_nos = values.serial_no || '';
|
||||||
if (!serial_nos || !serial_nos.replace(/\s/g, '').length) {
|
if (!serial_nos || !serial_nos.replace(/\s/g, '').length) {
|
||||||
|
if (!this.show_dialog) {
|
||||||
frappe.throw(__("Please enter serial numbers for serialized item "
|
frappe.throw(__("Please enter serial numbers for serialized item "
|
||||||
+ values.item_code));
|
+ values.item_code));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.cart = new POSCart({
|
this.cart = new POSCart({
|
||||||
frm: this.frm,
|
frm: this.frm,
|
||||||
wrapper: this.wrapper.find('.cart-container'),
|
wrapper: this.wrapper.find('.cart-container'),
|
||||||
|
pos_profile: this.pos_profile,
|
||||||
events: {
|
events: {
|
||||||
on_customer_change: (customer) => this.frm.set_value('customer', customer),
|
on_customer_change: (customer) => this.frm.set_value('customer', customer),
|
||||||
on_field_change: (item_code, field, value) => {
|
on_field_change: (item_code, field, value) => {
|
||||||
@ -196,6 +197,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.update_item_in_frm(item)
|
this.update_item_in_frm(item)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// update cart
|
// update cart
|
||||||
|
this.remove_item_from_cart(item);
|
||||||
this.update_cart_data(item);
|
this.update_cart_data(item);
|
||||||
});
|
});
|
||||||
}, true);
|
}, true);
|
||||||
@ -215,12 +217,18 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
return this.frm.script_manager
|
return this.frm.script_manager
|
||||||
.trigger('qty', item.doctype, item.name)
|
.trigger('qty', item.doctype, item.name)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (field === 'qty' && value === 0) {
|
if (field === 'qty') {
|
||||||
frappe.model.clear_doc(item.doctype, item.name);
|
this.remove_item_from_cart(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_item_from_cart(item) {
|
||||||
|
if (item.qty === 0) {
|
||||||
|
frappe.model.clear_doc(item.doctype, item.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
make_payment_modal() {
|
make_payment_modal() {
|
||||||
this.payment = new Payment({
|
this.payment = new Payment({
|
||||||
frm: this.frm,
|
frm: this.frm,
|
||||||
@ -363,10 +371,11 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class POSCart {
|
class POSCart {
|
||||||
constructor({frm, wrapper, events}) {
|
constructor({frm, wrapper, pos_profile, events}) {
|
||||||
this.frm = frm;
|
this.frm = frm;
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
|
this.pos_profile = pos_profile;
|
||||||
this.make();
|
this.make();
|
||||||
this.bind_events();
|
this.bind_events();
|
||||||
}
|
}
|
||||||
@ -514,6 +523,7 @@ class POSCart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_customer_field() {
|
make_customer_field() {
|
||||||
|
let customer = this.frm.doc.customer || this.pos_profile['customer'];
|
||||||
this.customer_field = frappe.ui.form.make_control({
|
this.customer_field = frappe.ui.form.make_control({
|
||||||
df: {
|
df: {
|
||||||
fieldtype: 'Link',
|
fieldtype: 'Link',
|
||||||
@ -521,7 +531,6 @@ class POSCart {
|
|||||||
fieldname: 'customer',
|
fieldname: 'customer',
|
||||||
options: 'Customer',
|
options: 'Customer',
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
default: this.frm.doc.customer,
|
|
||||||
onchange: () => {
|
onchange: () => {
|
||||||
this.events.on_customer_change(this.customer_field.get_value());
|
this.events.on_customer_change(this.customer_field.get_value());
|
||||||
}
|
}
|
||||||
@ -529,6 +538,10 @@ class POSCart {
|
|||||||
parent: this.wrapper.find('.customer-field'),
|
parent: this.wrapper.find('.customer-field'),
|
||||||
render_input: true
|
render_input: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (customer) {
|
||||||
|
this.customer_field.set_value(customer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_numpad() {
|
make_numpad() {
|
||||||
@ -919,7 +932,7 @@ class POSItems {
|
|||||||
}
|
}
|
||||||
if(batch_no) {
|
if(batch_no) {
|
||||||
this.events.update_cart(items[0].item_code,
|
this.events.update_cart(items[0].item_code,
|
||||||
'batch_no', serial_no);
|
'batch_no', batch_no);
|
||||||
this.search_field.set_value('');
|
this.search_field.set_value('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user