Merge branch 'develop' of github.com:frappe/erpnext into v4-hotfix

This commit is contained in:
Nabin Hait 2014-05-06 18:53:02 +05:30
commit a521343063
10 changed files with 707 additions and 775 deletions

View File

@ -12,8 +12,6 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
onload: function() { onload: function() {
this.setup_leave_approver_select(); this.setup_leave_approver_select();
this.frm.toggle_display(["esic_card_no", "gratuity_lic_id", "pan_number", "pf_number"],
frappe.boot.sysdefaults.country==="India");
if(this.frm.doc.__islocal) this.frm.set_value("employee_name", ""); if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
}, },

View File

@ -337,30 +337,6 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "esic_card_no",
"fieldtype": "Data",
"label": "ESIC CARD No",
"oldfieldname": "esic_card_no",
"oldfieldtype": "Data",
"permlevel": 0
},
{
"fieldname": "pf_number",
"fieldtype": "Data",
"label": "PF Number",
"oldfieldname": "pf_number",
"oldfieldtype": "Data",
"permlevel": 0
},
{
"fieldname": "gratuity_lic_id",
"fieldtype": "Data",
"label": "Gratuity LIC ID",
"oldfieldname": "gratuity_lic_id",
"oldfieldtype": "Data",
"permlevel": 0
},
{ {
"fieldname": "organization_profile", "fieldname": "organization_profile",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@ -497,12 +473,6 @@
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{
"fieldname": "pan_number",
"fieldtype": "Data",
"label": "PAN Number",
"permlevel": 0
},
{ {
"fieldname": "passport_number", "fieldname": "passport_number",
"fieldtype": "Data", "fieldtype": "Data",
@ -711,7 +681,7 @@
], ],
"icon": "icon-user", "icon": "icon-user",
"idx": 1, "idx": 1,
"modified": "2014-04-30 09:03:10.879762", "modified": "2014-04-30 09:03:11.879762",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Employee", "name": "Employee",

View File

@ -71,24 +71,6 @@
"read_only": 1, "read_only": 1,
"search_index": 0 "search_index": 0
}, },
{
"fieldname": "pf_no",
"fieldtype": "Data",
"label": "PF No.",
"oldfieldname": "pf_no",
"oldfieldtype": "Data",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "esic_no",
"fieldtype": "Data",
"label": "ESIC No.",
"oldfieldname": "esic_no",
"oldfieldtype": "Data",
"permlevel": 0,
"read_only": 1
},
{ {
"fieldname": "letter_head", "fieldname": "letter_head",
"fieldtype": "Link", "fieldtype": "Link",
@ -343,7 +325,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-05-01 04:21:14.543092", "modified": "2014-05-01 04:22:14.543092",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Salary Slip", "name": "Salary Slip",

View File

@ -38,12 +38,10 @@ class SalarySlip(TransactionBase):
def pull_emp_details(self): def pull_emp_details(self):
emp = frappe.db.get_value("Employee", self.employee, emp = frappe.db.get_value("Employee", self.employee,
["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1) ["bank_name", "bank_ac_no"], as_dict=1)
if emp: if emp:
self.bank_name = emp.bank_name self.bank_name = emp.bank_name
self.bank_account_no = emp.bank_ac_no self.bank_account_no = emp.bank_ac_no
self.esic_no = emp.esic_card_no
self.pf_no = emp.pf_number
def get_leave_details(self, lwp=None): def get_leave_details(self, lwp=None):
if not self.fiscal_year: if not self.fiscal_year:

View File

@ -29,12 +29,10 @@ class SalaryStructure(Document):
return ret return ret
def get_ss_values(self,employee): def get_ss_values(self,employee):
basic_info = frappe.db.sql("""select bank_name, bank_ac_no, esic_card_no, pf_number basic_info = frappe.db.sql("""select bank_name, bank_ac_no
from `tabEmployee` where name =%s""", employee) from `tabEmployee` where name =%s""", employee)
ret = {'bank_name': basic_info and basic_info[0][0] or '', ret = {'bank_name': basic_info and basic_info[0][0] or '',
'bank_ac_no': basic_info and basic_info[0][1] or '', 'bank_ac_no': basic_info and basic_info[0][1] or ''}
'esic_no': basic_info and basic_info[0][2] or '',
'pf_no': basic_info and basic_info[0][3] or ''}
return ret return ret
def make_table(self, doct_name, tab_fname, tab_name): def make_table(self, doct_name, tab_fname, tab_name):

View File

@ -37,3 +37,4 @@ execute:frappe.delete_doc("Page", "Financial Statements")
execute:frappe.delete_doc("DocType", "Stock Ledger") execute:frappe.delete_doc("DocType", "Stock Ledger")
execute:frappe.db.sql("update `tabJournal Voucher` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''") execute:frappe.db.sql("update `tabJournal Voucher` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
execute:frappe.delete_doc("DocType", "Grade") execute:frappe.delete_doc("DocType", "Grade")
erpnext.patches.4_0.remove_india_specific_fields

View File

@ -0,0 +1,27 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.core.doctype.custom_field.custom_field import create_custom_field_if_values_exist
def execute():
docfields = {
("Purchase Receipt", "challan_no"): frappe.get_meta("Purchase Receipt").get_field("challan_no"),
("Purchase Receipt", "challan_date"): frappe.get_meta("Purchase Receipt").get_field("challan_date"),
("Employee", "pf_number"): frappe.get_meta("Employee").get_field("pf_number"),
("Employee", "pan_number"): frappe.get_meta("Employee").get_field("pan_number"),
("Employee", "gratuity_lic_id"): frappe.get_meta("Employee").get_field("gratuity_lic_id"),
("Employee", "esic_card_no"): frappe.get_meta("Employee").get_field("esic_card_no"),
("Salary Slip", "esic_no"): frappe.get_meta("Salary Slip").get_field("esic_no"),
("Salary Slip", "pf_no"): frappe.get_meta("Salary Slip").get_field("pf_no")
}
for (doctype, fieldname), df in docfields.items():
opts = df.as_dict()
if df.idx >= 2:
opts["insert_after"] = frappe.get_meta(doctype).get("fields")[df.idx - 2].fieldname
frappe.delete_doc("DocField", df.name)
frappe.clear_cache(doctype=doctype)
create_custom_field_if_values_exist(doctype, opts)

View File

@ -14,18 +14,18 @@ frappe.provide("erpnext.stock");
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
refresh: function() { refresh: function() {
this._super(); this._super();
if(this.frm.doc.docstatus == 1) { if(this.frm.doc.docstatus == 1) {
if(!this.frm.doc.__billing_complete) { if(!this.frm.doc.__billing_complete) {
cur_frm.add_custom_button(__('Make Purchase Invoice'), cur_frm.add_custom_button(__('Make Purchase Invoice'),
this.make_purchase_invoice); this.make_purchase_invoice);
} }
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
this.show_stock_ledger(); this.show_stock_ledger();
this.show_general_ledger(); this.show_general_ledger();
} else { } else {
cur_frm.add_custom_button(__(__('From Purchase Order')), cur_frm.add_custom_button(__(__('From Purchase Order')),
function() { function() {
frappe.model.map_current_doc({ frappe.model.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt", method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
@ -40,12 +40,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
}) })
}); });
} }
if(frappe.boot.sysdefaults.country == 'India') {
unhide_field(['challan_no', 'challan_date']);
}
}, },
received_qty: function(doc, cdt, cdn) { received_qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["qty", "received_qty"]); frappe.model.round_floats_in(item, ["qty", "received_qty"]);
@ -53,30 +49,30 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty; item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
this.qty(doc, cdt, cdn); this.qty(doc, cdt, cdn);
}, },
qty: function(doc, cdt, cdn) { qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["qty", "received_qty"]); frappe.model.round_floats_in(item, ["qty", "received_qty"]);
if(!(item.received_qty || item.rejected_qty) && item.qty) { if(!(item.received_qty || item.rejected_qty) && item.qty) {
item.received_qty = item.qty; item.received_qty = item.qty;
} }
if(item.qty > item.received_qty) { if(item.qty > item.received_qty) {
msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "qty", item.name)), msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "qty", item.name)),
__(frappe.meta.get_label(item.doctype, "received_qty", item.name))])) __(frappe.meta.get_label(item.doctype, "received_qty", item.name))]))
item.qty = item.rejected_qty = 0.0; item.qty = item.rejected_qty = 0.0;
} else { } else {
item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item)); item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
} }
this._super(); this._super();
}, },
rejected_qty: function(doc, cdt, cdn) { rejected_qty: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn); var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]); frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
if(item.rejected_qty > item.received_qty) { if(item.rejected_qty > item.received_qty) {
msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)), msgprint(__("Error: {0} > {1}", [__(frappe.meta.get_label(item.doctype, "rejected_qty", item.name)),
__(frappe.meta.get_label(item.doctype, "received_qty", item.name))])); __(frappe.meta.get_label(item.doctype, "received_qty", item.name))]));
@ -84,21 +80,21 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
} else { } else {
item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item)); item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
} }
this.qty(doc, cdt, cdn); this.qty(doc, cdt, cdn);
}, },
make_purchase_invoice: function() { make_purchase_invoice: function() {
frappe.model.open_mapped_doc({ frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice", method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
source_name: cur_frm.doc.name source_name: cur_frm.doc.name
}) })
}, },
tc_name: function() { tc_name: function() {
this.get_terms(); this.get_terms();
}, },
}); });
// for backward compatibility: combine new and previous states // for backward compatibility: combine new and previous states

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,6 @@ class PurchaseReceipt(BuyingController):
self.validate_inspection() self.validate_inspection()
self.validate_uom_is_integer("uom", ["qty", "received_qty"]) self.validate_uom_is_integer("uom", ["qty", "received_qty"])
self.validate_uom_is_integer("stock_uom", "stock_qty") self.validate_uom_is_integer("stock_uom", "stock_qty")
self.validate_challan_no()
pc_obj = frappe.get_doc('Purchase Common') pc_obj = frappe.get_doc('Purchase Common')
pc_obj.validate_for_items(self) pc_obj.validate_for_items(self)
@ -89,15 +88,6 @@ class PurchaseReceipt(BuyingController):
frappe.throw(_("Accepted + Rejected Qty must be equal to Received quantity for Item {0}").format(d.item_code)) frappe.throw(_("Accepted + Rejected Qty must be equal to Received quantity for Item {0}").format(d.item_code))
def validate_challan_no(self):
"Validate if same challan no exists for same supplier in a submitted purchase receipt"
if self.challan_no:
exists = frappe.db.sql_list("""select name from `tabPurchase Receipt`
where docstatus=1 and name!=%s and supplier=%s and challan_no=%s
and fiscal_year=%s""", (self.name, self.supplier, self.challan_no, self.doc.fiscal_year))
if exists:
frappe.throw(_("Supplier delivery number duplicate in {0}").format(exists))
def validate_with_previous_doc(self): def validate_with_previous_doc(self):
super(PurchaseReceipt, self).validate_with_previous_doc(self.tname, { super(PurchaseReceipt, self).validate_with_previous_doc(self.tname, {
"Purchase Order": { "Purchase Order": {