[Fix]POS and timesheet issues
This commit is contained in:
parent
6889d294ae
commit
ea278b5971
@ -71,7 +71,7 @@ def get_root(table):
|
||||
def update_multi_mode_option(doc, pos_profile):
|
||||
from frappe.model import default_fields
|
||||
|
||||
if not pos_profile:
|
||||
if not pos_profile or not pos_profile.get('payments'):
|
||||
for payment in get_mode_of_payment(doc):
|
||||
payments = doc.append('payments', {})
|
||||
payments.mode_of_payment = payment.parent
|
||||
@ -166,13 +166,14 @@ def make_invoice(doc_list):
|
||||
|
||||
for docs in doc_list:
|
||||
for name, doc in docs.items():
|
||||
validate_customer(doc)
|
||||
validate_item(doc)
|
||||
si_doc = frappe.new_doc('Sales Invoice')
|
||||
si_doc.offline_pos_name = name
|
||||
si_doc.update(doc)
|
||||
submit_invoice(si_doc, name)
|
||||
name_list.append(name)
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||
validate_customer(doc)
|
||||
validate_item(doc)
|
||||
si_doc = frappe.new_doc('Sales Invoice')
|
||||
si_doc.offline_pos_name = name
|
||||
si_doc.update(doc)
|
||||
submit_invoice(si_doc, name)
|
||||
name_list.append(name)
|
||||
|
||||
return name_list
|
||||
|
||||
@ -213,7 +214,6 @@ def submit_invoice(si_doc, name):
|
||||
save_invoice(e, si_doc, name)
|
||||
|
||||
def save_invoice(e, si_doc, name):
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name, 'docstatus': 1}):
|
||||
si_doc.docstatus = 0
|
||||
si_doc.name = ''
|
||||
si_doc.save(ignore_permissions=True)
|
||||
|
@ -104,9 +104,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
this.page.add_menu_item(__("Sync Master Data"), function(){
|
||||
me.get_data_from_server(function(){
|
||||
me.load_data();
|
||||
me.load_data(false);
|
||||
me.make_customer();
|
||||
me.make_item_list();
|
||||
me.set_missing_values();
|
||||
})
|
||||
});
|
||||
|
||||
@ -151,7 +152,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
if(doc_data){
|
||||
me.frm.doc = doc_data[0][me.name];
|
||||
me.set_missing_values();
|
||||
me.refresh();
|
||||
me.refresh(false);
|
||||
me.disable_input_field();
|
||||
me.list_dialog.hide();
|
||||
}
|
||||
@ -177,6 +178,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
if(this.frm.doc.payments.length == 0){
|
||||
this.frm.doc.payments = doc.payments;
|
||||
}
|
||||
|
||||
if(this.frm.doc.customer){
|
||||
this.party_field.$input.val(this.frm.doc.customer);
|
||||
}
|
||||
},
|
||||
|
||||
get_invoice_doc: function(si_docs){
|
||||
@ -222,15 +227,18 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
var me = this;
|
||||
this.frm = {}
|
||||
this.name = '';
|
||||
this.load_data();
|
||||
this.load_data(true);
|
||||
this.setup();
|
||||
},
|
||||
|
||||
load_data: function(){
|
||||
load_data: function(load_doc){
|
||||
this.items = window.items;
|
||||
this.customers = window.customers;
|
||||
this.pricing_rules = window.pricing_rules;
|
||||
this.frm.doc = JSON.parse(localStorage.getItem('doc'));
|
||||
|
||||
if(load_doc) {
|
||||
this.frm.doc = JSON.parse(localStorage.getItem('doc'));
|
||||
}
|
||||
|
||||
$.each(window.meta, function(i, data){
|
||||
frappe.meta.sync(data)
|
||||
@ -302,7 +310,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
make_customer: function() {
|
||||
var me = this;
|
||||
|
||||
if(this.default_customer){
|
||||
if(this.default_customer && !this.frm.doc.customer){
|
||||
this.party_field.$input.val(this.default_customer);
|
||||
this.frm.doc.customer = this.default_customer;
|
||||
}
|
||||
@ -535,7 +543,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
customer_validate: function(){
|
||||
var me = this;
|
||||
|
||||
if(!this.frm.doc.customer){
|
||||
frappe.throw(__("Please select customer"))
|
||||
}
|
||||
@ -598,21 +605,21 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
? this.item_serial_no[this.child.item_code][0] : '');
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
refresh: function(update_paid_amount) {
|
||||
var me = this;
|
||||
this.refresh_fields();
|
||||
this.refresh_fields(update_paid_amount);
|
||||
this.update_qty();
|
||||
this.update_rate();
|
||||
this.set_primary_action();
|
||||
},
|
||||
refresh_fields: function() {
|
||||
refresh_fields: function(update_paid_amount) {
|
||||
this.apply_pricing_rule();
|
||||
this.discount_amount_applied = false;
|
||||
this._calculate_taxes_and_totals();
|
||||
this.calculate_discount_amount();
|
||||
this.show_items_in_item_cart();
|
||||
this.set_taxes();
|
||||
this.calculate_outstanding_amount();
|
||||
this.calculate_outstanding_amount(update_paid_amount);
|
||||
this.set_totals();
|
||||
},
|
||||
|
||||
|
@ -394,7 +394,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "project",
|
||||
"depends_on": "",
|
||||
"fieldname": "task",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -532,7 +532,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-18 13:57:29.873073",
|
||||
"modified": "2016-07-21 09:59:01.622745",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Timesheet Detail",
|
||||
|
@ -75,7 +75,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
|
||||
var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate",
|
||||
this.frm.doc.name);
|
||||
var company_currency = this.get_company_currency();
|
||||
var company_currency = this.frm.doc.currency || this.get_company_currency();
|
||||
|
||||
if(!this.frm.doc.conversion_rate) {
|
||||
if(this.frm.doc.currency == company_currency) {
|
||||
@ -427,7 +427,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
this.frm.doc.currency, precision("rounded_total"));
|
||||
}
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
|
||||
var company_currency = this.get_company_currency();
|
||||
var company_currency = this.frm.doc.currency || this.get_company_currency();
|
||||
|
||||
this.frm.doc.base_rounded_total =
|
||||
round_based_on_smallest_currency_fraction(this.frm.doc.base_grand_total,
|
||||
@ -587,7 +587,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
if(data.type == "Cash" && payment_status) {
|
||||
data.amount = total_amount_to_pay;
|
||||
payment_status = false;
|
||||
}else{
|
||||
}else if(me.frm.doc.paid_amount){
|
||||
data.amount = 0.0;
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user