Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
e1c76a1a8e
@ -306,7 +306,9 @@ class DocType(BuyingController):
|
|||||||
def set_against_expense_account(self):
|
def set_against_expense_account(self):
|
||||||
auto_inventory_accounting = \
|
auto_inventory_accounting = \
|
||||||
cint(webnotes.defaults.get_global_default("auto_inventory_accounting"))
|
cint(webnotes.defaults.get_global_default("auto_inventory_accounting"))
|
||||||
stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
|
|
||||||
|
if auto_inventory_accounting:
|
||||||
|
stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
|
||||||
|
|
||||||
against_accounts = []
|
against_accounts = []
|
||||||
for item in self.doclist.get({"parentfield": "entries"}):
|
for item in self.doclist.get({"parentfield": "entries"}):
|
||||||
|
@ -641,7 +641,6 @@ class DocType(SellingController):
|
|||||||
self.values.append({
|
self.values.append({
|
||||||
'item_code' : d['item_code'],
|
'item_code' : d['item_code'],
|
||||||
'warehouse' : wh,
|
'warehouse' : wh,
|
||||||
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
|
|
||||||
'posting_date' : self.doc.posting_date,
|
'posting_date' : self.doc.posting_date,
|
||||||
'posting_time' : self.doc.posting_time,
|
'posting_time' : self.doc.posting_time,
|
||||||
'voucher_type' : 'Sales Invoice',
|
'voucher_type' : 'Sales Invoice',
|
||||||
|
@ -44,20 +44,17 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
|
|||||||
show_upload: function() {
|
show_upload: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
|
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
|
||||||
var upload_area = $('<div id="dit-upload-area"></div>').appendTo($wrapper);
|
|
||||||
|
|
||||||
// upload
|
// upload
|
||||||
wn.upload.make({
|
wn.upload.make({
|
||||||
parent: $('#dit-upload-area'),
|
parent: $wrapper,
|
||||||
args: {
|
args: {
|
||||||
method: 'hr.doctype.upload_attendance.upload_attendance.upload'
|
method: 'hr.doctype.upload_attendance.upload_attendance.upload'
|
||||||
},
|
},
|
||||||
sample_url: "e.g. http://example.com/somefile.csv",
|
sample_url: "e.g. http://example.com/somefile.csv",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
|
var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
|
||||||
var log_area = $('<div id="dit-output"></div>').appendTo($log_wrapper);
|
|
||||||
|
|
||||||
$wrapper.find(".dit-progress-area").toggle(false);
|
|
||||||
if(!r.messages) r.messages = [];
|
if(!r.messages) r.messages = [];
|
||||||
// replace links if error has occured
|
// replace links if error has occured
|
||||||
if(r.exc || r.error) {
|
if(r.exc || r.error) {
|
||||||
@ -81,7 +78,7 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
|
|||||||
console.log(r.messages);
|
console.log(r.messages);
|
||||||
|
|
||||||
$.each(r.messages, function(i, v) {
|
$.each(r.messages, function(i, v) {
|
||||||
var $p = $('<p>').html(v).appendTo('#dit-output');
|
var $p = $('<p>').html(v).appendTo($log_wrapper);
|
||||||
if(v.substr(0,5)=='Error') {
|
if(v.substr(0,5)=='Error') {
|
||||||
$p.css('color', 'red');
|
$p.css('color', 'red');
|
||||||
} else if(v.substr(0,8)=='Inserted') {
|
} else if(v.substr(0,8)=='Inserted') {
|
||||||
@ -96,11 +93,8 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// rename button
|
// rename button
|
||||||
$('#dit-upload-area form input[type="submit"]')
|
$wrapper.find('form input[type="submit"]')
|
||||||
.attr('value', 'Upload and Import')
|
.attr('value', 'Upload and Import')
|
||||||
.click(function() {
|
|
||||||
$wrapper.find(".dit-progress-area").toggle(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
6
patches/march_2013/p09_unset_user_type_partner.py
Normal file
6
patches/march_2013/p09_unset_user_type_partner.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
webnotes.conn.sql("""update `tabProfile` set user_type='System User'
|
||||||
|
where user_type='Partner' and exists (select name from `tabUserRole`
|
||||||
|
where parent=`tabProfile`.name)""")
|
@ -217,5 +217,6 @@ patch_list = [
|
|||||||
"execute:webnotes.bean('Global Defaults').save()",
|
"execute:webnotes.bean('Global Defaults').save()",
|
||||||
"patches.march_2013.p07_update_project_in_stock_ledger",
|
"patches.march_2013.p07_update_project_in_stock_ledger",
|
||||||
"execute:webnotes.bean('Style Settings').save() #2013-03-25",
|
"execute:webnotes.bean('Style Settings').save() #2013-03-25",
|
||||||
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)"
|
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
|
||||||
|
"patches.march_2013.p09_unset_user_type_partner",
|
||||||
]
|
]
|
@ -1,10 +1,10 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2012-07-12 23:29:44",
|
"creation": "2013-03-25 17:53:21",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-25 17:32:05",
|
"modified": "2013-03-25 18:41:27",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "harshada@webnotestech.com"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_copy": 1,
|
"allow_copy": 1,
|
||||||
@ -34,9 +34,7 @@
|
|||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 0,
|
|
||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"submit": 0,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -76,6 +76,12 @@ wn.module_page["Setup"] = [
|
|||||||
label: wn._("Manage numbering series"),
|
label: wn._("Manage numbering series"),
|
||||||
"description":wn._("Set multiple numbering series for transactions")
|
"description":wn._("Set multiple numbering series for transactions")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"route":"Form/Rename Tool",
|
||||||
|
doctype: "Rename Tool",
|
||||||
|
label: wn._("Rename Tool"),
|
||||||
|
"description":wn._("Rename multiple items in one go")
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,189 +1,169 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"owner": "Administrator",
|
"creation": "2013-02-22 01:28:05",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2010-08-08 17:09:35",
|
"modified": "2013-03-26 07:58:20",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-04-02 14:03:39"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "Table Mapper Detail",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
"parent": "Purchase Order-Purchase Receipt",
|
"parent": "Purchase Order-Purchase Receipt",
|
||||||
"doctype": "Table Mapper Detail",
|
"parentfield": "table_mapper_details",
|
||||||
"parenttype": "DocType Mapper",
|
"parenttype": "DocType Mapper"
|
||||||
"parentfield": "table_mapper_details"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "Field Mapper Detail",
|
||||||
"map": "Yes",
|
"map": "Yes",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
"parent": "Purchase Order-Purchase Receipt",
|
"parent": "Purchase Order-Purchase Receipt",
|
||||||
"doctype": "Field Mapper Detail",
|
"parentfield": "field_mapper_details",
|
||||||
"parenttype": "DocType Mapper",
|
"parenttype": "DocType Mapper"
|
||||||
"parentfield": "field_mapper_details"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "__common__",
|
|
||||||
"to_doctype": "Purchase Receipt",
|
|
||||||
"module": "Stock",
|
|
||||||
"doctype": "DocType Mapper",
|
"doctype": "DocType Mapper",
|
||||||
|
"from_doctype": "Purchase Order",
|
||||||
|
"module": "Stock",
|
||||||
|
"name": "__common__",
|
||||||
"ref_doc_submitted": 1,
|
"ref_doc_submitted": 1,
|
||||||
"from_doctype": "Purchase Order"
|
"to_doctype": "Purchase Receipt"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Purchase Order-Purchase Receipt",
|
"doctype": "DocType Mapper",
|
||||||
"doctype": "DocType Mapper"
|
"name": "Purchase Order-Purchase Receipt"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match_id": 0,
|
"checking_operator": "=",
|
||||||
"to_field": "supplier",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
"from_field": "supplier",
|
"from_field": "supplier",
|
||||||
"checking_operator": "="
|
"match_id": 0,
|
||||||
|
"to_field": "supplier"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match_id": 0,
|
"checking_operator": "=",
|
||||||
"to_field": "company",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
"from_field": "company",
|
"from_field": "company",
|
||||||
"checking_operator": "="
|
"match_id": 0,
|
||||||
|
"to_field": "company"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match_id": 0,
|
"checking_operator": "=",
|
||||||
"to_field": "currency",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
"from_field": "currency",
|
"from_field": "currency",
|
||||||
"checking_operator": "="
|
"match_id": 0,
|
||||||
|
"to_field": "currency"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "prevdoc_detail_docname",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "name",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "name"
|
"to_field": "prevdoc_detail_docname"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "prevdoc_docname",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "parent",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "parent"
|
"to_field": "prevdoc_docname"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "prevdoc_doctype",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "parenttype",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "parenttype"
|
"to_field": "prevdoc_doctype"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match_id": 1,
|
"checking_operator": "=",
|
||||||
"to_field": "item_code",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
"from_field": "item_code",
|
"from_field": "item_code",
|
||||||
"checking_operator": "="
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"to_field": "received_qty",
|
|
||||||
"doctype": "Field Mapper Detail",
|
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) "
|
"to_field": "item_code"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "qty",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) ",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) "
|
"to_field": "received_qty"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "stock_qty",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) ",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)"
|
"to_field": "qty"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "import_amount",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)"
|
"to_field": "stock_qty"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "amount",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)"
|
"to_field": "import_amount"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "schedule_date",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)",
|
||||||
"match_id": 1,
|
"match_id": 1,
|
||||||
"from_field": "schedule_date"
|
"to_field": "amount"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "net_total",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "schedule_date",
|
||||||
|
"match_id": 1,
|
||||||
|
"to_field": "schedule_date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "net_total",
|
||||||
"match_id": 0,
|
"match_id": 0,
|
||||||
"from_field": "net_total"
|
"to_field": "net_total"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "grand_total",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "grand_total",
|
||||||
"match_id": 0,
|
"match_id": 0,
|
||||||
"from_field": "grand_total"
|
"to_field": "grand_total"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "total_tax",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "total_tax",
|
||||||
"match_id": 0,
|
"match_id": 0,
|
||||||
"from_field": "total_tax"
|
"to_field": "total_tax"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"to_field": "conversion_rate",
|
|
||||||
"doctype": "Field Mapper Detail",
|
"doctype": "Field Mapper Detail",
|
||||||
|
"from_field": "conversion_rate",
|
||||||
"match_id": 0,
|
"match_id": 0,
|
||||||
"from_field": "conversion_rate"
|
"to_field": "conversion_rate"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"reference_key": "prevdoc_detail_docname",
|
|
||||||
"match_id": 1,
|
|
||||||
"reference_doctype_key": "prevdoc_doctype",
|
|
||||||
"to_field": "purchase_receipt_details",
|
|
||||||
"doctype": "Table Mapper Detail",
|
"doctype": "Table Mapper Detail",
|
||||||
"from_field": "po_details",
|
"from_field": "po_details",
|
||||||
"from_table": "Purchase Order Item",
|
"from_table": "Purchase Order Item",
|
||||||
|
"match_id": 1,
|
||||||
|
"reference_doctype_key": "prevdoc_doctype",
|
||||||
|
"reference_key": "prevdoc_detail_docname",
|
||||||
|
"to_field": "purchase_receipt_details",
|
||||||
"to_table": "Purchase Receipt Item",
|
"to_table": "Purchase Receipt Item",
|
||||||
"validation_logic": "docstatus=1 and qty > ifnull(received_qty,0)"
|
"validation_logic": "docstatus=1 and qty > ifnull(received_qty,0)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"reference_key": "prevdoc_detail_docname",
|
|
||||||
"match_id": 1,
|
|
||||||
"reference_doctype_key": "prevdoc_doctype",
|
|
||||||
"to_field": "purchase_receipt_details",
|
|
||||||
"doctype": "Table Mapper Detail",
|
|
||||||
"from_field": "po_details",
|
|
||||||
"from_table": "Purchase Order Item",
|
|
||||||
"to_table": "Purchase Receipt Item",
|
|
||||||
"validation_logic": "docstatus=1 and qty > ifnull(received_qty,0)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"reference_key": "prevdoc_docname",
|
|
||||||
"match_id": 0,
|
|
||||||
"doctype": "Table Mapper Detail",
|
"doctype": "Table Mapper Detail",
|
||||||
"from_table": "Purchase Order",
|
"from_table": "Purchase Order",
|
||||||
|
"match_id": 0,
|
||||||
|
"reference_key": "prevdoc_docname",
|
||||||
"to_table": "Purchase Receipt",
|
"to_table": "Purchase Receipt",
|
||||||
"validation_logic": "docstatus = 1"
|
"validation_logic": "docstatus = 1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match_id": 2,
|
|
||||||
"to_field": "purchase_tax_details",
|
|
||||||
"doctype": "Table Mapper Detail",
|
"doctype": "Table Mapper Detail",
|
||||||
"from_field": "purchase_tax_details",
|
"from_field": "purchase_tax_details",
|
||||||
"from_table": "Purchase Taxes and Charges",
|
"from_table": "Purchase Taxes and Charges",
|
||||||
"to_table": "Purchase Taxes and Charges",
|
|
||||||
"validation_logic": "docstatus = 1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match_id": 2,
|
"match_id": 2,
|
||||||
"to_field": "purchase_tax_details",
|
"to_field": "purchase_tax_details",
|
||||||
"doctype": "Table Mapper Detail",
|
|
||||||
"from_field": "purchase_tax_details",
|
|
||||||
"from_table": "Purchase Taxes and Charges",
|
|
||||||
"to_table": "Purchase Taxes and Charges",
|
"to_table": "Purchase Taxes and Charges",
|
||||||
"validation_logic": "docstatus = 1"
|
"validation_logic": "docstatus = 1"
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,6 @@ class DocType(SellingController):
|
|||||||
self.values.append({
|
self.values.append({
|
||||||
'item_code' : d['item_code'],
|
'item_code' : d['item_code'],
|
||||||
'warehouse' : wh,
|
'warehouse' : wh,
|
||||||
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
|
|
||||||
'posting_date' : self.doc.posting_date,
|
'posting_date' : self.doc.posting_date,
|
||||||
'posting_time' : self.doc.posting_time,
|
'posting_time' : self.doc.posting_time,
|
||||||
'voucher_type' : 'Delivery Note',
|
'voucher_type' : 'Delivery Note',
|
||||||
|
@ -55,6 +55,7 @@ class DocType(StockController):
|
|||||||
self.validate_finished_goods()
|
self.validate_finished_goods()
|
||||||
self.validate_return_reference_doc()
|
self.validate_return_reference_doc()
|
||||||
self.validate_with_material_request()
|
self.validate_with_material_request()
|
||||||
|
self.validate_fiscal_year()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.update_serial_no(1)
|
self.update_serial_no(1)
|
||||||
@ -68,6 +69,11 @@ class DocType(StockController):
|
|||||||
self.update_production_order(0)
|
self.update_production_order(0)
|
||||||
self.make_gl_entries()
|
self.make_gl_entries()
|
||||||
|
|
||||||
|
def validate_fiscal_year(self):
|
||||||
|
import accounts.utils
|
||||||
|
accounts.utils.validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year,
|
||||||
|
self.meta.get_label("posting_date"))
|
||||||
|
|
||||||
def validate_purpose(self):
|
def validate_purpose(self):
|
||||||
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer",
|
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer",
|
||||||
"Manufacture/Repack", "Subcontract", "Sales Return", "Purchase Return"]
|
"Manufacture/Repack", "Subcontract", "Sales Return", "Purchase Return"]
|
||||||
@ -776,8 +782,6 @@ def make_return_jv(stock_entry):
|
|||||||
|
|
||||||
from accounts.utils import get_balance_on
|
from accounts.utils import get_balance_on
|
||||||
for r in result:
|
for r in result:
|
||||||
if not r.get("account"):
|
|
||||||
print result
|
|
||||||
jv_list.append({
|
jv_list.append({
|
||||||
"__islocal": 1,
|
"__islocal": 1,
|
||||||
"doctype": "Journal Voucher Detail",
|
"doctype": "Journal Voucher Detail",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-03-11 12:34:40",
|
"creation": "2013-03-26 06:51:17",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-19 17:48:29",
|
"modified": "2013-03-26 07:24:53",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -542,6 +542,16 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "fiscal_year",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"in_filter": 0,
|
||||||
|
"label": "Fiscal Year",
|
||||||
|
"options": "link:Fiscal Year",
|
||||||
|
"print_hide": 1,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -610,13 +620,5 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Manufacturing User"
|
"role": "Manufacturing User"
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Manufacturing Manager"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Material Manager"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -490,7 +490,7 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
def test_make_return_jv_for_purchase_receipt(self):
|
def test_make_return_jv_for_purchase_receipt(self):
|
||||||
se, pr_name = self.test_purchase_receipt_return()
|
se, pr_name = self.test_purchase_receipt_return()
|
||||||
self._test_purchase_return_jv(se)
|
self._test_purchase_return_jv(se)
|
||||||
|
|
||||||
se, pr_name = self._test_purchase_return_return_against_purchase_order()
|
se, pr_name = self._test_purchase_return_return_against_purchase_order()
|
||||||
self._test_purchase_return_jv(se)
|
self._test_purchase_return_jv(se)
|
||||||
|
|
||||||
|
@ -101,22 +101,25 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
|||||||
show_upload: function() {
|
show_upload: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
|
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
|
||||||
var upload_area = $('<div id="dit-upload-area"></div>').appendTo($wrapper);
|
|
||||||
|
|
||||||
// upload
|
// upload
|
||||||
wn.upload.make({
|
wn.upload.make({
|
||||||
parent: $('#dit-upload-area'),
|
parent: $wrapper,
|
||||||
args: {
|
args: {
|
||||||
method: 'stock.doctype.stock_reconciliation.stock_reconciliation.upload'
|
method: 'stock.doctype.stock_reconciliation.stock_reconciliation.upload'
|
||||||
},
|
},
|
||||||
sample_url: "e.g. http://example.com/somefile.csv",
|
sample_url: "e.g. http://example.com/somefile.csv",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
$wrapper.find(".dit-progress-area").toggle(false);
|
|
||||||
me.frm.set_value("reconciliation_json", JSON.stringify(r));
|
me.frm.set_value("reconciliation_json", JSON.stringify(r));
|
||||||
me.show_reconciliation_data();
|
me.show_reconciliation_data();
|
||||||
me.frm.save();
|
me.frm.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// rename button
|
||||||
|
$wrapper.find('form input[type="submit"]')
|
||||||
|
.attr('value', 'Upload')
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
show_download_reconciliation_data: function() {
|
show_download_reconciliation_data: function() {
|
||||||
|
0
utilities/doctype/rename_tool/__init__.py
Normal file
0
utilities/doctype/rename_tool/__init__.py
Normal file
47
utilities/doctype/rename_tool/rename_tool.js
Normal file
47
utilities/doctype/rename_tool/rename_tool.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
cur_frm.cscript.refresh = function(doc) {
|
||||||
|
wn.call({
|
||||||
|
method:"utilities.doctype.rename_tool.rename_tool.get_doctypes",
|
||||||
|
callback: function(r) {
|
||||||
|
cur_frm.set_df_property("select_doctype", "options", r.message);
|
||||||
|
cur_frm.cscript.setup_upload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.select_doctype = function() {
|
||||||
|
cur_frm.cscript.setup_upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.setup_upload = function() {
|
||||||
|
var me = this;
|
||||||
|
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty()
|
||||||
|
.html("<hr><div class='alert'>" +
|
||||||
|
wn._("Upload a .csv file with two columns: the old name and the new name. Max 500 rows.")
|
||||||
|
+ "</div>");
|
||||||
|
var $log = $(cur_frm.fields_dict.rename_log.wrapper).empty();
|
||||||
|
|
||||||
|
// upload
|
||||||
|
wn.upload.make({
|
||||||
|
parent: $wrapper,
|
||||||
|
args: {
|
||||||
|
method: 'utilities.doctype.rename_tool.rename_tool.upload',
|
||||||
|
select_doctype: cur_frm.doc.select_doctype
|
||||||
|
},
|
||||||
|
sample_url: "e.g. http://example.com/somefile.csv",
|
||||||
|
callback: function(r) {
|
||||||
|
$log.empty().html("<hr>");
|
||||||
|
$.each(r, function(i, v) {
|
||||||
|
$("<div>" + v + "</div>").appendTo($log);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// rename button
|
||||||
|
$wrapper.find('form input[type="submit"]')
|
||||||
|
.click(function() {
|
||||||
|
$log.html("Working...");
|
||||||
|
})
|
||||||
|
.addClass("btn-info")
|
||||||
|
.attr('value', 'Upload and Rename')
|
||||||
|
|
||||||
|
}
|
49
utilities/doctype/rename_tool/rename_tool.py
Normal file
49
utilities/doctype/rename_tool/rename_tool.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import webnotes
|
||||||
|
from webnotes import _
|
||||||
|
|
||||||
|
class DocType:
|
||||||
|
def __init__(self, d, dl):
|
||||||
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_doctypes():
|
||||||
|
return webnotes.conn.sql_list("""select name from tabDocType
|
||||||
|
where ifnull(allow_rename,0)=1 and module!='Core' order by name""")
|
||||||
|
|
||||||
|
@webnotes.whitelist(allow_roles=["System Manager"])
|
||||||
|
def upload(select_doctype=None, rows=None):
|
||||||
|
from webnotes.utils.datautils import read_csv_content_from_uploaded_file
|
||||||
|
from webnotes.modules import scrub
|
||||||
|
from webnotes.model.rename_doc import rename_doc
|
||||||
|
|
||||||
|
if not select_doctype:
|
||||||
|
select_doctype = webnotes.form_dict.select_doctype
|
||||||
|
|
||||||
|
if not rows:
|
||||||
|
rows = read_csv_content_from_uploaded_file()
|
||||||
|
if not rows:
|
||||||
|
webnotes.msgprint(_("Please select a valid csv file with data."))
|
||||||
|
raise Exception
|
||||||
|
|
||||||
|
if len(rows) > 500:
|
||||||
|
webnotes.msgprint(_("Max 500 rows only."))
|
||||||
|
raise Exception
|
||||||
|
|
||||||
|
rename_log = []
|
||||||
|
for row in rows:
|
||||||
|
if len(row) > 2:
|
||||||
|
try:
|
||||||
|
if rename_doc(select_doctype, row[0], row[1]):
|
||||||
|
rename_log.append(_("Successful: ") + row[0] + " -> " + row[1])
|
||||||
|
webnotes.conn.commit()
|
||||||
|
else:
|
||||||
|
rename_log.append(_("Ignored: ") + row[0] + " -> " + row[1])
|
||||||
|
except Exception, e:
|
||||||
|
rename_log.append("<span style='color: RED'>" + \
|
||||||
|
_("Failed: ") + row[0] + " -> " + row[1] + "</span>")
|
||||||
|
rename_log.append("<span style='margin-left: 20px;'>" + repr(e) + "</span>")
|
||||||
|
|
||||||
|
return rename_log
|
69
utilities/doctype/rename_tool/rename_tool.txt
Normal file
69
utilities/doctype/rename_tool/rename_tool.txt
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"creation": "2012-12-03 10:25:59",
|
||||||
|
"docstatus": 0,
|
||||||
|
"modified": "2013-03-26 12:46:07",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"owner": "Administrator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_attach": 0,
|
||||||
|
"allow_email": 1,
|
||||||
|
"allow_print": 1,
|
||||||
|
"doctype": "DocType",
|
||||||
|
"hide_heading": 0,
|
||||||
|
"hide_toolbar": 1,
|
||||||
|
"issingle": 1,
|
||||||
|
"max_attachments": 1,
|
||||||
|
"module": "Utilities",
|
||||||
|
"name": "__common__"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"name": "__common__",
|
||||||
|
"parent": "Rename Tool",
|
||||||
|
"parentfield": "fields",
|
||||||
|
"parenttype": "DocType",
|
||||||
|
"permlevel": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"name": "__common__",
|
||||||
|
"parent": "Rename Tool",
|
||||||
|
"parentfield": "permissions",
|
||||||
|
"parenttype": "DocType",
|
||||||
|
"permlevel": 0,
|
||||||
|
"read": 1,
|
||||||
|
"report": 0,
|
||||||
|
"role": "System Manager",
|
||||||
|
"submit": 0,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocType",
|
||||||
|
"name": "Rename Tool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Type of document to rename.",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "select_doctype",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Select DocType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "upload_html",
|
||||||
|
"fieldtype": "HTML",
|
||||||
|
"label": "Upload HTML"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "rename_log",
|
||||||
|
"fieldtype": "HTML",
|
||||||
|
"label": "Rename Log"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
}
|
||||||
|
]
|
@ -250,4 +250,5 @@ class TransactionBase(DocListController):
|
|||||||
|
|
||||||
def validate_posting_time(self):
|
def validate_posting_time(self):
|
||||||
if not self.doc.posting_time:
|
if not self.doc.posting_time:
|
||||||
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
|
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user