[fix] merge-conflicts

This commit is contained in:
Saurabh 2017-11-08 12:18:41 +05:30
commit f41b13b736
12 changed files with 298 additions and 180 deletions

View File

@ -4,7 +4,7 @@ import inspect
import frappe import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
__version__ = '9.2.4' __version__ = '9.2.5'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -11,6 +11,66 @@
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 0, "editable_grid": 0,
"fields": [ "fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disabled",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_2",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -142,9 +202,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "update_stock", "fieldname": "ignore_pricing_rule",
"fieldname": "warehouse", "fieldtype": "Check",
"fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -152,13 +211,11 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Warehouse", "label": "Ignore Pricing Rule",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
@ -175,8 +232,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "campaign", "fieldname": "allow_delete",
"fieldtype": "Link", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -184,10 +241,39 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Campaign", "label": "Allow Delete",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_user_to_edit_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow user to edit Rate",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "Campaign",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -330,7 +416,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "currency", "depends_on": "update_stock",
"fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
@ -339,48 +426,18 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Currency", "label": "Warehouse",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "currency", "oldfieldname": "warehouse",
"oldfieldtype": "Select", "oldfieldtype": "Link",
"options": "Currency", "options": "Warehouse",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "ignore_pricing_rule",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Ignore Pricing Rule",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
@ -392,8 +449,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "allow_delete", "fieldname": "campaign",
"fieldtype": "Check", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -401,39 +458,10 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Allow Delete", "label": "Campaign",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_user_to_edit_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow user to edit Rate",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "Campaign",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -573,6 +601,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "section_break_14", "fieldname": "section_break_14",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -693,6 +722,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "section_break_16", "fieldname": "section_break_16",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -973,6 +1003,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "offline_pos_section", "fieldname": "offline_pos_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1128,6 +1159,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "section_break_19", "fieldname": "section_break_19",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1137,6 +1169,7 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Accounting",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -1151,6 +1184,38 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Currency",
"length": 0,
"no_copy": 0,
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -1245,38 +1310,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Taxes and Charges",
"length": 0,
"no_copy": 0,
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -1400,6 +1433,38 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Taxes and Charges",
"length": 0,
"no_copy": 0,
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "has_web_view": 0,
@ -1413,8 +1478,8 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-09-29 14:39:22.280700", "modified": "2017-10-27 06:45:32.957674",
"modified_by": "faris@erpnext.com", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Profile", "name": "POS Profile",
"owner": "Administrator", "owner": "Administrator",

View File

@ -41,6 +41,7 @@ def make_pos_profile():
"expense_account": "_Test Account Cost for Goods Sold - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC",
"income_account": "Sales - _TC", "income_account": "Sales - _TC",
"name": "_Test POS Profile", "name": "_Test POS Profile",
"pos_profile_name": "_Test POS Profile",
"naming_series": "_T-POS Profile-", "naming_series": "_T-POS Profile-",
"selling_price_list": "_Test Price List", "selling_price_list": "_Test Price List",
"territory": "_Test Territory", "territory": "_Test Territory",

View File

@ -92,6 +92,7 @@ def update_pos_profile_data(doc, pos_profile, company_data):
doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group') doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group')
doc.territory = pos_profile.get('territory') or get_root('Territory') doc.territory = pos_profile.get('territory') or get_root('Territory')
doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or '' doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or ''
doc.offline_pos_name = ''
def get_root(table): def get_root(table):
root = frappe.db.sql(""" select name from `tab%(table)s` having root = frappe.db.sql(""" select name from `tab%(table)s` having

View File

@ -70,7 +70,6 @@ class SalesInvoice(SellingController):
self.clear_unallocated_advances("Sales Invoice Advance", "advances") self.clear_unallocated_advances("Sales Invoice Advance", "advances")
self.add_remarks() self.add_remarks()
self.validate_write_off_account() self.validate_write_off_account()
self.validate_duplicate_offline_pos_entry()
self.validate_account_for_change_amount() self.validate_account_for_change_amount()
self.validate_fixed_asset() self.validate_fixed_asset()
self.set_income_account_for_fixed_assets() self.set_income_account_for_fixed_assets()
@ -305,6 +304,7 @@ class SalesInvoice(SellingController):
self.account_for_change_amount = frappe.db.get_value('Company', self.company, 'default_cash_account') self.account_for_change_amount = frappe.db.get_value('Company', self.company, 'default_cash_account')
if pos: if pos:
self.pos_profile = pos.name
if not for_validate and not self.customer: if not for_validate and not self.customer:
self.customer = pos.customer self.customer = pos.customer
self.mode_of_payment = pos.mode_of_payment self.mode_of_payment = pos.mode_of_payment
@ -463,12 +463,6 @@ class SalesInvoice(SellingController):
if flt(self.write_off_amount) and not self.write_off_account: if flt(self.write_off_amount) and not self.write_off_account:
msgprint(_("Please enter Write Off Account"), raise_exception=1) msgprint(_("Please enter Write Off Account"), raise_exception=1)
def validate_duplicate_offline_pos_entry(self):
if self.is_pos and self.offline_pos_name \
and frappe.db.get_value('Sales Invoice',
{'offline_pos_name': self.offline_pos_name, 'docstatus': 1}):
frappe.throw(_("Duplicate offline pos sales invoice {0}").format(self.offline_pos_name))
def validate_account_for_change_amount(self): def validate_account_for_change_amount(self):
if flt(self.change_amount) and not self.account_for_change_amount: if flt(self.change_amount) and not self.account_for_change_amount:
msgprint(_("Please enter Account for Change Amount"), raise_exception=1) msgprint(_("Please enter Account for Change Amount"), raise_exception=1)

View File

@ -179,41 +179,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
} }
}, },
dialog_actions: function () {
var me = this;
$(this.list_body).find('.list-select-all').click(function () {
me.removed_items = [];
$(me.list_body).find('.list-delete').prop("checked", $(this).is(":checked"))
if ($(this).is(":checked")) {
$.each(me.si_docs, function (index, data) {
for (key in data) {
me.removed_items.push(key)
}
})
}
me.toggle_delete_button();
})
$(this.list_body).find('.list-delete').click(function () {
me.name = $(this).parent().parent().attr('invoice-name');
if ($(this).is(":checked")) {
me.removed_items.push(me.name);
} else {
me.removed_items.pop(me.name)
}
me.toggle_delete_button();
})
},
edit_record: function () { edit_record: function () {
var me = this; var me = this;
doc_data = this.get_invoice_doc(this.si_docs); doc_data = this.get_invoice_doc(this.si_docs);
if (doc_data) { if (doc_data) {
this.frm.doc = doc_data[0][this.name]; this.frm.doc = doc_data[0][this.frm.doc.offline_pos_name];
this.set_missing_values(); this.set_missing_values();
this.refresh(false); this.refresh(false);
this.toggle_input_field(); this.toggle_input_field();
@ -226,16 +197,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.validate_list() this.validate_list()
this.remove_doc_from_localstorage() this.remove_doc_from_localstorage()
this.update_localstorage(); this.update_localstorage();
// this.dialog_actions();
this.toggle_delete_button(); this.toggle_delete_button();
}, },
validate_list: function() { validate_list: function() {
var me = this; var me = this;
this.si_docs = this.get_submitted_invoice() this.si_docs = this.get_submitted_invoice()
$.each(this.removed_items, function(index, name){ $.each(this.removed_items, function(index, pos_name){
$.each(me.si_docs, function(key, data){ $.each(me.si_docs, function(key, data){
if(me.si_docs[key][name] && me.si_docs[key][name].offline_pos_name == name ){ if(me.si_docs[key][pos_name] && me.si_docs[key][pos_name].offline_pos_name == pos_name ){
frappe.throw(__("Submitted orders can not be deleted")) frappe.throw(__("Submitted orders can not be deleted"))
} }
}) })
@ -294,7 +264,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
return $.grep(this.si_docs, function (data) { return $.grep(this.si_docs, function (data) {
for (key in data) { for (key in data) {
return key == me.name return key == me.frm.doc.offline_pos_name;
} }
}) })
}, },
@ -348,7 +318,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
create_new: function () { create_new: function () {
var me = this; var me = this;
this.frm = {} this.frm = {}
this.name = null;
this.load_data(true); this.load_data(true);
this.setup(); this.setup();
this.set_default_customer() this.set_default_customer()
@ -362,6 +331,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
if (load_doc) { if (load_doc) {
this.frm.doc = JSON.parse(localStorage.getItem('doc')); this.frm.doc = JSON.parse(localStorage.getItem('doc'));
this.frm.doc.offline_pos_name = null;
} }
$.each(this.meta, function (i, data) { $.each(this.meta, function (i, data) {
@ -629,6 +599,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
// this.list_customers.empty(); // this.list_customers.empty();
this.si_docs = this.get_doc_from_localstorage(); this.si_docs = this.get_doc_from_localstorage();
if (!this.si_docs.length) { if (!this.si_docs.length) {
this.list_customers.find('.list-customers-table').html("");
return; return;
} }
@ -655,7 +626,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
me.list_customers_btn.toggleClass("view_customer"); me.list_customers_btn.toggleClass("view_customer");
me.pos_bill.show(); me.pos_bill.show();
me.list_customers_btn.show(); me.list_customers_btn.show();
me.name = $(this).parents().attr('invoice-name') me.frm.doc.offline_pos_name = $(this).parents().attr('invoice-name')
me.edit_record(); me.edit_record();
}) })
@ -675,11 +646,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}); });
$(this.wrapper).find('.list-delete').click(function () { $(this.wrapper).find('.list-delete').click(function () {
me.name = $(this).parent().parent().attr('invoice-name'); me.frm.doc.offline_pos_name = $(this).parent().parent().attr('invoice-name');
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
me.removed_items.push(me.name); me.removed_items.push(me.frm.doc.offline_pos_name);
} else { } else {
me.removed_items.pop(me.name) me.removed_items.pop(me.frm.doc.offline_pos_name)
} }
me.toggle_delete_button(); me.toggle_delete_button();
@ -1435,7 +1406,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}, },
update_paid_amount_status: function (update_paid_amount) { update_paid_amount_status: function (update_paid_amount) {
if (this.name) { if (this.frm.doc.offline_pos_name) {
update_paid_amount = update_paid_amount ? false : true; update_paid_amount = update_paid_amount ? false : true;
} }
@ -1643,18 +1614,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
create_invoice: function () { create_invoice: function () {
var me = this; var me = this;
var invoice_data = {} var invoice_data = {};
this.si_docs = this.get_doc_from_localstorage(); this.si_docs = this.get_doc_from_localstorage();
if (this.name) { if (this.frm.doc.offline_pos_name) {
this.update_invoice() this.update_invoice();
} else { } else {
this.name = $.now(); this.frm.doc.offline_pos_name = $.now();
this.frm.doc.offline_pos_name = this.name;
this.frm.doc.posting_date = frappe.datetime.get_today(); this.frm.doc.posting_date = frappe.datetime.get_today();
this.frm.doc.posting_time = frappe.datetime.now_time(); this.frm.doc.posting_time = frappe.datetime.now_time();
this.frm.doc.pos_profile = this.pos_profile_data['name']; this.frm.doc.pos_profile = this.pos_profile_data['name'];
invoice_data[this.name] = this.frm.doc invoice_data[this.frm.doc.offline_pos_name] = this.frm.doc;
this.si_docs.push(invoice_data) this.si_docs.push(invoice_data);
this.update_localstorage(); this.update_localstorage();
this.set_primary_action(); this.set_primary_action();
} }
@ -1666,12 +1636,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.si_docs = this.get_doc_from_localstorage(); this.si_docs = this.get_doc_from_localstorage();
$.each(this.si_docs, function (index, data) { $.each(this.si_docs, function (index, data) {
for (var key in data) { for (var key in data) {
if (key == me.name) { if (key == me.frm.doc.offline_pos_name) {
me.si_docs[index][key] = me.frm.doc; me.si_docs[index][key] = me.frm.doc;
me.update_localstorage(); me.update_localstorage();
} }
} }
}) });
}, },
update_localstorage: function () { update_localstorage: function () {
@ -1710,6 +1680,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
freeze_screen = this.freeze_screen || false; 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) {
this.freeze = true;
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, freeze: freeze_screen,
@ -1720,17 +1692,19 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}, },
callback: function (r) { callback: function (r) {
if (r.message) { if (r.message) {
me.freeze = false;
me.customers = r.message.synced_customers_list; me.customers = r.message.synced_customers_list;
me.address = r.message.synced_address; me.address = r.message.synced_address;
me.contacts = r.message.synced_contacts; me.contacts = r.message.synced_contacts;
me.removed_items = r.message.invoice; me.removed_items = r.message.invoice;
me.removed_email = r.message.email_queue me.removed_email = r.message.email_queue;
me.removed_customers = r.message.customers me.removed_customers = r.message.customers;
me.remove_doc_from_localstorage(); me.remove_doc_from_localstorage();
me.remove_email_queue_from_localstorage(); me.remove_email_queue_from_localstorage();
me.remove_customer_from_localstorage(); me.remove_customer_from_localstorage();
me.prepare_customer_mapper() me.prepare_customer_mapper();
me.autocomplete_customers() me.autocomplete_customers();
me.render_list_customers();
} }
} }
}) })

View File

@ -6,6 +6,7 @@ QUnit.test("test:Sales Invoice", function(assert) {
() => { () => {
return frappe.tests.make("POS Profile", [ return frappe.tests.make("POS Profile", [
{naming_series: "SINV"}, {naming_series: "SINV"},
{pos_profile_name: "_Test POS Profile"},
{country: "India"}, {country: "India"},
{currency: "INR"}, {currency: "INR"},
{write_off_account: "Write Off - FT"}, {write_off_account: "Write Off - FT"},

View File

@ -457,4 +457,4 @@ erpnext.patches.v9_0.set_variant_item_description
erpnext.patches.v9_0.set_uoms_in_variant_field erpnext.patches.v9_0.set_uoms_in_variant_field
erpnext.patches.v9_0.copy_old_fees_field_data erpnext.patches.v9_0.copy_old_fees_field_data
execute:frappe.delete_doc_if_exists("DocType", "Program Fee") execute:frappe.delete_doc_if_exists("DocType", "Program Fee")
erpnext.patches.v9_0.set_pos_profile_name

View File

@ -0,0 +1,19 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
doctype = 'POS Profile'
frappe.reload_doctype(doctype)
for pos in frappe.get_all(doctype):
doc = frappe.get_doc(doctype, pos.name)
if not doc.user: continue
doc.pos_profile_name = doc.user + ' - ' + doc.company
doc.save()
frappe.rename_doc(doctype, doc.name, doc.pos_profile_name, force=True)

View File

@ -43,6 +43,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
make() { make() {
return frappe.run_serially([ return frappe.run_serially([
() => frappe.dom.freeze(),
() => { () => {
this.prepare_dom(); this.prepare_dom();
this.prepare_menu(); this.prepare_menu();
@ -55,6 +56,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
frappe.timeout(1); frappe.timeout(1);
this.make_items(); this.make_items();
this.bind_events(); this.bind_events();
frappe.dom.unfreeze();
}, },
() => this.page.set_title(__('Point of Sale')) () => this.page.set_title(__('Point of Sale'))
]); ]);
@ -156,6 +158,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
} }
update_item_in_cart(item_code, field='qty', value=1) { update_item_in_cart(item_code, field='qty', value=1) {
frappe.dom.freeze();
if(this.cart.exists(item_code)) { if(this.cart.exists(item_code)) {
const item = this.frm.doc.items.find(i => i.item_code === item_code); const item = this.frm.doc.items.find(i => i.item_code === item_code);
frappe.flags.hide_serial_batch_dialog = false; frappe.flags.hide_serial_batch_dialog = false;
@ -220,6 +223,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
this.cart.add_item(item); this.cart.add_item(item);
this.cart.update_taxes_and_totals(); this.cart.update_taxes_and_totals();
this.cart.update_grand_total(); this.cart.update_grand_total();
frappe.dom.unfreeze();
} }
update_item_in_frm(item, field, value) { update_item_in_frm(item, field, value) {
@ -232,8 +236,6 @@ erpnext.pos.PointOfSale = class PointOfSale {
return frappe.model.set_value(item.doctype, item.name, field, value) return frappe.model.set_value(item.doctype, item.name, field, value)
.then(() => this.frm.script_manager.trigger('qty', item.doctype, item.name)) .then(() => this.frm.script_manager.trigger('qty', item.doctype, item.name))
.then(() => { .then(() => {
console.log(item.qty, item.amount);
if (field === 'qty' && item.qty === 0) { if (field === 'qty' && item.qty === 0) {
frappe.model.clear_doc(item.doctype, item.name); frappe.model.clear_doc(item.doctype, item.name);
} }

View File

@ -624,7 +624,8 @@ class Item(WebsiteGenerator):
template_item.save() template_item.save()
def update_variants(self): def update_variants(self):
if self.flags.dont_update_variants: if self.flags.dont_update_variants or \
frappe.db.get_single_value('Item Variant Settings', 'do_not_update_variants'):
return return
if self.has_variants: if self.has_variants:
updated = [] updated = []

View File

@ -12,6 +12,66 @@
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"fields": [ "fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_3",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "If enabled then system will not update the fields of variants from the template but will copy the data of below mentioned fields while making new variant",
"fieldname": "do_not_update_variants",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Do not Update Variants",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -84,8 +144,8 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-09-11 12:05:16.288601", "modified": "2017-11-08 11:38:12.821404",
"modified_by": "rohit@erpnext.com", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item Variant Settings", "name": "Item Variant Settings",
"name_case": "", "name_case": "",