[minor] [fix] price list currency read only and SO-MR mapping
This commit is contained in:
parent
648a5c7e33
commit
48a0bd3eda
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:39",
|
"creation": "2013-05-21 16:16:39",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:51:06",
|
"modified": "2013-07-23 15:27:03",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -273,7 +273,7 @@
|
|||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "price_list_name",
|
"depends_on": "price_list_name",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:05",
|
"creation": "2013-05-24 19:29:05",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:48:05",
|
"modified": "2013-07-23 15:28:32",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -279,7 +279,7 @@
|
|||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:39",
|
"creation": "2013-05-21 16:16:39",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-19 22:04:17",
|
"modified": "2013-07-23 15:26:28",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -225,7 +225,8 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "price_list_name",
|
"depends_on": "price_list_name",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:45",
|
"creation": "2013-05-21 16:16:45",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:49:31",
|
"modified": "2013-07-23 15:27:23",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -222,7 +222,8 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "price_list_name",
|
"depends_on": "price_list_name",
|
||||||
|
@ -57,10 +57,7 @@ class AccountsController(TransactionBase):
|
|||||||
# TODO - change this, since price list now has only one currency allowed
|
# TODO - change this, since price list now has only one currency allowed
|
||||||
if self.meta.get_field("price_list_name") and self.doc.price_list_name and \
|
if self.meta.get_field("price_list_name") and self.doc.price_list_name and \
|
||||||
not self.doc.price_list_currency:
|
not self.doc.price_list_currency:
|
||||||
self.doc.fields.update(get_price_list_currency({
|
self.doc.fields.update(get_price_list_currency(self.doc.price_list_name))
|
||||||
"price_list_name": self.doc.price_list_name,
|
|
||||||
"buying_or_selling": buying_or_selling
|
|
||||||
}))
|
|
||||||
|
|
||||||
if self.doc.price_list_currency:
|
if self.doc.price_list_currency:
|
||||||
if not self.doc.plc_conversion_rate:
|
if not self.doc.plc_conversion_rate:
|
||||||
|
@ -74,14 +74,9 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
|
|||||||
|
|
||||||
company: function() {
|
company: function() {
|
||||||
if(this.frm.doc.company && this.frm.fields_dict.currency) {
|
if(this.frm.doc.company && this.frm.fields_dict.currency) {
|
||||||
var me = this;
|
|
||||||
var company_currency = this.get_company_currency();
|
var company_currency = this.get_company_currency();
|
||||||
$.each(["currency", "price_list_currency"], function(i, fieldname) {
|
this.frm.set_value("currency", company_currency);
|
||||||
if(!me.frm.doc[fieldname]) {
|
this.frm.script_manager.trigger("currency");
|
||||||
me.frm.set_value(fieldname, company_currency);
|
|
||||||
me.script_manager.trigger(fieldname);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -123,10 +118,9 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
|
|||||||
if(this.frm.doc.price_list_name) {
|
if(this.frm.doc.price_list_name) {
|
||||||
this.frm.call({
|
this.frm.call({
|
||||||
method: "setup.utils.get_price_list_currency",
|
method: "setup.utils.get_price_list_currency",
|
||||||
args: { args: {
|
args: {
|
||||||
price_list_name: this.frm.doc.price_list_name,
|
price_list_name: this.frm.doc.price_list_name,
|
||||||
buying_or_selling: buying_or_selling
|
},
|
||||||
}},
|
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
me.price_list_currency();
|
me.price_list_currency();
|
||||||
|
@ -20,7 +20,7 @@ $.extend(erpnext, {
|
|||||||
if(!company && cur_frm)
|
if(!company && cur_frm)
|
||||||
company = cur_frm.doc.company;
|
company = cur_frm.doc.company;
|
||||||
if(company)
|
if(company)
|
||||||
return wn.model.get(":Company", company).default_currency || wn.boot.sysdefaults.currency;
|
return wn.model.get_doc(":Company", company).default_currency || wn.boot.sysdefaults.currency;
|
||||||
else
|
else
|
||||||
return wn.boot.sysdefaults.currency;
|
return wn.boot.sysdefaults.currency;
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:08",
|
"creation": "2013-05-24 19:29:08",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:48:56",
|
"modified": "2013-07-23 15:27:53",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -301,7 +301,7 @@
|
|||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -366,7 +366,7 @@ def make_material_request(source_name, target_doclist=None):
|
|||||||
}
|
}
|
||||||
}, target_doclist, postprocess)
|
}, target_doclist, postprocess)
|
||||||
|
|
||||||
return [d.fields for d in doclist]
|
return [(d if isinstance(d, dict) else d.fields) for d in doclist]
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def make_delivery_note(source_name, target_doclist=None):
|
def make_delivery_note(source_name, target_doclist=None):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-06-18 12:39:59",
|
"creation": "2013-06-18 12:39:59",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:47:46",
|
"modified": "2013-07-23 15:27:39",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -311,6 +311,7 @@
|
|||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,20 +44,6 @@ def get_ancestors_of(doctype, name):
|
|||||||
return result or []
|
return result or []
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_price_list_currency(args):
|
def get_price_list_currency(price_list_name):
|
||||||
"""
|
return {"price_list_currency": webnotes.conn.get_value("Price List", price_list_name,
|
||||||
args = {
|
"currency")}
|
||||||
"price_list_name": "Something",
|
|
||||||
"buying_or_selling": "Buying" or "Selling"
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
if isinstance(args, basestring):
|
|
||||||
args = json.loads(args)
|
|
||||||
|
|
||||||
result = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price`
|
|
||||||
where price_list_name=%s and buying_or_selling=%s""",
|
|
||||||
(args.get("price_list_name"), args.get("buying_or_selling")))
|
|
||||||
if result and len(result)==1:
|
|
||||||
return {"price_list_currency": result[0][0]}
|
|
||||||
else:
|
|
||||||
return {}
|
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:09",
|
"creation": "2013-05-24 19:29:09",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:48:27",
|
"modified": "2013-07-23 15:28:18",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -303,7 +303,7 @@
|
|||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:39",
|
"creation": "2013-05-21 16:16:39",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-09 12:50:25",
|
"modified": "2013-07-23 15:26:50",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -251,7 +251,8 @@
|
|||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"label": "Price List Currency",
|
"label": "Price List Currency",
|
||||||
"options": "Currency",
|
"options": "Currency",
|
||||||
"print_hide": 1
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "price_list_name",
|
"depends_on": "price_list_name",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user