Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
895f61da84
@ -196,7 +196,8 @@ class DocType(BuyingController):
|
|||||||
"Purchase Order Item": {
|
"Purchase Order Item": {
|
||||||
"ref_dn_field": "po_detail",
|
"ref_dn_field": "po_detail",
|
||||||
"compare_fields": [["project_name", "="], ["item_code", "="], ["uom", "="]],
|
"compare_fields": [["project_name", "="], ["item_code", "="], ["uom", "="]],
|
||||||
"is_child_table": True
|
"is_child_table": True,
|
||||||
|
"allow_duplicate_prev_row_id": True
|
||||||
},
|
},
|
||||||
"Purchase Receipt": {
|
"Purchase Receipt": {
|
||||||
"ref_dn_field": "purchase_receipt",
|
"ref_dn_field": "purchase_receipt",
|
||||||
@ -214,7 +215,8 @@ class DocType(BuyingController):
|
|||||||
"Purchase Order Item": {
|
"Purchase Order Item": {
|
||||||
"ref_dn_field": "po_detail",
|
"ref_dn_field": "po_detail",
|
||||||
"compare_fields": [["import_rate", "="]],
|
"compare_fields": [["import_rate", "="]],
|
||||||
"is_child_table": True
|
"is_child_table": True,
|
||||||
|
"allow_duplicate_prev_row_id": True
|
||||||
},
|
},
|
||||||
"Purchase Receipt Item": {
|
"Purchase Receipt Item": {
|
||||||
"ref_dn_field": "pr_detail",
|
"ref_dn_field": "pr_detail",
|
||||||
|
|||||||
@ -65,7 +65,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
|
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||||
|
|
||||||
if(doc.is_pos==1 && doc.update_stock!=1)
|
if(cint(doc.update_stock)!=1)
|
||||||
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
|
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
|
||||||
|
|
||||||
if(doc.outstanding_amount!=0)
|
if(doc.outstanding_amount!=0)
|
||||||
@ -198,8 +198,7 @@ cur_frm.cscript.hide_fields = function(doc) {
|
|||||||
'total_commission', 'advances'];
|
'total_commission', 'advances'];
|
||||||
|
|
||||||
item_flds_normal = ['sales_order', 'delivery_note']
|
item_flds_normal = ['sales_order', 'delivery_note']
|
||||||
item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty',
|
item_flds_pos = ['serial_no', 'batch_no', 'actual_qty', 'expense_account']
|
||||||
'delivered_qty', 'expense_account']
|
|
||||||
|
|
||||||
if(cint(doc.is_pos) == 1) {
|
if(cint(doc.is_pos) == 1) {
|
||||||
hide_field(par_flds);
|
hide_field(par_flds);
|
||||||
|
|||||||
@ -388,7 +388,8 @@ class DocType(SellingController):
|
|||||||
"Sales Order Item": {
|
"Sales Order Item": {
|
||||||
"ref_dn_field": "so_detail",
|
"ref_dn_field": "so_detail",
|
||||||
"compare_fields": [["export_rate", "="]],
|
"compare_fields": [["export_rate", "="]],
|
||||||
"is_child_table": True
|
"is_child_table": True,
|
||||||
|
"allow_duplicate_prev_row_id": True
|
||||||
},
|
},
|
||||||
"Delivery Note Item": {
|
"Delivery Note Item": {
|
||||||
"ref_dn_field": "dn_detail",
|
"ref_dn_field": "dn_detail",
|
||||||
@ -983,3 +984,49 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
|
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
|
||||||
|
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def make_delivery_note(source_name, target_doclist=None):
|
||||||
|
from webnotes.model.mapper import get_mapped_doclist
|
||||||
|
|
||||||
|
def set_missing_values(source, target):
|
||||||
|
bean = webnotes.bean(target)
|
||||||
|
bean.run_method("onload_post_render")
|
||||||
|
|
||||||
|
def update_item(obj, target, source_parent):
|
||||||
|
target.amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)
|
||||||
|
target.export_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)
|
||||||
|
target.qty = flt(obj.qty) - flt(obj.delivered_qty)
|
||||||
|
|
||||||
|
doclist = get_mapped_doclist("Sales Invoice", source_name, {
|
||||||
|
"Sales Invoice": {
|
||||||
|
"doctype": "Delivery Note",
|
||||||
|
"validation": {
|
||||||
|
"docstatus": ["=", 1]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Sales Invoice Item": {
|
||||||
|
"doctype": "Delivery Note Item",
|
||||||
|
"field_map": {
|
||||||
|
"name": "prevdoc_detail_docname",
|
||||||
|
"parent": "prevdoc_docname",
|
||||||
|
"parenttype": "prevdoc_doctype",
|
||||||
|
"serial_no": "serial_no"
|
||||||
|
},
|
||||||
|
"postprocess": update_item
|
||||||
|
},
|
||||||
|
"Sales Taxes and Charges": {
|
||||||
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
"add_if_empty": True
|
||||||
|
},
|
||||||
|
"Sales Team": {
|
||||||
|
"doctype": "Sales Team",
|
||||||
|
"field_map": {
|
||||||
|
"incentives": "incentives"
|
||||||
|
},
|
||||||
|
"add_if_empty": True
|
||||||
|
}
|
||||||
|
}, target_doclist, set_missing_values)
|
||||||
|
|
||||||
|
return [d.fields for d in doclist]
|
||||||
@ -607,8 +607,6 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
self.assertEquals(new_si.doc.invoice_period_to_date,
|
self.assertEquals(new_si.doc.invoice_period_to_date,
|
||||||
unicode(add_months(base_si.doc.invoice_period_to_date, no_of_months)))
|
unicode(add_months(base_si.doc.invoice_period_to_date, no_of_months)))
|
||||||
|
|
||||||
self.assertEquals(getdate(new_si.doc.posting_date).day,
|
|
||||||
base_si.doc.repeat_on_day_of_month)
|
|
||||||
|
|
||||||
return new_si
|
return new_si
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,14 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.each([["supplier", "supplier"],
|
||||||
|
["contact_person", "supplier_filter"],
|
||||||
|
["supplier_address", "supplier_filter"]],
|
||||||
|
function(i, opts) {
|
||||||
|
if(me.frm.fields_dict[opts[0]])
|
||||||
|
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||||
|
});
|
||||||
|
|
||||||
if(this.frm.fields_dict.supplier) {
|
if(this.frm.fields_dict.supplier) {
|
||||||
this.frm.set_query("supplier", function() {
|
this.frm.set_query("supplier", function() {
|
||||||
return{ query:"controllers.queries.supplier_query" }});
|
return{ query:"controllers.queries.supplier_query" }});
|
||||||
|
|||||||
@ -169,9 +169,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
if(length(tabItem.description) > 40, \
|
if(length(tabItem.description) > 40, \
|
||||||
concat(substr(tabItem.description, 1, 40), "..."), description) as decription
|
concat(substr(tabItem.description, 1, 40), "..."), description) as decription
|
||||||
from tabItem
|
from tabItem
|
||||||
where tabItem.docstatus!=2
|
where tabItem.docstatus<2
|
||||||
and (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00")
|
|
||||||
or `tabItem`.`end_of_life` > NOW())
|
|
||||||
and (tabItem.%(key)s LIKE "%(txt)s"
|
and (tabItem.%(key)s LIKE "%(txt)s"
|
||||||
or tabItem.item_name LIKE "%(txt)s")
|
or tabItem.item_name LIKE "%(txt)s")
|
||||||
%(fcond)s %(mcond)s
|
%(fcond)s %(mcond)s
|
||||||
|
|||||||
@ -18,10 +18,9 @@
|
|||||||
cur_frm.cscript.refresh = function(doc,dt,dn){
|
cur_frm.cscript.refresh = function(doc,dt,dn){
|
||||||
cur_frm.toggle_enable("item", doc.__islocal);
|
cur_frm.toggle_enable("item", doc.__islocal);
|
||||||
|
|
||||||
if (!doc.__islocal && doc.docstatus==0) {
|
if (!doc.__islocal && doc.docstatus<2) {
|
||||||
cur_frm.set_intro("Submit the BOM to use it for manufacturing or repacking.");
|
|
||||||
cur_frm.add_custom_button("Update Cost", cur_frm.cscript.update_cost);
|
cur_frm.add_custom_button("Update Cost", cur_frm.cscript.update_cost);
|
||||||
} else cur_frm.set_intro("");
|
}
|
||||||
|
|
||||||
cur_frm.cscript.with_operations(doc);
|
cur_frm.cscript.with_operations(doc);
|
||||||
set_operation_no(doc);
|
set_operation_no(doc);
|
||||||
|
|||||||
@ -144,8 +144,12 @@ class DocType:
|
|||||||
'qty': d.qty
|
'qty': d.qty
|
||||||
})["rate"]
|
})["rate"]
|
||||||
|
|
||||||
self.on_update()
|
if self.doc.docstatus == 0:
|
||||||
|
webnotes.bean(self.doclist).save()
|
||||||
|
elif self.doc.docstatus == 1:
|
||||||
|
self.calculate_cost()
|
||||||
|
self.update_exploded_items()
|
||||||
|
webnotes.bean(self.doclist).update_after_submit()
|
||||||
|
|
||||||
def get_bom_unitcost(self, bom_no):
|
def get_bom_unitcost(self, bom_no):
|
||||||
bom = sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
|
bom = sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
|
||||||
|
|||||||
9
patches/july_2013/p11_update_price_list_currency.py
Normal file
9
patches/july_2013/p11_update_price_list_currency.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for price_list_name in webnotes.conn.sql_list("""select name from `tabPrice List`
|
||||||
|
where ifnull(currency, '')=''"""):
|
||||||
|
res = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price`
|
||||||
|
where price_list_name=%s""", price_list_name)
|
||||||
|
if res and len(res)==1 and res[0][0]:
|
||||||
|
webnotes.conn.set_value("Price List", price_list_name, "currency", res[0][0])
|
||||||
@ -262,4 +262,6 @@ patch_list = [
|
|||||||
"patches.july_2013.p08_custom_print_format_net_total_export",
|
"patches.july_2013.p08_custom_print_format_net_total_export",
|
||||||
"patches.july_2013.p09_remove_website_pyc",
|
"patches.july_2013.p09_remove_website_pyc",
|
||||||
"patches.july_2013.p10_change_partner_user_to_website_user",
|
"patches.july_2013.p10_change_partner_user_to_website_user",
|
||||||
|
"patches.july_2013.p11_update_price_list_currency",
|
||||||
|
"execute:webnotes.bean('Selling Settings').save() #2013-07-29",
|
||||||
]
|
]
|
||||||
@ -58,6 +58,15 @@ $.extend(erpnext.queries, {
|
|||||||
return { filters: { customer: doc.customer } };
|
return { filters: { customer: doc.customer } };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
supplier_filter: function(doc) {
|
||||||
|
if(!doc.supplier) {
|
||||||
|
wn.throw(wn._("Please specify a") + " " +
|
||||||
|
wn._(wn.meta.get_label(doc.doctype, "supplier", doc.name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { filters: { supplier: doc.supplier } };
|
||||||
|
},
|
||||||
|
|
||||||
not_a_group_filter: function() {
|
not_a_group_filter: function() {
|
||||||
return { filters: { is_group: "No" } };
|
return { filters: { is_group: "No" } };
|
||||||
},
|
},
|
||||||
|
|||||||
@ -36,21 +36,14 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
|
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
|
||||||
|
|
||||||
if(this.frm.fields_dict.shipping_address_name && this.frm.fields_dict.customer_address) {
|
$.each([["customer_address", "customer_filter"],
|
||||||
this.frm.fields_dict.shipping_address_name.get_query =
|
["shipping_address_name", "customer_filter"],
|
||||||
this.frm.fields_dict['customer_address'].get_query;
|
["contact_person", "customer_filter"],
|
||||||
}
|
["customer", "customer"],
|
||||||
|
["lead", "lead"]],
|
||||||
this.frm.set_query("customer_address", function() {
|
function(i, opts) {
|
||||||
return {
|
if(me.frm.fields_dict[opts[0]])
|
||||||
filters: {'customer': me.frm.doc.customer }
|
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.frm.set_query("contact_person", function() {
|
|
||||||
return {
|
|
||||||
filters: {'customer': me.frm.doc.customer }
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(this.frm.fields_dict.charge) {
|
if(this.frm.fields_dict.charge) {
|
||||||
@ -64,12 +57,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
|
||||||
return{ query:"controllers.queries.customer_query" } }
|
|
||||||
|
|
||||||
this.frm.fields_dict.lead && this.frm.set_query("lead", function(doc,cdt,cdn) {
|
|
||||||
return{ query:"controllers.queries.lead_query" } });
|
|
||||||
|
|
||||||
if(this.frm.fields_dict.price_list_name) {
|
if(this.frm.fields_dict.price_list_name) {
|
||||||
this.frm.set_query("price_list_name", function() {
|
this.frm.set_query("price_list_name", function() {
|
||||||
return { filters: { buying_or_selling: "Selling" } };
|
return { filters: { buying_or_selling: "Selling" } };
|
||||||
@ -130,11 +117,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.frm.fields_dict.sales_team && this.frm.fields_dict.sales_team.grid.get_field("sales_person")) {
|
if(this.frm.fields_dict.sales_team && this.frm.fields_dict.sales_team.grid.get_field("sales_person")) {
|
||||||
this.frm.set_query("sales_person", "sales_team", function() {
|
this.frm.set_query("sales_person", "sales_team", erpnext.queries.not_a_group_filter);
|
||||||
return {
|
|
||||||
filters: { is_group: "No" }
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -8,5 +8,5 @@ class DocType:
|
|||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
for key in ["cust_master_name", "customer_group", "territory", "allow_same_sales_rate"]:
|
for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate"]:
|
||||||
webnotes.conn.set_default(key, self.doc.fields.get(key, ""))
|
webnotes.conn.set_default(key, self.doc.fields.get(key, ""))
|
||||||
|
|||||||
@ -113,8 +113,11 @@ class DocType(SellingController):
|
|||||||
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
|
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
|
||||||
|
|
||||||
def validate_with_previous_doc(self):
|
def validate_with_previous_doc(self):
|
||||||
|
prev_doctype = [d.prevdoc_doctype for d in self.doclist.get({
|
||||||
|
"parentfield": "delivery_note_details", "prevdoc_doctype": ["!=", ""]})]
|
||||||
|
if prev_doctype:
|
||||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||||
"Sales Order": {
|
prev_doctype[0]: {
|
||||||
"ref_dn_field": "prevdoc_docname",
|
"ref_dn_field": "prevdoc_docname",
|
||||||
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
|
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
|
||||||
["currency", "="]],
|
["currency", "="]],
|
||||||
@ -122,7 +125,7 @@ class DocType(SellingController):
|
|||||||
})
|
})
|
||||||
if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
|
if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
|
||||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||||
"Sales Order Item": {
|
prev_doctype[0] + " Item": {
|
||||||
"ref_dn_field": "prevdoc_detail_docname",
|
"ref_dn_field": "prevdoc_detail_docname",
|
||||||
"compare_fields": [["export_rate", "="]],
|
"compare_fields": [["export_rate", "="]],
|
||||||
"is_child_table": True
|
"is_child_table": True
|
||||||
|
|||||||
@ -308,7 +308,7 @@ class TransactionBase(StatusUpdater):
|
|||||||
self.compare_values({key: [ref_dn]}, val["compare_fields"], d)
|
self.compare_values({key: [ref_dn]}, val["compare_fields"], d)
|
||||||
if ref_dn not in item_ref_dn:
|
if ref_dn not in item_ref_dn:
|
||||||
item_ref_dn.append(ref_dn)
|
item_ref_dn.append(ref_dn)
|
||||||
else:
|
elif not val.get("allow_duplicate_prev_row_id"):
|
||||||
webnotes.msgprint(_("Row ") + cstr(d.idx + 1) +
|
webnotes.msgprint(_("Row ") + cstr(d.idx + 1) +
|
||||||
_(": Duplicate row from same ") + key, raise_exception=1)
|
_(": Duplicate row from same ") + key, raise_exception=1)
|
||||||
elif ref_dn:
|
elif ref_dn:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user