[fix] merge-conflicts

This commit is contained in:
Saurabh 2017-11-22 18:01:56 +05:30
commit ed4191ec5b
10 changed files with 87 additions and 58 deletions

View File

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

View File

@ -253,20 +253,24 @@ frappe.ui.form.on('Payment Entry', {
},
callback: function(r, rt) {
if(r.message) {
if(frm.doc.payment_type == "Receive") {
frm.set_value("paid_from", r.message.party_account);
frm.set_value("paid_from_account_currency", r.message.party_account_currency);
frm.set_value("paid_from_account_balance", r.message.account_balance);
} else if (frm.doc.payment_type == "Pay"){
frm.set_value("paid_to", r.message.party_account);
frm.set_value("paid_to_account_currency", r.message.party_account_currency);
frm.set_value("paid_to_account_balance", r.message.account_balance);
}
frm.set_value("party_balance", r.message.party_balance);
frm.events.get_outstanding_documents(frm);
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
frm.set_party_account_based_on_party = false;
frappe.run_serially([
() => {
if(frm.doc.payment_type == "Receive") {
frm.set_value("paid_from", r.message.party_account);
frm.set_value("paid_from_account_currency", r.message.party_account_currency);
frm.set_value("paid_from_account_balance", r.message.account_balance);
} else if (frm.doc.payment_type == "Pay"){
frm.set_value("paid_to", r.message.party_account);
frm.set_value("paid_to_account_currency", r.message.party_account_currency);
frm.set_value("paid_to_account_balance", r.message.account_balance);
}
},
() => frm.set_value("party_balance", r.message.party_balance),
() => frm.events.get_outstanding_documents(frm),
() => frm.events.hide_unhide_fields(frm),
() => frm.events.set_dynamic_labels(frm),
() => { frm.set_party_account_based_on_party = false; }
]);
}
}
});

View File

