refactored purchase cycle's get item details and update item details functions and started with purchase price list
This commit is contained in:
parent
5c03869472
commit
756dca719b
@ -163,13 +163,6 @@ cur_frm.cscript.get_items = function(doc, dt, dn) {
|
||||
$c_obj(make_doclist(dt,dn),'pull_details','',callback);
|
||||
}
|
||||
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.item_code){
|
||||
get_server_fields('get_item_details',d.item_code,'entries',doc,cdt,cdn,1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.allocated_amount = function(doc,cdt,cdn) {
|
||||
calc_total_advance(doc, cdt, cdn);
|
||||
}
|
||||
|
@ -18,28 +18,19 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cint, cstr, flt, formatdate, get_defaults
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, make_autoname
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import form, msgprint
|
||||
from webnotes import msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
self.tname = 'Purchase Invoice Item'
|
||||
self.fname = 'entries'
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.####')
|
||||
|
||||
|
||||
# ************************** Trigger Functions ****************************
|
||||
|
||||
@ -106,64 +97,7 @@ class DocType(TransactionBase):
|
||||
item = webnotes.conn.sql("select purchase_account, cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
|
||||
d.expense_head = item and item[0]['purchase_account'] or ''
|
||||
d.cost_center = item and item[0]['cost_center'] or ''
|
||||
|
||||
|
||||
# Get Item Details
|
||||
# -----------------
|
||||
def get_item_details(self, arg=None):
|
||||
if arg:
|
||||
return self.get_pv_details(arg)
|
||||
else:
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
ret = self.get_pv_details(doc.item_code)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
def get_pv_details(self, arg):
|
||||
import json
|
||||
item_det = sql("select item_name, brand, description, item_group, purchase_account, cost_center, stock_uom from tabItem where name=%s",arg,as_dict=1)
|
||||
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
ret = {
|
||||
'item_name': item_det and item_det[0]['item_name'] or '',
|
||||
'brand': item_det and item_det[0]['brand'] or '',
|
||||
'description': item_det and item_det[0]['description'] or '',
|
||||
'item_group': item_det and item_det[0]['item_group'] or '',
|
||||
'rate': 0.00,
|
||||
'purchase_ref_rate': 0.00,
|
||||
'import_ref_rate': 0.00,
|
||||
'import_rate': 0.00,
|
||||
'qty': 0.00,
|
||||
'amount': 0.00,
|
||||
'discount_rate': 0.00,
|
||||
'expense_head': item_det and item_det[0]['purchase_account'] or '',
|
||||
'cost_center': item_det and item_det[0]['cost_center'] or '',
|
||||
'item_tax_rate': json.dumps(t),
|
||||
'uom': item_det and item_det[0]['stock_uom'] or ''
|
||||
}
|
||||
|
||||
# get last purchase rate
|
||||
last_purchase_details, last_purchase_date = get_obj('Purchase Common').get_last_purchase_details(arg, self.doc.name)
|
||||
if last_purchase_details:
|
||||
purchase_ref_rate = last_purchase_details['purchase_ref_rate']
|
||||
purchase_rate = last_purchase_details['purchase_rate']
|
||||
conversion_rate = self.doc.conversion_rate or 1.0
|
||||
ret.update({
|
||||
'purchase_ref_rate': purchase_ref_rate,
|
||||
'discount_rate': last_purchase_details['discount_rate'],
|
||||
'rate': purchase_rate,
|
||||
'import_ref_rate': purchase_ref_rate / conversion_rate,
|
||||
'import_rate': purchase_rate / conversion_rate,
|
||||
})
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
# Advance Allocation
|
||||
# -------------------
|
||||
def get_advances(self):
|
||||
@ -225,7 +159,7 @@ class DocType(TransactionBase):
|
||||
# Check Conversion Rate
|
||||
# ----------------------
|
||||
def check_conversion_rate(self):
|
||||
default_currency = TransactionBase().get_company_currency(self.doc.company)
|
||||
default_currency = super(DocType, self).get_company_currency(self.doc.company)
|
||||
if not default_currency:
|
||||
msgprint('Message: Please enter default currency in Company Master')
|
||||
raise Exception
|
||||
@ -394,6 +328,8 @@ class DocType(TransactionBase):
|
||||
# VALIDATE
|
||||
# ====================================================================================
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.po_required()
|
||||
self.pr_required()
|
||||
self.check_active_purchase_items()
|
||||
@ -434,7 +370,7 @@ class DocType(TransactionBase):
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
# get total in words
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
dcc = super(DocType, self).get_company_currency(self.doc.company)
|
||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
|
||||
self.doc.grand_total_import)
|
||||
|
@ -18,6 +18,81 @@
|
||||
// ------
|
||||
// cur_frm.cscript.tname - Details table name
|
||||
// cur_frm.cscript.fname - Details fieldname
|
||||
|
||||
wn.provide("erpnext.buying");
|
||||
|
||||
erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
|
||||
setup: function() {
|
||||
var me = this;
|
||||
|
||||
this.frm.fields_dict.price_list_currency.get_query = function() {
|
||||
return repl("select distinct ref_currency from `tabItem Price` \
|
||||
where price_list_name=\"%(price_list_name)s\" and %(key)s like \"%s%%\"",
|
||||
{price_list_name: me.frm.doc.price_list_name});
|
||||
};
|
||||
},
|
||||
|
||||
price_list_name: function() {
|
||||
this.frm.toggle_reqd(["price_list_currency", "plc_conversion_rate"],
|
||||
!!this.frm.doc.price_list_name);
|
||||
},
|
||||
|
||||
item_code: function(doc, cdt, cdn) {
|
||||
var me = this;
|
||||
var item = locals[cdt][cdn];
|
||||
if(item.item_code) {
|
||||
this.frm.call({
|
||||
method: "buying.utils.get_item_details",
|
||||
child: item,
|
||||
args: {
|
||||
args: {
|
||||
doctype: me.frm.doc.doctype,
|
||||
docname: me.frm.doc.name,
|
||||
item_code: item.item_code,
|
||||
warehouse: item.warehouse,
|
||||
supplier: me.frm.doc.supplier,
|
||||
conversion_rate: me.frm.doc.conversion_rate,
|
||||
price_list_name: me.frm.doc.price_list_name,
|
||||
price_list_currency: me.frm.doc.price_list_currency,
|
||||
plc_conversion_rate: me.frm.doc.plc_conversion_rate
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
update_item_details: function(doc, dt, dn, callback) {
|
||||
if(!this.frm.doc.__islocal) return;
|
||||
|
||||
var me = this;
|
||||
var children = getchildren(this.tname, this.frm.doc.name, this.fname);
|
||||
if(children && children.length) {
|
||||
this.frm.call({
|
||||
doc: me.frm.doc,
|
||||
method: "update_item_details",
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
refresh_field(me.fname);
|
||||
me.load_defaults(me.frm.doc, dt, dn, callback);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.load_taxes(doc, dt, dn, callback);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// to save previous state of cur_frm.cscript
|
||||
var prev_cscript = {};
|
||||
$.extend(prev_cscript, cur_frm.cscript);
|
||||
|
||||
cur_frm.cscript = new erpnext.buying.BuyingController({frm: cur_frm});
|
||||
|
||||
// combine new and previous states
|
||||
$.extend(cur_frm.cscript, prev_cscript);
|
||||
|
||||
|
||||
var tname = cur_frm.cscript.tname;
|
||||
var fname = cur_frm.cscript.fname;
|
||||
|
||||
@ -64,23 +139,6 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn, callback) {
|
||||
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
|
||||
}
|
||||
|
||||
// Update existing item details
|
||||
cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
|
||||
if(!cur_frm.doc.__islocal) { return; }
|
||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||
if(children) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_details', '',
|
||||
function(r, rt) {
|
||||
if(!r.exc) {
|
||||
refresh_field(cur_frm.cscript.fname);
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
cur_frm.cscript.load_defaults(doc, dt, dn, callback);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
|
||||
}
|
||||
}
|
||||
|
||||
var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
|
||||
//parent flds
|
||||
@ -177,18 +235,6 @@ cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc,
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Get Item Code Details =====================================================
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
temp = {
|
||||
item_code: d.item_code || '',
|
||||
warehouse: d.warehouse || ''
|
||||
}
|
||||
get_server_fields('get_item_details', JSON.stringify(temp), fname, doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Update Stock Qty ==========================================================
|
||||
cur_frm.cscript.update_stock_qty = function(doc,cdt,cdn){
|
||||
d = locals[cdt][cdn]
|
||||
|
@ -17,18 +17,17 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cint, cstr, flt, getdate, now
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.utils import add_days, cint, cstr, flt
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import form, msgprint, _
|
||||
from webnotes import msgprint, _
|
||||
from buying.utils import get_last_purchase_details
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self, doc, doclist=None):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
@ -105,80 +104,6 @@ class DocType(TransactionBase):
|
||||
r = sql("select terms from `tabTerms and Conditions` where name = %s", obj.doc.tc_name)
|
||||
if r: obj.doc.terms = r[0][0]
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, obj, arg =''):
|
||||
import json
|
||||
arg = json.loads(arg)
|
||||
item = sql("select item_name,item_group, brand, description, min_order_qty, stock_uom, default_warehouse,lead_time_days from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", (arg['item_code']), as_dict = 1)
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg['item_code'])
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
# get warehouse
|
||||
if arg['warehouse']:
|
||||
wh = arg['warehouse']
|
||||
else:
|
||||
wh = item and item[0]['default_warehouse'] or ''
|
||||
|
||||
ret = {
|
||||
'item_name': item and item[0]['item_name'] or '',
|
||||
'item_group': item and item[0]['item_group'] or '',
|
||||
'brand': item and item[0]['brand'] or '',
|
||||
'description': item and item[0]['description'] or '',
|
||||
'qty': 0,
|
||||
'uom': item and item[0]['stock_uom'] or '',
|
||||
'stock_uom': item and item[0]['stock_uom'] or '',
|
||||
'conversion_factor': '1',
|
||||
'warehouse': wh,
|
||||
'item_tax_rate': json.dumps(t),
|
||||
'batch_no': '',
|
||||
'discount_rate': 0
|
||||
}
|
||||
|
||||
# get min_order_qty from item
|
||||
if obj.doc.doctype == 'Purchase Request':
|
||||
ret['min_order_qty'] = item and flt(item[0]['min_order_qty']) or 0
|
||||
|
||||
# get projected qty from bin
|
||||
if ret['warehouse']:
|
||||
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], ret['warehouse']), as_dict=1)
|
||||
ret['projected_qty'] = bin and flt(bin[0]['projected_qty']) or 0
|
||||
|
||||
# get schedule date, lead time date
|
||||
if obj.doc.transaction_date and item and item[0]['lead_time_days']:
|
||||
ret['schedule_date'] = cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
|
||||
ret['lead_time_date'] = cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
|
||||
|
||||
# get last purchase rate as per stock uom and default currency for following list of doctypes
|
||||
if obj.doc.doctype in ['Purchase Order', 'Purchase Receipt']:
|
||||
last_purchase_details, last_purchase_date = self.get_last_purchase_details(arg['item_code'], obj.doc.name)
|
||||
|
||||
if last_purchase_details:
|
||||
# updates ret with purchase_ref_rate, discount_rate, purchase_rate
|
||||
conversion_rate = flt(obj.doc.fields.get('conversion_rate'))
|
||||
ret.update(last_purchase_details)
|
||||
ret.update({
|
||||
'import_ref_rate': flt(last_purchase_details['purchase_ref_rate']) / conversion_rate,
|
||||
'import_rate': flt(last_purchase_details['purchase_rate']) / conversion_rate,
|
||||
})
|
||||
else:
|
||||
# set these values as blank in the form
|
||||
ret.update({
|
||||
'purchase_ref_rate': 0,
|
||||
'discount_rate': 0,
|
||||
'purchase_rate': 0,
|
||||
'import_ref_rate': 0,
|
||||
'import_rate': 0,
|
||||
})
|
||||
|
||||
if obj.doc.doctype == 'Purchase Order':
|
||||
supplier_part_no = webnotes.conn.sql("""\
|
||||
select supplier_part_no from `tabItem Supplier`
|
||||
where parent = %s and parenttype = 'Item' and
|
||||
supplier = %s""", (arg['item_code'], obj.doc.supplier))
|
||||
if supplier_part_no and supplier_part_no[0][0]:
|
||||
ret['supplier_part_no'] = supplier_part_no[0][0]
|
||||
|
||||
return ret
|
||||
|
||||
# Get Available Qty at Warehouse
|
||||
def get_bin_details( self, arg = ''):
|
||||
@ -197,11 +122,11 @@ class DocType(TransactionBase):
|
||||
|
||||
for d in getlist(obj.doclist,obj.fname):
|
||||
# get last purchase details
|
||||
last_purchase_details, last_purchase_date = self.get_last_purchase_details(d.item_code, obj.doc.name)
|
||||
last_purchase_details = get_last_purchase_details(d.item_code, obj.doc.name)
|
||||
|
||||
# compare last purchase date and this transaction's date
|
||||
last_purchase_rate = None
|
||||
if last_purchase_date > this_purchase_date:
|
||||
if last_purchase_details.last_purchase_date > this_purchase_date:
|
||||
last_purchase_rate = last_purchase_details['purchase_rate']
|
||||
elif is_submit == 1:
|
||||
# even if this transaction is the latest one, it should be submitted
|
||||
@ -220,7 +145,7 @@ class DocType(TransactionBase):
|
||||
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.item_code:
|
||||
last_purchase_details, last_purchase_date = self.get_last_purchase_details(d.item_code, doc_name)
|
||||
last_purchase_details = get_last_purchase_details(d.item_code, doc_name)
|
||||
|
||||
if last_purchase_details:
|
||||
d.purchase_ref_rate = last_purchase_details['purchase_ref_rate'] * (flt(d.conversion_factor) or 1.0)
|
||||
@ -238,58 +163,6 @@ class DocType(TransactionBase):
|
||||
d.purchase_ref_rate = d.purchase_rate = d.import_ref_rate \
|
||||
= d.import_rate = item_last_purchase_rate
|
||||
|
||||
def get_last_purchase_details(self, item_code, doc_name):
|
||||
import webnotes
|
||||
import webnotes.utils
|
||||
|
||||
# get last purchase order item details
|
||||
last_po_item = webnotes.conn.sql("""\
|
||||
select po.name, po.transaction_date, po_item.conversion_factor, po_item.purchase_ref_rate,
|
||||
po_item.discount_rate, po_item.purchase_rate
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item` po_item
|
||||
where po.docstatus = 1 and po_item.item_code = %s and po.name != %s and
|
||||
po.name = po_item.parent
|
||||
order by po.transaction_date desc, po.name desc
|
||||
limit 1""", (item_code, doc_name), as_dict=1)
|
||||
|
||||
# get last purchase receipt item details
|
||||
last_pr_item = webnotes.conn.sql("""\
|
||||
select pr.name, pr.posting_date, pr.posting_time, pr_item.conversion_factor,
|
||||
pr_item.purchase_ref_rate, pr_item.discount_rate, pr_item.purchase_rate
|
||||
from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
|
||||
where pr.docstatus = 1 and pr_item.item_code = %s and pr.name != %s and
|
||||
pr.name = pr_item.parent
|
||||
order by pr.posting_date desc, pr.posting_time desc, pr.name desc
|
||||
limit 1""", (item_code, doc_name), as_dict=1)
|
||||
|
||||
# get the latest of the two
|
||||
po_date_obj = webnotes.utils.getdate(last_po_item and last_po_item[0]['transaction_date'] or '2000-01-01')
|
||||
pr_date_obj = webnotes.utils.getdate(last_pr_item and last_pr_item[0]['posting_date'] or '2000-01-01')
|
||||
|
||||
# if both exists, return true
|
||||
both_exists = last_po_item and last_pr_item
|
||||
|
||||
# get the last purchased item, by comparing dates
|
||||
if (both_exists and po_date_obj > pr_date_obj) or (not both_exists and last_po_item):
|
||||
last_purchase_item = last_po_item[0]
|
||||
last_purchase_date = po_date_obj
|
||||
elif both_exists or (not both_exists and last_pr_item):
|
||||
last_purchase_item = last_pr_item[0]
|
||||
last_purchase_date = pr_date_obj
|
||||
else:
|
||||
# if none exists
|
||||
return None, webnotes.utils.getdate('2000-01-01')
|
||||
|
||||
# prepare last purchase details, dividing by conversion factor
|
||||
conversion_factor = flt(last_purchase_item['conversion_factor'])
|
||||
last_purchase_details = {
|
||||
'purchase_ref_rate': flt(last_purchase_item['purchase_ref_rate']) / conversion_factor,
|
||||
'purchase_rate': flt(last_purchase_item['purchase_rate']) / conversion_factor,
|
||||
'discount_rate': flt(last_purchase_item['discount_rate']),
|
||||
}
|
||||
|
||||
return last_purchase_details, last_purchase_date
|
||||
|
||||
# validation
|
||||
# -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -383,7 +256,7 @@ class DocType(TransactionBase):
|
||||
|
||||
# validate conversion rate
|
||||
def validate_conversion_rate(self, obj):
|
||||
default_currency = TransactionBase().get_company_currency(obj.doc.company)
|
||||
default_currency = super(DocType, self).get_company_currency(obj.doc.company)
|
||||
if not default_currency:
|
||||
msgprint('Message: Please enter default currency in Company Master')
|
||||
raise Exception
|
||||
@ -403,45 +276,6 @@ class DocType(TransactionBase):
|
||||
since the specified Currency and the company's currency \
|
||||
are different""", raise_exception=1)
|
||||
|
||||
def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname):
|
||||
if prevdoc_docname :
|
||||
get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc_doctype, prevdoc_docname))
|
||||
name = get_name and get_name[0][0] or ''
|
||||
if name: #check for incorrect docname
|
||||
dt = sql("select company, docstatus from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
|
||||
company_name = dt and cstr(dt[0][0]) or ''
|
||||
docstatus = dt and dt[0][1] or 0
|
||||
|
||||
# check for docstatus
|
||||
if (docstatus != 1):
|
||||
msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " is not Submitted Document.")
|
||||
raise Exception
|
||||
|
||||
# check for company
|
||||
if (company_name != obj.doc.company):
|
||||
msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " does not belong to the Company: " + cstr(obj.doc.company))
|
||||
raise Exception
|
||||
|
||||
if prevdoc_doctype in ['Purchase Order', 'Purchase Receipt']:
|
||||
dt = sql("select supplier, currency from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
|
||||
supplier = dt and dt[0][0] or ''
|
||||
currency = dt and dt[0][1] or ''
|
||||
|
||||
# check for supplier
|
||||
if (supplier != obj.doc.supplier):
|
||||
msgprint("Purchase Order: " + cstr(d.prevdoc_docname) + " supplier :" + cstr(supplier) + " does not match with supplier of current document.")
|
||||
raise Exception
|
||||
|
||||
# check for curency
|
||||
if (currency != obj.doc.currency):
|
||||
msgprint("Purchase Order: " + cstr(d.prevdoc_docname) + " currency :" + cstr(currency) + " does not match with currency of current document.")
|
||||
raise Exception
|
||||
|
||||
else: # if not name than
|
||||
msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " is not a valid " + cstr(prevdoc_doctype))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Validate values with reference document
|
||||
#---------------------------------------
|
||||
def validate_reference_value(self, obj):
|
||||
|
@ -17,30 +17,62 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, date_diff, flt, get_defaults, now
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import addchild, make_autoname
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.utils import cstr, flt, get_defaults
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
from buying.utils import get_last_purchase_details
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.defaults = get_defaults()
|
||||
self.tname = 'Purchase Order Item'
|
||||
self.fname = 'po_details'
|
||||
|
||||
# Validate
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.validate_fiscal_year()
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
import utilities
|
||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Stopped",
|
||||
"Cancelled"])
|
||||
|
||||
# Step 2:=> get Purchase Common Obj
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
# Step 3:=> validate mandatory
|
||||
pc_obj.validate_mandatory(self)
|
||||
|
||||
# Step 4:=> validate for items
|
||||
pc_obj.validate_for_items(self)
|
||||
|
||||
# Step 5:=> validate conversion rate
|
||||
pc_obj.validate_conversion_rate(self)
|
||||
|
||||
# Get po date
|
||||
pc_obj.get_prevdoc_date(self)
|
||||
|
||||
# validate_doc
|
||||
self.validate_doc(pc_obj)
|
||||
|
||||
# Check for stopped status
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# get total in words
|
||||
dcc = super(DocType, self).get_company_currency(self.doc.company)
|
||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||
|
||||
def get_default_schedule_date(self):
|
||||
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
|
||||
@ -48,27 +80,6 @@ class DocType(TransactionBase):
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
|
||||
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, arg =''):
|
||||
import json
|
||||
if arg:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
else:
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
|
||||
# get available qty at warehouse
|
||||
def get_bin_details(self, arg = ''):
|
||||
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
||||
@ -80,7 +91,7 @@ class DocType(TransactionBase):
|
||||
pcomm = get_obj('Purchase Common')
|
||||
for d in getlist(self.doclist, 'po_details'):
|
||||
if d.item_code and not d.purchase_rate:
|
||||
last_purchase_details, last_purchase_date = pcomm.get_last_purchase_details(d.item_code, self.doc.name)
|
||||
last_purchase_details = get_last_purchase_details(d.item_code, self.doc.name)
|
||||
if last_purchase_details:
|
||||
conversion_factor = d.conversion_factor or 1.0
|
||||
conversion_rate = self.doc.fields.get('conversion_rate') or 1.0
|
||||
@ -125,44 +136,6 @@ class DocType(TransactionBase):
|
||||
pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
|
||||
|
||||
|
||||
# Validate
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
import utilities
|
||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Stopped",
|
||||
"Cancelled"])
|
||||
|
||||
# Step 2:=> get Purchase Common Obj
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
# Step 3:=> validate mandatory
|
||||
pc_obj.validate_mandatory(self)
|
||||
|
||||
# Step 4:=> validate for items
|
||||
pc_obj.validate_for_items(self)
|
||||
|
||||
# Step 5:=> validate conversion rate
|
||||
pc_obj.validate_conversion_rate(self)
|
||||
|
||||
# Get po date
|
||||
pc_obj.get_prevdoc_date(self)
|
||||
|
||||
# validate_doc
|
||||
self.validate_doc(pc_obj)
|
||||
|
||||
# Check for stopped status
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# get total in words
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||
|
||||
|
||||
def update_bin(self, is_submit, is_stopped = 0):
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
for d in getlist(self.doclist, 'po_details'):
|
||||
|
@ -2,13 +2,14 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-08-06 20:00:37",
|
||||
"creation": "2012-12-03 17:56:30",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-03 17:10:41"
|
||||
"modified": "2013-01-15 15:42:21"
|
||||
},
|
||||
{
|
||||
"is_submittable": 1,
|
||||
"autoname": "naming_series:",
|
||||
"allow_attach": 1,
|
||||
"is_submittable": 1,
|
||||
"search_fields": "status, transaction_date, supplier,grand_total",
|
||||
"module": "Buying",
|
||||
"doctype": "DocType",
|
||||
@ -29,6 +30,7 @@
|
||||
"read": 1,
|
||||
"doctype": "DocPerm",
|
||||
"parenttype": "DocType",
|
||||
"report": 1,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
@ -36,6 +38,7 @@
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -48,7 +51,6 @@
|
||||
"description": "To manage multiple series please go to Setup > Manage Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Series",
|
||||
"oldfieldname": "naming_series",
|
||||
@ -62,12 +64,10 @@
|
||||
"print_hide": 1,
|
||||
"description": "Supplier (vendor) name as entered in supplier master",
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Supplier",
|
||||
"oldfieldname": "supplier",
|
||||
"permlevel": 0,
|
||||
"trigger": "Client",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"search_index": 1,
|
||||
@ -118,6 +118,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -128,21 +129,18 @@
|
||||
{
|
||||
"description": "The date at which current entry is made in system.",
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Order Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"trigger": "Client",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"search_index": 1,
|
||||
"reqd": 1,
|
||||
"in_filter": 1,
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Items",
|
||||
"fieldname": "items",
|
||||
@ -164,97 +162,39 @@
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"options": "Simple",
|
||||
"fieldname": "section_break0",
|
||||
"fieldname": "sb_last_purchase",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Get Last Purchase Rate",
|
||||
"fieldname": "get_last_purchase_rate",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Net Total*",
|
||||
"oldfieldname": "net_total",
|
||||
"fieldname": "net_total",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Net Total (Import)",
|
||||
"oldfieldname": "net_total_import",
|
||||
"fieldname": "net_total_import",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"oldfieldtype": "Button",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Get Last Purchase Rate",
|
||||
"trigger": "Client",
|
||||
"fieldname": "get_last_purchase_rate",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Re-Calculate Values",
|
||||
"trigger": "Client",
|
||||
"fieldname": "recalculate_values",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Supplier's currency",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Currency",
|
||||
"oldfieldname": "currency",
|
||||
"permlevel": 0,
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Select",
|
||||
"reqd": 1,
|
||||
"options": "link:Currency"
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Rate at which supplier's currency is converted to company's base currency",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Conversion Rate",
|
||||
"oldfieldname": "conversion_rate",
|
||||
"default": "1",
|
||||
"trigger": "Client",
|
||||
"fieldname": "conversion_rate",
|
||||
"fieldtype": "Float",
|
||||
"reqd": 1,
|
||||
"hidden": 0,
|
||||
"fieldname": "section_break0",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
@ -262,7 +202,6 @@
|
||||
"description": "You can make a purchase order from multiple Purchase Requests. Select Purchase Requests one by one and click on the button below.",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Select Purchase Request",
|
||||
"oldfieldname": "indent_no",
|
||||
@ -284,6 +223,14 @@
|
||||
"hidden": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "You can make a purchase order from multiple Supplier Quotations. Select Supplier Quotations one by one and click on the button below.",
|
||||
@ -304,10 +251,74 @@
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Price List and Currency",
|
||||
"fieldname": "price_list_and_currency",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Price List",
|
||||
"options": "link:Price List",
|
||||
"fieldname": "price_list_name",
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Price List Currency",
|
||||
"options": "Currency",
|
||||
"fieldname": "price_list_currency",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Price List Exchange Rate",
|
||||
"fieldname": "plc_conversion_rate",
|
||||
"fieldtype": "Float",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cb_currency",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Supplier's currency",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Select",
|
||||
"doctype": "DocField",
|
||||
"label": "Currency",
|
||||
"oldfieldname": "currency",
|
||||
"permlevel": 0,
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Select",
|
||||
"reqd": 1,
|
||||
"options": "link:Currency"
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Rate at which supplier's currency is converted to company's base currency",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Exchange Rate",
|
||||
"oldfieldname": "conversion_rate",
|
||||
"default": "1",
|
||||
"fieldname": "conversion_rate",
|
||||
"fieldtype": "Float",
|
||||
"reqd": 1,
|
||||
"hidden": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes",
|
||||
"fieldname": "taxes",
|
||||
@ -319,14 +330,13 @@
|
||||
"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Taxes and Charges",
|
||||
"oldfieldname": "purchase_other_charges",
|
||||
"permlevel": 0,
|
||||
"options": "Purchase Taxes and Charges Master",
|
||||
"fieldname": "purchase_other_charges",
|
||||
"fieldtype": "Link",
|
||||
"options": "Purchase Taxes and Charges Master"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
@ -354,7 +364,6 @@
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Calculate Tax",
|
||||
"trigger": "Client",
|
||||
"fieldname": "calculate_tax",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
@ -369,112 +378,25 @@
|
||||
"fieldtype": "HTML",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Total Tax*",
|
||||
"oldfieldname": "total_tax",
|
||||
"fieldname": "total_tax",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Totals",
|
||||
"fieldname": "totals",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Grand Total",
|
||||
"oldfieldname": "grand_total",
|
||||
"fieldname": "grand_total",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Rounded Total",
|
||||
"oldfieldname": "rounded_total",
|
||||
"fieldname": "rounded_total",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "In Words will be visible once you save the Purchase Order.",
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words",
|
||||
"oldfieldname": "in_words",
|
||||
"fieldname": "in_words",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes and Charges Added",
|
||||
"oldfieldname": "other_charges_added",
|
||||
"fieldname": "other_charges_added",
|
||||
"label": "Net Total (Import)",
|
||||
"oldfieldname": "net_total_import",
|
||||
"fieldname": "net_total_import",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes and Charges Deducted",
|
||||
"oldfieldname": "other_charges_deducted",
|
||||
"fieldname": "other_charges_deducted",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break4",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Grand Total (Import)",
|
||||
"oldfieldname": "grand_total_import",
|
||||
"fieldname": "grand_total_import",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1,
|
||||
"report_hide": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words(Import)",
|
||||
"oldfieldname": "in_words_import",
|
||||
"fieldname": "in_words_import",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
@ -499,6 +421,113 @@
|
||||
"permlevel": 1,
|
||||
"report_hide": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Grand Total (Import)",
|
||||
"oldfieldname": "grand_total_import",
|
||||
"fieldname": "grand_total_import",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1,
|
||||
"report_hide": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words(Import)",
|
||||
"oldfieldname": "in_words_import",
|
||||
"fieldname": "in_words_import",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break4",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Net Total*",
|
||||
"oldfieldname": "net_total",
|
||||
"fieldname": "net_total",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes and Charges Added",
|
||||
"oldfieldname": "other_charges_added",
|
||||
"fieldname": "other_charges_added",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes and Charges Deducted",
|
||||
"oldfieldname": "other_charges_deducted",
|
||||
"fieldname": "other_charges_deducted",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Total Tax*",
|
||||
"oldfieldname": "total_tax",
|
||||
"fieldname": "total_tax",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Grand Total",
|
||||
"oldfieldname": "grand_total",
|
||||
"fieldname": "grand_total",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Rounded Total",
|
||||
"oldfieldname": "rounded_total",
|
||||
"fieldname": "rounded_total",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "In Words will be visible once you save the Purchase Order.",
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words",
|
||||
"oldfieldname": "in_words",
|
||||
"fieldname": "in_words",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"doctype": "DocField",
|
||||
@ -507,18 +536,6 @@
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Letter Head",
|
||||
"oldfieldname": "letter_head",
|
||||
"options": "link:Letter Head",
|
||||
"fieldname": "letter_head",
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Link",
|
||||
@ -575,6 +592,12 @@
|
||||
"permlevel": 0,
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cb_contact",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"doctype": "DocField",
|
||||
@ -597,7 +620,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
@ -631,6 +653,18 @@
|
||||
"hidden": 1,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"allow_on_submit": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"doctype": "DocField",
|
||||
"label": "Letter Head",
|
||||
"oldfieldname": "letter_head",
|
||||
"options": "link:Letter Head",
|
||||
"fieldname": "letter_head",
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
@ -662,7 +696,6 @@
|
||||
"description": "Select the relevant company name if you have multiple companies",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
@ -693,7 +726,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Select Print Heading",
|
||||
@ -715,6 +747,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -727,7 +760,6 @@
|
||||
"description": "% of materials received against this Purchase Order",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "% Received",
|
||||
"oldfieldname": "per_received",
|
||||
@ -741,7 +773,6 @@
|
||||
"description": "% of materials billed against this Purchase Order.",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "% Billed",
|
||||
"oldfieldname": "per_billed",
|
||||
@ -754,7 +785,6 @@
|
||||
"print_hide": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Text",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Payment Terms",
|
||||
"oldfieldname": "payment_terms",
|
||||
@ -777,7 +807,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Cancel Reason",
|
||||
"oldfieldname": "cancel_reason",
|
||||
@ -791,7 +820,6 @@
|
||||
"print_hide": 1,
|
||||
"description": "Required raw materials issued to the supplier for producing a sub - contracted item.",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Raw Material Details",
|
||||
"fieldname": "raw_material_details",
|
||||
@ -800,9 +828,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"allow_on_submit": 1,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Table",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Order Items Supplied",
|
||||
"oldfieldname": "po_raw_material_details",
|
||||
@ -821,18 +849,62 @@
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material User",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material User",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Purchase Manager",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Purchase User",
|
||||
"cancel": 1,
|
||||
"role": "Purchase Manager",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"cancel": 1,
|
||||
"role": "Purchase User",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"cancel": 0,
|
||||
"role": "All",
|
||||
"permlevel": 1
|
||||
},
|
||||
@ -843,49 +915,13 @@
|
||||
"match": "supplier"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 1,
|
||||
"cancel": 0,
|
||||
"role": "All",
|
||||
"permlevel": 2
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Purchase Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Purchase Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material User",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material User",
|
||||
"cancel": 0,
|
||||
"permlevel": 0
|
||||
}
|
||||
]
|
@ -17,18 +17,16 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, date_diff, flt, get_defaults, now
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import make_autoname
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.utils import cstr, flt, get_defaults
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
|
||||
class DocType:
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
@ -36,12 +34,6 @@ class DocType:
|
||||
self.tname = 'Purchase Request Item'
|
||||
self.fname = 'indent_details'
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
def get_default_schedule_date(self):
|
||||
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
|
||||
|
||||
@ -102,25 +94,6 @@ class DocType:
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Purchase Request Date')
|
||||
|
||||
# get item details
|
||||
# ---------------------------------
|
||||
def get_item_details(self, arg =''):
|
||||
if arg:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
else:
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
#-----------------------------
|
||||
def get_tc_details(self):
|
||||
@ -138,6 +111,8 @@ class DocType:
|
||||
# Validate
|
||||
# ---------------------
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.validate_schedule_date()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
|
@ -2,13 +2,14 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:29:58",
|
||||
"creation": "2012-12-03 17:56:31",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-03 17:10:41"
|
||||
"modified": "2013-01-15 15:34:47"
|
||||
},
|
||||
{
|
||||
"is_submittable": 1,
|
||||
"autoname": "naming_series:",
|
||||
"allow_attach": 1,
|
||||
"is_submittable": 1,
|
||||
"allow_print": 0,
|
||||
"search_fields": "status,transaction_date,sales_order_no",
|
||||
"module": "Buying",
|
||||
@ -28,6 +29,7 @@
|
||||
"parent": "Purchase Request",
|
||||
"read": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"parenttype": "DocType",
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
@ -40,7 +42,6 @@
|
||||
"description": "To manage multiple series please go to Setup > Manage Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Series",
|
||||
"oldfieldname": "naming_series",
|
||||
@ -52,14 +53,13 @@
|
||||
},
|
||||
{
|
||||
"description": "The date at which current entry is made in system.",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Transaction Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"search_index": 1,
|
||||
@ -69,7 +69,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Items",
|
||||
"fieldname": "items",
|
||||
@ -79,7 +78,6 @@
|
||||
{
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Table",
|
||||
"colour": "White:FFF",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Requisition Details",
|
||||
@ -97,6 +95,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break4",
|
||||
@ -106,9 +105,9 @@
|
||||
{
|
||||
"permlevel": 0,
|
||||
"description": "One or multiple Sales Order no which generated this Purchase Requisition",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Sales Order No",
|
||||
"oldfieldname": "sales_order_no",
|
||||
@ -118,6 +117,7 @@
|
||||
"options": "Sales Order"
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break5",
|
||||
@ -136,7 +136,6 @@
|
||||
"description": "Filing in Additional Information about the Purchase Requisition will help you analyze your data better.",
|
||||
"default": "Give additional details about the indent.",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "More Info",
|
||||
"fieldname": "more_info",
|
||||
@ -144,6 +143,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -154,9 +154,9 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Select the relevant company name if you have multiple companies",
|
||||
"print_width": "150px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
@ -170,9 +170,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
@ -186,9 +186,9 @@
|
||||
},
|
||||
{
|
||||
"description": "Name of the entity who has requested for the Purchase Requisition",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Requested By",
|
||||
"oldfieldname": "requested_by",
|
||||
@ -202,7 +202,6 @@
|
||||
"description": "After cancelling the Purchase Requisition, a dialog box will ask you reason for cancellation which will be reflected in this field",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Cancel Reason",
|
||||
"oldfieldname": "cancel_reason",
|
||||
@ -211,6 +210,7 @@
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -220,8 +220,8 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"allow_on_submit": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"doctype": "DocField",
|
||||
"label": "Letter Head",
|
||||
"oldfieldname": "letter_head",
|
||||
@ -233,9 +233,9 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"permlevel": 1,
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
@ -252,7 +252,6 @@
|
||||
"description": "% of materials ordered against this Purchase Requisition",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "% Ordered",
|
||||
"oldfieldname": "per_ordered",
|
||||
@ -262,6 +261,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
@ -275,6 +275,7 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "The date at which current entry is corrected in the system.",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"doctype": "DocField",
|
||||
@ -287,6 +288,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"print_width": "150px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Small Text",
|
||||
"doctype": "DocField",
|
||||
@ -346,22 +348,6 @@
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Purchase User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0,
|
||||
"match": ""
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Purchase User",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
@ -421,5 +407,24 @@
|
||||
"role": "Material User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Purchase User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"role": "Purchase User",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
}
|
||||
]
|
@ -17,19 +17,16 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.model.code import get_obj
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self, doc, doclist=None):
|
||||
self.doc, self.doclist = doc, doclist or []
|
||||
self.tname, self.fname = "Supplier Quotation Item", "quotation_items"
|
||||
|
||||
def autoname(self):
|
||||
"""autoname based on naming series value"""
|
||||
from webnotes.model.doc import make_autoname
|
||||
self.doc.name = make_autoname(self.doc.naming_series + ".#####")
|
||||
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
@ -53,22 +50,6 @@ class DocType(TransactionBase):
|
||||
def on_trash(self):
|
||||
pass
|
||||
|
||||
def get_item_details(self, args=None):
|
||||
if args:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self, args)
|
||||
else:
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
def get_indent_details(self):
|
||||
if self.doc.indent_no:
|
||||
mapper = get_obj("DocType Mapper", "Purchase Request-Supplier Quotation")
|
||||
@ -102,6 +83,6 @@ class DocType(TransactionBase):
|
||||
|
||||
def set_in_words(self):
|
||||
pc = get_obj('Purchase Common')
|
||||
company_currency = TransactionBase().get_company_currency(self.doc.company)
|
||||
company_currency = super(DocType, self).get_company_currency(self.doc.company)
|
||||
self.doc.in_words = pc.get_total_in_words(company_currency, self.doc.grand_total)
|
||||
self.doc.in_words_import = pc.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||
|
@ -2,13 +2,14 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-08-06 11:15:46",
|
||||
"creation": "2012-12-20 12:50:48",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-10 18:30:00"
|
||||
"modified": "2013-01-15 15:38:38"
|
||||
},
|
||||
{
|
||||
"is_submittable": 1,
|
||||
"autoname": "naming_series:",
|
||||
"allow_attach": 1,
|
||||
"is_submittable": 1,
|
||||
"search_fields": "status, transaction_date, supplier,grand_total",
|
||||
"module": "Buying",
|
||||
"doctype": "DocType",
|
||||
@ -29,6 +30,7 @@
|
||||
"read": 1,
|
||||
"doctype": "DocPerm",
|
||||
"parenttype": "DocType",
|
||||
"report": 1,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
@ -36,6 +38,7 @@
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -48,7 +51,6 @@
|
||||
"description": "To manage multiple series please go to Setup > Manage Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Series",
|
||||
"oldfieldname": "naming_series",
|
||||
@ -62,12 +64,10 @@
|
||||
"print_hide": 1,
|
||||
"description": "Supplier (vendor) name as entered in supplier master",
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Supplier",
|
||||
"oldfieldname": "supplier",
|
||||
"permlevel": 0,
|
||||
"trigger": "Client",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"search_index": 1,
|
||||
@ -118,6 +118,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -128,21 +129,18 @@
|
||||
{
|
||||
"description": "The date at which current entry is made in system.",
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Quotation Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"trigger": "Client",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"search_index": 1,
|
||||
"reqd": 1,
|
||||
"in_filter": 1,
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Items",
|
||||
"fieldname": "items",
|
||||
@ -169,6 +167,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break2",
|
||||
@ -202,12 +201,12 @@
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Re-Calculate Values",
|
||||
"trigger": "Client",
|
||||
"fieldname": "recalculate_values",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break3",
|
||||
@ -219,7 +218,6 @@
|
||||
"description": "Supplier's currency",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Currency",
|
||||
"oldfieldname": "currency",
|
||||
@ -234,12 +232,10 @@
|
||||
"description": "Rate at which supplier's currency is converted to company's base currency",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Conversion Rate",
|
||||
"oldfieldname": "conversion_rate",
|
||||
"default": "1",
|
||||
"trigger": "Client",
|
||||
"fieldname": "conversion_rate",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 1,
|
||||
@ -251,7 +247,6 @@
|
||||
"description": "You can make a purchase order from multiple Purchase Requests. Select Purchase Requests one by one and click on the button below.",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Select Purchase Request",
|
||||
"oldfieldname": "indent_no",
|
||||
@ -273,7 +268,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes",
|
||||
"fieldname": "taxes",
|
||||
@ -285,14 +279,13 @@
|
||||
"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Taxes and Charges",
|
||||
"oldfieldname": "purchase_other_charges",
|
||||
"permlevel": 0,
|
||||
"options": "Purchase Taxes and Charges Master",
|
||||
"fieldname": "purchase_other_charges",
|
||||
"fieldtype": "Link",
|
||||
"options": "Purchase Taxes and Charges Master"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
@ -320,7 +313,6 @@
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Calculate Tax",
|
||||
"trigger": "Client",
|
||||
"fieldname": "calculate_tax",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
@ -348,7 +340,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Totals",
|
||||
"fieldname": "totals",
|
||||
@ -380,7 +371,6 @@
|
||||
"print_hide": 1,
|
||||
"description": "In Words will be visible once you save the Purchase Order.",
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words",
|
||||
"oldfieldname": "in_words",
|
||||
@ -433,7 +423,6 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words(Import)",
|
||||
"oldfieldname": "in_words_import",
|
||||
@ -475,8 +464,8 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"allow_on_submit": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Letter Head",
|
||||
"oldfieldname": "letter_head",
|
||||
@ -563,7 +552,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
@ -616,7 +604,6 @@
|
||||
"description": "Select the relevant company name if you have multiple companies",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
@ -647,7 +634,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Select Print Heading",
|
||||
@ -660,6 +646,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -671,7 +658,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Cancel Reason",
|
||||
"oldfieldname": "cancel_reason",
|
||||
|
178
buying/utils.py
Normal file
178
buying/utils.py
Normal file
@ -0,0 +1,178 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import getdate, flt, add_days
|
||||
import json
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_item_details(args):
|
||||
"""
|
||||
args = {
|
||||
"doctype": "",
|
||||
"docname": "",
|
||||
"item_code": "",
|
||||
"warehouse": None,
|
||||
"supplier": None,
|
||||
"transaction_date": None,
|
||||
"conversion_rate": 1.0
|
||||
}
|
||||
"""
|
||||
if isinstance(args, basestring):
|
||||
args = json.loads(args)
|
||||
|
||||
args = webnotes._dict(args)
|
||||
|
||||
item_wrapper = webnotes.model_wrapper("Item", args.item_code)
|
||||
item = item_wrapper.doc
|
||||
|
||||
from stock.utils import validate_end_of_life
|
||||
validate_end_of_life(item.name, item.end_of_life)
|
||||
|
||||
# fetch basic values
|
||||
out = webnotes._dict()
|
||||
out.update({
|
||||
"item_name": item.item_name,
|
||||
"item_group": item.item_group,
|
||||
"brand": item.brand,
|
||||
"description": item.description,
|
||||
"qty": 0,
|
||||
"stock_uom": item.stock_uom,
|
||||
"uom": item.stock_uom,
|
||||
"conversion_factor": 1,
|
||||
"warehouse": args.warehouse or item.default_warehouse,
|
||||
"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in
|
||||
item_wrapper.doclist.get({"parentfield": "ref_rate_details"})))),
|
||||
"batch_no": None,
|
||||
"expense_head": item.purchase_account,
|
||||
"cost_center": item.cost_center
|
||||
})
|
||||
|
||||
if args.supplier:
|
||||
item_supplier = item_wrapper.doclist.get({"parentfield": "item_supplier_details",
|
||||
"supplier": args.supplier})
|
||||
if item_supplier:
|
||||
out["supplier_part_no"] = item_supplier[0].supplier_part_no
|
||||
|
||||
if out.warehouse:
|
||||
out.projected_qty = webnotes.conn.get_value("Bin", {"item_code": item.name,
|
||||
"warehouse": out.warehouse}, "projected_qty")
|
||||
|
||||
if args.transaction_date and item.lead_time_days:
|
||||
out.schedule_date = out.lead_time_date = add_days(args.transaction_date,
|
||||
item.lead_time_days)
|
||||
|
||||
# set zero
|
||||
out.purchase_ref_rate = out.discount_rate = out.purchase_rate = \
|
||||
out.import_ref_rate = out.import_rate = 0.0
|
||||
|
||||
if args.doctype in ["Purchase Order", "Purchase Invoice", "Purchase Receipt"]:
|
||||
# try fetching from price list
|
||||
if args.price_list_name:
|
||||
rates_as_per_price_list = get_rates_as_per_price_list(args, item_wrapper.doclist)
|
||||
if rates_as_per_price_list:
|
||||
out.update(rates_as_per_price_list)
|
||||
|
||||
# if not found, fetch from last purchase transaction
|
||||
if not out.purchase_rate:
|
||||
last_purchase = get_last_purchase_details(item.name, args.docname, args.conversion_rate)
|
||||
if last_purchase:
|
||||
out.update(last_purchase)
|
||||
|
||||
return out
|
||||
|
||||
def get_rates_as_per_price_list(args, item_doclist=None):
|
||||
if not item_doclist:
|
||||
item_doclist = webnotes.model_wrapper("Item", args.item_code).doclist
|
||||
|
||||
result = item_doclist.get({"parentfield": "ref_rate_details",
|
||||
"price_list_name": args.price_list_name, "ref_currency": args.price_list_currency})
|
||||
|
||||
if result:
|
||||
purchase_ref_rate = flt(result[0].ref_rate) * flt(args.plc_conversion_rate)
|
||||
conversion_rate = flt(args.conversion_rate) or 1.0
|
||||
return webnotes._dict({
|
||||
"purchase_ref_rate": purchase_ref_rate,
|
||||
"purchase_rate": purchase_ref_rate,
|
||||
"rate": purchase_ref_rate,
|
||||
"discount_rate": 0,
|
||||
"import_ref_rate": purchase_ref_rate / conversion_rate,
|
||||
"import_rate": purchase_ref_rate / conversion_rate
|
||||
})
|
||||
else:
|
||||
return webnotes._dict()
|
||||
|
||||
def get_last_purchase_details(item_code, doc_name, conversion_rate=1.0):
|
||||
"""returns last purchase details in stock uom"""
|
||||
# get last purchase order item details
|
||||
last_purchase_order = webnotes.conn.sql("""\
|
||||
select po.name, po.transaction_date, po.conversion_rate,
|
||||
po_item.conversion_factor, po_item.purchase_ref_rate,
|
||||
po_item.discount_rate, po_item.purchase_rate
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item` po_item
|
||||
where po.docstatus = 1 and po_item.item_code = %s and po.name != %s and
|
||||
po.name = po_item.parent
|
||||
order by po.transaction_date desc, po.name desc
|
||||
limit 1""", (item_code, doc_name), as_dict=1)
|
||||
|
||||
# get last purchase receipt item details
|
||||
last_purchase_receipt = webnotes.conn.sql("""\
|
||||
select pr.name, pr.posting_date, pr.posting_time, pr.conversion_rate,
|
||||
pr_item.conversion_factor, pr_item.purchase_ref_rate, pr_item.discount_rate,
|
||||
pr_item.purchase_rate
|
||||
from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
|
||||
where pr.docstatus = 1 and pr_item.item_code = %s and pr.name != %s and
|
||||
pr.name = pr_item.parent
|
||||
order by pr.posting_date desc, pr.posting_time desc, pr.name desc
|
||||
limit 1""", (item_code, doc_name), as_dict=1)
|
||||
|
||||
purchase_order_date = getdate(last_purchase_order and last_purchase_order[0].transaction_date \
|
||||
or "1900-01-01")
|
||||
purchase_receipt_date = getdate(last_purchase_receipt and \
|
||||
last_purchase_receipt[0].posting_date or "1900-01-01")
|
||||
|
||||
if (purchase_order_date > purchase_receipt_date) or \
|
||||
(last_purchase_order and not last_purchase_receipt):
|
||||
# use purchase order
|
||||
last_purchase = last_purchase_order[0]
|
||||
purchase_date = purchase_order_date
|
||||
|
||||
elif (purchase_receipt_date > purchase_order_date) or \
|
||||
(last_purchase_receipt and not last_purchase_order):
|
||||
# use purchase receipt
|
||||
last_purchase = last_purchase_receipt[0]
|
||||
purchase_date = purchase_receipt_date
|
||||
|
||||
else:
|
||||
return webnotes._dict()
|
||||
|
||||
conversion_factor = flt(last_purchase.conversion_factor)
|
||||
out = webnotes._dict({
|
||||
"purchase_ref_rate": flt(last_purchase.purchase_ref_rate) / conversion_factor,
|
||||
"purchase_rate": flt(last_purchase.purchase_rate) / conversion_factor,
|
||||
"discount_rate": flt(last_purchase.discount_rate),
|
||||
"purchase_date": purchase_date
|
||||
})
|
||||
|
||||
conversion_rate = flt(conversion_rate) or 1.0
|
||||
out.update({
|
||||
"import_ref_rate": out.purchase_ref_rate / conversion_rate,
|
||||
"import_rate": out.purchase_rate / conversion_rate,
|
||||
"rate": out.purchase_rate
|
||||
})
|
||||
|
||||
return out
|
40
controllers/buying_controller.py
Normal file
40
controllers/buying_controller.py
Normal file
@ -0,0 +1,40 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from buying.utils import get_item_details
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
class BuyingController(TransactionBase):
|
||||
def validate(self):
|
||||
pass
|
||||
|
||||
def update_item_details(self):
|
||||
for item in self.doclist.get({"parentfield": self.fname}):
|
||||
ret = get_item_details({
|
||||
"doctype": self.doc.doctype,
|
||||
"docname": self.doc.name,
|
||||
"item_code": item.item_code,
|
||||
"warehouse": item.warehouse,
|
||||
"supplier": self.doc.supplier,
|
||||
"transaction_date": self.doc.posting_date,
|
||||
"conversion_rate": self.doc.conversion_rate
|
||||
})
|
||||
for r in ret:
|
||||
if not item.fields.get(r):
|
||||
item.fields[r] = ret[r]
|
@ -18,18 +18,15 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt, get_defaults, getdate
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import addchild, make_autoname
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
@ -38,32 +35,9 @@ class DocType(TransactionBase):
|
||||
self.fname = 'purchase_receipt_details'
|
||||
self.count = 0
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date')
|
||||
|
||||
def get_item_details(self, arg = ''):
|
||||
if arg:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
else:
|
||||
import json
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
# =====================================================================================
|
||||
def get_tc_details(self):
|
||||
@ -125,14 +99,6 @@ class DocType(TransactionBase):
|
||||
#d.valuation_rate = (flt(d.purchase_rate) + ((flt(d.amount) * (total_b_cost)) / (self.doc.net_total * flt(d.qty))) + (flt(d.rm_supp_cost) / flt(d.qty))) / flt(d.conversion_factor)
|
||||
d.valuation_rate = (flt(d.purchase_rate) + ((flt(d.amount) * (total_b_cost)) / (self.doc.net_total * flt(d.qty))) + (flt(d.rm_supp_cost) / flt(d.qty)) + (flt(d.item_tax_amount)/flt(d.qty))) / flt(d.conversion_factor)
|
||||
|
||||
# Check for Stopped status
|
||||
def check_for_stopped_status(self, pc_obj):
|
||||
check_list =[]
|
||||
for d in getlist(self.doclist, 'purchase_receipt_details'):
|
||||
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
|
||||
check_list.append(d.prevdoc_docname)
|
||||
pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
|
||||
|
||||
#check in manage account if purchase order required or not.
|
||||
# ====================================================================================
|
||||
def po_required(self):
|
||||
@ -146,6 +112,8 @@ class DocType(TransactionBase):
|
||||
|
||||
# validate
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.po_required()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
@ -169,7 +137,7 @@ class DocType(TransactionBase):
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# get total in words
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
dcc = super(DocType, self).get_company_currency(self.doc.company)
|
||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||
# update valuation rate
|
||||
@ -287,7 +255,6 @@ class DocType(TransactionBase):
|
||||
check_list.append(d.prevdoc_docname)
|
||||
pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
|
||||
|
||||
|
||||
# on submit
|
||||
def on_submit(self):
|
||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||
|
@ -2,13 +2,14 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-17 13:24:57",
|
||||
"creation": "2012-12-03 17:56:26",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-03 17:10:41"
|
||||
"modified": "2013-01-15 15:43:07"
|
||||
},
|
||||
{
|
||||
"is_submittable": 1,
|
||||
"autoname": "naming_series:",
|
||||
"allow_attach": 1,
|
||||
"is_submittable": 1,
|
||||
"search_fields": "status, posting_date, supplier",
|
||||
"module": "Stock",
|
||||
"doctype": "DocType",
|
||||
@ -29,6 +30,7 @@
|
||||
"read": 1,
|
||||
"doctype": "DocPerm",
|
||||
"parenttype": "DocType",
|
||||
"report": 1,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
@ -36,6 +38,7 @@
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -48,7 +51,6 @@
|
||||
"description": "To manage multiple series please go to Setup > Manage Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Series",
|
||||
"oldfieldname": "naming_series",
|
||||
@ -60,15 +62,14 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Supplier",
|
||||
"oldfieldname": "supplier",
|
||||
"width": "150px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"search_index": 1,
|
||||
@ -118,6 +119,7 @@
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -128,9 +130,9 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "The date at which current entry will get or has actually executed.",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Posting Date",
|
||||
"oldfieldname": "posting_date",
|
||||
@ -145,9 +147,9 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Time at which materials were received",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Time",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Posting Time",
|
||||
"oldfieldname": "posting_time",
|
||||
@ -161,9 +163,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Challan No",
|
||||
"oldfieldname": "challan_no",
|
||||
@ -176,9 +178,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Challan Date",
|
||||
"oldfieldname": "challan_date",
|
||||
@ -191,7 +193,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Items",
|
||||
"fieldname": "items",
|
||||
@ -213,7 +214,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"options": "Simple",
|
||||
"fieldname": "section_break0",
|
||||
@ -222,6 +222,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Net Total",
|
||||
@ -246,7 +247,6 @@
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Re-Calculate Values",
|
||||
"trigger": "Client",
|
||||
"fieldname": "recalculate_values",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
@ -262,6 +262,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -273,26 +274,23 @@
|
||||
"print_hide": 1,
|
||||
"description": "Supplier's currency",
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Currency",
|
||||
"oldfieldname": "currency",
|
||||
"permlevel": 0,
|
||||
"options": "link:Currency",
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Select",
|
||||
"reqd": 1,
|
||||
"options": "link:Currency"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "Rate at which supplier's currency is converted to company's base currency",
|
||||
"default": "1.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Conversion Rate",
|
||||
"oldfieldname": "conversion_rate",
|
||||
"trigger": "Client",
|
||||
"fieldname": "conversion_rate",
|
||||
"fieldtype": "Float",
|
||||
"reqd": 1,
|
||||
@ -303,19 +301,17 @@
|
||||
"description": "You can make a purchase receipt from multiple purchase orders. Select purchase orders one by one and click on the button below.",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Order",
|
||||
"oldfieldname": "purchase_order_no",
|
||||
"permlevel": 0,
|
||||
"options": "Purchase Order",
|
||||
"fieldname": "purchase_order_no",
|
||||
"fieldtype": "Link",
|
||||
"options": "Purchase Order"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Button",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Pull Purchase Order Details",
|
||||
"options": "get_po_details",
|
||||
@ -326,7 +322,6 @@
|
||||
{
|
||||
"description": "Add / Edit Taxes and Charges",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Taxes",
|
||||
"fieldname": "taxes",
|
||||
@ -337,7 +332,6 @@
|
||||
"print_hide": 1,
|
||||
"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.",
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Taxes and Charges",
|
||||
"oldfieldname": "purchase_other_charges",
|
||||
@ -371,7 +365,6 @@
|
||||
"oldfieldtype": "Button",
|
||||
"doctype": "DocField",
|
||||
"label": "Calculate Tax",
|
||||
"trigger": "Client",
|
||||
"fieldname": "calculate_tax",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
@ -398,7 +391,6 @@
|
||||
{
|
||||
"description": "Detailed Breakup of the totals",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Totals",
|
||||
"fieldname": "totals",
|
||||
@ -418,7 +410,6 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Rounded Total",
|
||||
"oldfieldname": "rounded_total",
|
||||
@ -430,7 +421,6 @@
|
||||
"print_hide": 1,
|
||||
"description": "In Words will be visible once you save the Purchase Receipt.",
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words",
|
||||
"oldfieldname": "in_words",
|
||||
@ -459,6 +449,7 @@
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break3",
|
||||
@ -478,7 +469,6 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "In Words (Import)",
|
||||
"oldfieldname": "in_words_import",
|
||||
@ -509,7 +499,6 @@
|
||||
{
|
||||
"description": "Add Terms and Conditions for the Purchase Receipt. You can also prepare a Terms and Conditions Master and use the Template.",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Terms and Conditions",
|
||||
"fieldname": "terms_section_break",
|
||||
@ -583,7 +572,6 @@
|
||||
{
|
||||
"description": "Filing in Additional Information about the Purchase Receipt will help you analyze your data better.",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "More Info",
|
||||
"fieldname": "more_info",
|
||||
@ -593,9 +581,9 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"permlevel": 1,
|
||||
"print_width": "150px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
@ -612,7 +600,6 @@
|
||||
"description": "% of materials billed against this Purchase Receipt",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "% Billed",
|
||||
"oldfieldname": "per_billed",
|
||||
@ -626,17 +613,17 @@
|
||||
"description": "Select \"Yes\" for sub - contracting items",
|
||||
"default": "No",
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Is Subcontracted",
|
||||
"oldfieldname": "is_subcontracted",
|
||||
"permlevel": 0,
|
||||
"options": "\nYes\nNo",
|
||||
"fieldname": "is_subcontracted",
|
||||
"fieldtype": "Select",
|
||||
"options": "\nYes\nNo"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
@ -651,6 +638,7 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"description": "The date at which current entry is corrected in the system.",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"doctype": "DocField",
|
||||
@ -665,7 +653,6 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Range",
|
||||
"oldfieldname": "range",
|
||||
@ -700,13 +687,11 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Select Print Heading",
|
||||
"oldfieldname": "select_print_heading",
|
||||
"permlevel": 0,
|
||||
"trigger": "Client",
|
||||
"fieldname": "select_print_heading",
|
||||
"fieldtype": "Link",
|
||||
"options": "Print Heading",
|
||||
@ -716,9 +701,9 @@
|
||||
"print_hide": 1,
|
||||
"permlevel": 0,
|
||||
"description": "Select the relevant company name if you have multiple companies",
|
||||
"print_width": "150px",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
@ -733,6 +718,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Select",
|
||||
"doctype": "DocField",
|
||||
@ -748,6 +734,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "50%",
|
||||
"oldfieldtype": "Column Break",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
@ -757,9 +744,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "30%",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "HTML",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Other Details",
|
||||
"width": "30%",
|
||||
@ -774,7 +761,6 @@
|
||||
"description": "Warehouse where you are maintaining stock of rejected items",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Rejected Warehouse",
|
||||
"oldfieldname": "rejected_warehouse",
|
||||
@ -788,9 +774,9 @@
|
||||
"print_hide": 1,
|
||||
"permlevel": 0,
|
||||
"description": "Supplier warehouse where you have issued raw materials for sub - contracting",
|
||||
"print_width": "50px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Supplier Warehouse",
|
||||
"oldfieldname": "supplier_warehouse",
|
||||
@ -803,7 +789,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Cancel Reason",
|
||||
"oldfieldname": "cancel_reason",
|
||||
@ -849,9 +834,9 @@
|
||||
{
|
||||
"print_hide": 0,
|
||||
"description": "Transporter lorry number",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "LR No",
|
||||
"oldfieldname": "lr_no",
|
||||
@ -863,9 +848,9 @@
|
||||
{
|
||||
"print_hide": 0,
|
||||
"description": "Date on which lorry started from supplier warehouse",
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "LR Date",
|
||||
"oldfieldname": "lr_date",
|
||||
@ -875,6 +860,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "50%",
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break5",
|
||||
@ -885,7 +871,6 @@
|
||||
"print_hide": 1,
|
||||
"description": "Following table will show values if items are sub - contracted. These values will be fetched from the master of \"Bill of Materials\" of sub - contracted items.",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Raw Material Details",
|
||||
"fieldname": "raw_material_details",
|
||||
@ -914,72 +899,79 @@
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material Manager",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Purchase User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0,
|
||||
"match": ""
|
||||
"role": "Material Manager",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material User",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"cancel": 1,
|
||||
"role": "Material User",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"cancel": 1,
|
||||
"role": "Purchase User",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"cancel": 0,
|
||||
"role": "Purchase User",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Supplier",
|
||||
"match": "supplier",
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"match": "supplier"
|
||||
},
|
||||
{
|
||||
"write": 1,
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 1,
|
||||
"cancel": 0,
|
||||
"role": "All",
|
||||
"permlevel": 2
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Material Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material User",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 1,
|
||||
"write": 1,
|
||||
"role": "Material User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
}
|
||||
]
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wn.require("public/app/js/stock_controller.js");
|
||||
wn.require("public/app/js/controllers/stock_controller.js");
|
||||
wn.provide("erpnext.stock");
|
||||
|
||||
erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wn.require("public/app/js/stock_controller.js");
|
||||
wn.require("public/app/js/controllers/stock_controller.js");
|
||||
wn.provide("erpnext.stock");
|
||||
|
||||
erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
|
@ -20,7 +20,9 @@ from webnotes.utils import load_json, cstr, flt, get_defaults
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.wrapper import copy_doclist
|
||||
|
||||
class TransactionBase:
|
||||
from webnotes.model.controller import DocListController
|
||||
|
||||
class TransactionBase(DocListController):
|
||||
|
||||
# Get Customer Default Primary Address - first load
|
||||
# -----------------------
|
||||
|
Loading…
Reference in New Issue
Block a user