Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87b5fcb3b5 | ||
|
|
7489d29813 | ||
|
|
268d300030 | ||
|
|
7f77002015 | ||
|
|
b28573ab03 | ||
|
|
c756ff67b0 | ||
|
|
4e72ef1421 | ||
|
|
6b173f3a67 | ||
|
|
fcfced624a | ||
|
|
64949bfc4b | ||
|
|
438c4fb279 | ||
|
|
ae4c8a6a48 | ||
|
|
0d7213122a | ||
|
|
4268b0092a | ||
|
|
64e31e9a4e | ||
|
|
0a0c267edb | ||
|
|
1a8d4b6ea7 | ||
|
|
97426776bd | ||
|
|
60e7f01fd4 | ||
|
|
169089bdde | ||
|
|
c14f80838b | ||
|
|
a5007db902 | ||
|
|
0d58501229 | ||
|
|
7c654cd1bb | ||
|
|
54fc260a42 | ||
|
|
7a39d51366 | ||
|
|
79c94426f7 | ||
|
|
c3ced9a0b5 | ||
|
|
915778fb69 |
@@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.7.1'
|
||||
__version__ = '6.7.7'
|
||||
|
||||
@@ -168,7 +168,11 @@ def get_pricing_rules(args):
|
||||
field = frappe.scrub(parenttype)
|
||||
condition = ""
|
||||
if args.get(field):
|
||||
lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"])
|
||||
try:
|
||||
lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"])
|
||||
except TypeError:
|
||||
frappe.throw(_("Invalid {0}").format(args[field]))
|
||||
|
||||
parent_groups = frappe.db.sql_list("""select name from `tab%s`
|
||||
where lft<=%s and rgt>=%s""" % (parenttype, '%s', '%s'), (lft, rgt))
|
||||
|
||||
|
||||
@@ -98,11 +98,17 @@ class GrossProfitGenerator(object):
|
||||
|
||||
row.base_amount = flt(row.base_net_amount)
|
||||
|
||||
product_bundles = self.product_bundles.get(row.parenttype, {}).get(row.parent, frappe._dict())
|
||||
|
||||
if row.update_stock:
|
||||
product_bundles = self.product_bundles.get(row.parenttype, {}).get(row.parent, frappe._dict())
|
||||
elif row.dn_detail:
|
||||
product_bundles = self.product_bundles.get("Delivery Note", {})\
|
||||
.get(row.delivery_note, frappe._dict())
|
||||
row.item_row = row.dn_detail
|
||||
|
||||
# get buying amount
|
||||
if row.item_code in product_bundles:
|
||||
row.buying_amount = self.get_buying_amount_from_product_bundle(row, product_bundles[row.item_code])
|
||||
row.buying_amount = self.get_buying_amount_from_product_bundle(row,
|
||||
product_bundles[row.item_code])
|
||||
else:
|
||||
row.buying_amount = self.get_buying_amount(row, row.item_code)
|
||||
|
||||
@@ -142,7 +148,6 @@ class GrossProfitGenerator(object):
|
||||
new_row.qty += row.qty
|
||||
new_row.buying_amount += row.buying_amount
|
||||
new_row.base_amount += row.base_amount
|
||||
# new_row.allocated_amount += (row.allocated_amount or 0) if new_row.allocated_amount else 0
|
||||
|
||||
new_row.gross_profit = new_row.base_amount - new_row.buying_amount
|
||||
new_row.gross_profit_percent = ((new_row.gross_profit / new_row.base_amount) * 100.0) \
|
||||
@@ -158,9 +163,9 @@ class GrossProfitGenerator(object):
|
||||
|
||||
def get_buying_amount_from_product_bundle(self, row, product_bundle):
|
||||
buying_amount = 0.0
|
||||
for bom_item in product_bundle:
|
||||
if bom_item.get("parent_detail_docname")==row.item_row:
|
||||
buying_amount += self.get_buying_amount(row, bom_item.item_code)
|
||||
for packed_item in product_bundle:
|
||||
if packed_item.get("parent_detail_docname")==row.item_row:
|
||||
buying_amount += self.get_buying_amount(row, packed_item.item_code)
|
||||
|
||||
return buying_amount
|
||||
|
||||
@@ -176,14 +181,14 @@ class GrossProfitGenerator(object):
|
||||
else:
|
||||
my_sle = self.sle.get((item_code, row.warehouse))
|
||||
if (row.update_stock or row.dn_detail) and my_sle:
|
||||
parenttype, parent, item_row = row.parenttype, row.parent, row.item_row
|
||||
parenttype, parent = row.parenttype, row.parent
|
||||
if row.dn_detail:
|
||||
parenttype, parent, item_row = "Delivery Note", row.delivery_note, row.dn_detail
|
||||
parenttype, parent = "Delivery Note", row.delivery_note
|
||||
|
||||
for i, sle in enumerate(my_sle):
|
||||
# find the stock valution rate from stock ledger entry
|
||||
if sle.voucher_type == parenttype and parent == sle.voucher_no and \
|
||||
sle.voucher_detail_no == item_row:
|
||||
sle.voucher_detail_no == row.item_row:
|
||||
previous_stock_value = len(my_sle) > i+1 and \
|
||||
flt(my_sle[i+1].stock_value) or 0.0
|
||||
return previous_stock_value - flt(sle.stock_value)
|
||||
|
||||
@@ -12,6 +12,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['address_html','contact_html']);
|
||||
erpnext.utils.clear_address_and_contact(cur_frm);
|
||||
}
|
||||
else{
|
||||
unhide_field(['address_html','contact_html']);
|
||||
|
||||
@@ -37,6 +37,8 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
|
||||
if(!this.frm.doc.__islocal) {
|
||||
erpnext.utils.render_address_and_contact(cur_frm);
|
||||
} else {
|
||||
erpnext.utils.clear_address_and_contact(cur_frm);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ blogs.
|
||||
"""
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "6.7.1"
|
||||
app_version = "6.7.7"
|
||||
source_link = "https://github.com/frappe/erpnext"
|
||||
|
||||
error_report_email = "support@erpnext.com"
|
||||
|
||||
@@ -196,11 +196,11 @@ class ProcessPayroll(Document):
|
||||
journal_entry.set("accounts", [
|
||||
{
|
||||
"account": salary_account,
|
||||
"debit": amount
|
||||
"debit_in_account_currency": amount
|
||||
},
|
||||
{
|
||||
"account": default_bank_account,
|
||||
"credit": amount
|
||||
"credit_in_account_currency": amount
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
@@ -230,3 +230,4 @@ erpnext.patches.v6_5.show_in_website_for_template_item
|
||||
erpnext.patches.v6_4.fix_expense_included_in_valuation
|
||||
execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate")
|
||||
erpnext.patches.v6_6.fix_website_image
|
||||
erpnext.patches.v6_6.remove_fiscal_year_from_leave_allocation
|
||||
|
||||
@@ -2,14 +2,16 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for leave_allocation in frappe.db.sql("select name, fiscal_year from `tabLeave Allocation`", as_dict=True):
|
||||
year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", leave_allocation["fiscal_year"],
|
||||
["year_start_date", "year_end_date"])
|
||||
|
||||
frappe.db.sql("""update `tabLeave Allocation`
|
||||
set from_date=%s, to_date=%s where name=%s""",
|
||||
(year_start_date, year_end_date, leave_allocation["name"]))
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
|
||||
frappe.reload_doctype("Leave Allocation")
|
||||
if frappe.db.has_column("Leave Allocation", "fiscal_year"):
|
||||
for leave_allocation in frappe.db.sql("select name, fiscal_year from `tabLeave Allocation`", as_dict=True):
|
||||
dates = frappe.db.get_value("Fiscal Year", leave_allocation["fiscal_year"],
|
||||
["year_start_date", "year_end_date"])
|
||||
|
||||
if dates:
|
||||
year_start_date, year_end_date = dates
|
||||
|
||||
frappe.db.sql("""update `tabLeave Allocation`
|
||||
set from_date=%s, to_date=%s where name=%s""",
|
||||
(year_start_date, year_end_date, leave_allocation["name"]))
|
||||
|
||||
|
||||
@@ -100,6 +100,11 @@ $.extend(erpnext, {
|
||||
|
||||
|
||||
$.extend(erpnext.utils, {
|
||||
clear_address_and_contact: function(frm) {
|
||||
$(frm.fields_dict['address_html'].wrapper).html("");
|
||||
frm.fields_dict['contact_html'] && $(frm.fields_dict['contact_html'].wrapper).html("");
|
||||
},
|
||||
|
||||
render_address_and_contact: function(frm) {
|
||||
// render address
|
||||
$(frm.fields_dict['address_html'].wrapper)
|
||||
|
||||
@@ -14,6 +14,8 @@ frappe.ui.form.on("Customer", "refresh", function(frm) {
|
||||
|
||||
if(!frm.doc.__islocal) {
|
||||
erpnext.utils.render_address_and_contact(frm);
|
||||
} else {
|
||||
erpnext.utils.clear_address_and_contact(frm);
|
||||
}
|
||||
|
||||
var grid = cur_frm.get_field("sales_team").grid;
|
||||
|
||||
@@ -15,22 +15,31 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
refresh: function(doc, dt, dn) {
|
||||
this._super();
|
||||
this.frm.dashboard.reset();
|
||||
var is_delivered_by_supplier = false;
|
||||
var is_delivery_note = false;
|
||||
var allow_purchase = false;
|
||||
var allow_delivery = false;
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
if(doc.status != 'Stopped' && doc.status != 'Closed') {
|
||||
|
||||
$.each(cur_frm.doc.items, function(i, item){
|
||||
if(item.delivered_by_supplier == 1 || item.supplier){
|
||||
if(item.qty > flt(item.ordered_qty))
|
||||
is_delivered_by_supplier = true;
|
||||
for (var i in cur_frm.doc.items) {
|
||||
var item = cur_frm.doc.items[i];
|
||||
if(item.delivered_by_supplier === 1 || item.supplier){
|
||||
if(item.qty > flt(item.ordered_qty)
|
||||
&& item.qty > flt(item.delivered_qty)) {
|
||||
allow_purchase = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(item.qty > flt(item.delivered_qty))
|
||||
is_delivery_note = true;
|
||||
|
||||
if (item.delivered_by_supplier===0) {
|
||||
if(item.qty > flt(item.delivered_qty)) {
|
||||
allow_delivery = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (allow_delivery && allow_purchase) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// material request
|
||||
if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1
|
||||
@@ -39,7 +48,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
}
|
||||
|
||||
// make purchase order
|
||||
if(flt(doc.per_delivered, 2) < 100 && is_delivered_by_supplier) {
|
||||
if(flt(doc.per_delivered, 2) < 100 && allow_purchase) {
|
||||
cur_frm.add_custom_button(__('Purchase Order'), cur_frm.cscript.make_purchase_order);
|
||||
}
|
||||
|
||||
@@ -62,7 +71,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
}
|
||||
|
||||
// delivery note
|
||||
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && is_delivery_note) {
|
||||
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && allow_delivery) {
|
||||
cur_frm.add_custom_button(__('Delivery'), this.make_delivery_note).addClass("btn-primary");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['address_html', 'contact_html']);
|
||||
erpnext.utils.clear_address_and_contact(cur_frm);
|
||||
}
|
||||
else{
|
||||
unhide_field(['address_html', 'contact_html']);
|
||||
|
||||
@@ -78,11 +78,6 @@ frappe.ui.form.on("Item", {
|
||||
frm.set_value("description", frm.doc.item_code);
|
||||
},
|
||||
|
||||
tax_type: function(frm, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
return get_server_fields('get_tax_rate', d.tax_type, 'taxes', doc, cdt, cdn, 1);
|
||||
},
|
||||
|
||||
copy_from_item_group: function(frm) {
|
||||
return frm.call({
|
||||
doc: frm.doc,
|
||||
@@ -315,3 +310,4 @@ cur_frm.add_fetch('attribute', 'numeric_values', 'numeric_values');
|
||||
cur_frm.add_fetch('attribute', 'from_range', 'from_range');
|
||||
cur_frm.add_fetch('attribute', 'to_range', 'to_range');
|
||||
cur_frm.add_fetch('attribute', 'increment', 'increment');
|
||||
cur_frm.add_fetch('tax_type', 'tax_rate', 'tax_rate');
|
||||
|
||||
@@ -398,9 +398,6 @@ class Item(WebsiteGenerator):
|
||||
item_description=%s, modified=NOW() where item_code=%s""",
|
||||
(self.item_name, self.description, self.name))
|
||||
|
||||
def get_tax_rate(self, tax_type):
|
||||
return { "tax_rate": frappe.db.get_value("Account", tax_type, "tax_rate") }
|
||||
|
||||
def on_trash(self):
|
||||
super(Item, self).on_trash()
|
||||
frappe.db.sql("""delete from tabBin where item_code=%s""", self.item_code)
|
||||
|
||||
@@ -143,22 +143,23 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
|
||||
make_purchase_order: function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
|
||||
frm: cur_frm
|
||||
})
|
||||
frm: cur_frm,
|
||||
run_link_triggers: true
|
||||
});
|
||||
},
|
||||
|
||||
make_supplier_quotation: function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
|
||||
frm: cur_frm
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
make_stock_entry: function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.material_request.material_request.make_stock_entry",
|
||||
frm: cur_frm
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user