@ -24,11 +24,11 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) {
frappe.ui.form.on('POS Profile', {
setup: function(frm) {
frm.set_query("online_print_format", function() {
frm.set_query("print_format_for_online", function() {
return {
filters: [
['Print Format', 'doc_type', '=', 'Sales Invoice'],
['Print Format', 'print_format_type', '!=', 'Js'],
['Print Format', 'print_format_type', '=', 'Server'],
]
};
});

View File

@ -247,7 +247,7 @@ class SalesInvoice(SellingController):
super(SalesInvoice, self).set_missing_values(for_validate)
if pos:
return {"print_format": pos.get("print_format") }
return {"print_format": pos.get("print_format_for_online") }
def update_time_sheet(self, sales_invoice):
for d in self.timesheets:

View File

@ -36,8 +36,14 @@
<br>{%= data[i][__("Voucher No")] %}</td>
<td>
{% if(!(filters.customer || filters.supplier)) { %}
{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}<br>{%= __("Remarks") %}:
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
{% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
<br> {%= data[i][__("Customer Name")] %}
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
<br> {%= data[i][__("Supplier Name")] %}
{% } %}
{% } %}
<br>{%= __("Remarks") %}:
{%= data[i][__("Remarks")] %}
</td>
<td style="text-align: right">
@ -66,8 +72,13 @@
<td>
{% if(!(filters.customer || filters.supplier)) { %}
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
<br>{%= __("Remarks") %}:
{% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
<br> {%= data[i][__("Customer Name")] %}
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
<br> {%= data[i][__("Supplier Name")] %}
{% } %}
{% } %}
<br>{%= __("Remarks") %}:
{%= data[i][__("Remarks")] %}
</td>
{% } else { %}

View File

@ -171,7 +171,7 @@ class BuyingController(StockController):
for item in self.get("items"):
if self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
item.rm_supp_cost = 0.0
if item.item_code in self.sub_contracted_items:
if item.bom and item.item_code in self.sub_contracted_items:
self.update_raw_materials_supplied(item, raw_material_table)
if [item.item_code, item.name] not in parent_items:

View File

@ -348,8 +348,10 @@ def setup_budget():
budget.action_if_annual_budget_exceeded = "Warn"
expense_ledger_count = frappe.db.count("Account", {"is_group": "0", "root_type": "Expense"})
add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count), randomize = { "account": ("Account", {"is_group": "0", "root_type": "Expense"})
}, unique="account")
add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count),
randomize = {
"account": ("Account", {"is_group": "0", "root_type": "Expense"})
}, unique="account")
for d in budget.accounts:
d.budget_amount = random.randint(5, 100) * 10000
@ -361,6 +363,7 @@ def setup_pos_profile():
company_abbr = frappe.db.get_value("Company", erpnext.get_default_company(), "abbr")
pos = frappe.new_doc('POS Profile')
pos.user = frappe.db.get_global('demo_accounts_user')
pos.pos_profile_name = "Demo POS Profile"
pos.naming_series = 'SINV-'
pos.update_stock = 0
pos.write_off_account = 'Cost of Goods Sold - '+ company_abbr

View File

@ -103,7 +103,7 @@ class SalesOrder(SellingController):
def validate_delivery_date(self):
if self.order_type == 'Sales':
if not self.delivery_date:
self.delivery_date = max([d.delivery_date for d in self.get("items")])
self.delivery_date = max([d.delivery_date for d in self.get("items") if d.delivery_date])
if self.delivery_date:
for d in self.get("items"):

View File

@ -53,9 +53,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
() => this.setup_pos_profile(),
() => this.make_new_invoice(),
() => {
frappe.timeout(1);
this.make_items();
this.set_pos_profile_data();
this.bind_events();
frappe.dom.unfreeze();
},
() => this.page.set_title(__('Point of Sale'))
@ -295,12 +293,6 @@ erpnext.pos.PointOfSale = class PointOfSale {
})
}
set_pos_profile_data() {
if (this.pos_profile && this.pos_profile.print_format_for_online) {
this.frm.meta.default_print_format = this.pos_profile.print_format_for_online;
}
}
setup_pos_profile() {
return new Promise((resolve) => {
@ -382,17 +374,21 @@ erpnext.pos.PointOfSale = class PointOfSale {
make_new_invoice() {
return frappe.run_serially([
() => this.make_sales_invoice_frm(),
() => {
if (this.cart) {
this.cart.frm = this.frm;
this.cart.reset();
this.items.reset_search_field();
} else {
this.make_cart();
}
this.toggle_editing(true);
}
this.make_sales_invoice_frm()
.then(() => this.set_pos_profile_data())
.then(() => {
if (this.cart) {
this.cart.frm = this.frm;
this.cart.reset();
this.items.reset_search_field();
} else {
this.make_items();
this.make_cart();
}
this.toggle_editing(true);
})
},
]);
}
@ -419,12 +415,29 @@ erpnext.pos.PointOfSale = class PointOfSale {
if(!frm.doc.company) {
frm.set_value('company', pos_profile.company);
}
frm.set_value('is_pos', 1);
frm.meta.default_print_format = 'POS Invoice';
frm.doc.is_pos = 1;
return frm;
}
}
set_pos_profile_data() {
return new Promise(resolve => {
return this.frm.call({
doc: this.frm.doc,
method: "set_missing_values",
}).then((r) => {
if(!r.exc) {
this.frm.script_manager.trigger("update_stock");
frappe.model.set_default_values(this.frm.doc);
this.frm.cscript.calculate_taxes_and_totals();
this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice';
}
resolve();
})
})
}
prepare_menu() {
var me = this;
this.page.clear_menu();
@ -1321,6 +1334,16 @@ class Payment {
$(this.dialog.body).find('.input-with-feedback').focusin(function() {
me.numpad.reset_value();
me.fieldname = $(this).prop('dataset').fieldname;
if (me.frm.doc.outstanding_amount > 0 &&
!in_list(['write_off_amount', 'change_amount'], me.fieldname)) {
me.frm.doc.payments.forEach((data) => {
if (data.mode_of_payment == me.fieldname && !data.amount) {
me.dialog.set_value(me.fieldname,
me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate);
return;
}
})
}
});
}
@ -1460,4 +1483,4 @@ class Payment {
this.dialog.set_value("paid_amount", this.frm.doc.paid_amount);
this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount);
}
}
}

View File

@ -96,16 +96,6 @@ def get_item_details(args):
return out
# print(frappe._dict({
# 'has_serial_no' : out.has_serial_no,
# 'has_batch_no' : out.has_batch_no
# }))
# return frappe._dict({
# 'has_serial_no' : out.has_serial_no,
# 'has_batch_no' : out.has_batch_no
# })
def process_args(args):
if isinstance(args, basestring):
args = json.loads(args)
@ -538,8 +528,6 @@ def get_default_bom(item_code=None):
bom = frappe.db.get_value("BOM", {"docstatus": 1, "is_default": 1, "is_active": 1, "item": item_code})
if bom:
return bom
else:
frappe.throw(_("No default BOM exists for Item {0}").format(item_code))
def get_valuation_rate(item_code, warehouse=None):
item = frappe.get_doc("Item", item_code)