Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Priya 2013-09-10 17:18:55 +05:30
commit db633073a2
16 changed files with 112 additions and 53 deletions

View File

@ -2,11 +2,12 @@
{
"creation": "2013-03-25 10:53:52",
"docstatus": 0,
"modified": "2013-08-08 14:21:56",
"modified": "2013-09-10 14:59:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_import": 1,
"autoname": "naming_series:",
"doctype": "DocType",
"icon": "icon-file-text",

View File

@ -40,13 +40,15 @@ class DocType:
msgprint(_("Expense Account is mandatory"), raise_exception=1)
def validate_all_link_fields(self):
accounts = {"Account": [self.doc.cash_bank_account, self.doc.income_account, self.doc.expense_account], \
"Cost Center": [self.doc.cost_center], "Warehouse": [self.doc.warehouse]}
accounts = {"Account": [self.doc.cash_bank_account, self.doc.income_account,
self.doc.expense_account], "Cost Center": [self.doc.cost_center],
"Warehouse": [self.doc.warehouse]}
for link_dt, dn_list in accounts.items():
for link_dn in dn_list:
if not webnotes.conn.exists({"doctype": link_dt, "company": self.doc.company, "name": link_dn}):
msgprint(link_dn +_(" does not belong to ") + self.doc.company)
if link_dn and not webnotes.conn.exists({"doctype": link_dt,
"company": self.doc.company, "name": link_dn}):
webnotes.throw(link_dn +_(" does not belong to ") + self.doc.company)
def on_update(self):
webnotes.defaults.clear_default("is_pos")

View File

@ -62,8 +62,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(cint(doc.update_stock)!=1)
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false;
from_delivery_note = cur_frm.get_doclist({parentfield: "entries"})
.some(function(item) {
return item.delivery_note ? true : false;
});
if(!from_delivery_note)
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
}
if(doc.outstanding_amount!=0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:11",
"docstatus": 0,
"modified": "2013-09-02 16:25:44",
"modified": "2013-09-10 10:53:50",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -137,13 +137,15 @@
"fieldname": "communication_history",
"fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments"
"options": "icon-comments",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "communication_html",
"fieldtype": "HTML",
"label": "Communication HTML"
"label": "Communication HTML",
"print_hide": 1
},
{
"doctype": "DocField",
@ -210,7 +212,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"cancel": 0,

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-29 19:25:37",
"docstatus": 0,
"modified": "2013-09-02 16:26:23",
"modified": "2013-09-10 10:51:51",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -95,7 +95,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"doctype": "DocPerm"

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-11 14:26:44",
"docstatus": 0,
"modified": "2013-09-02 16:25:13",
"modified": "2013-09-10 10:50:50",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -195,14 +195,16 @@
"fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments",
"permlevel": 0
"permlevel": 0,
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "communication_html",
"fieldtype": "HTML",
"label": "Communication HTML",
"permlevel": 0
"permlevel": 0,
"print_hide": 1
},
{
"doctype": "DocField",
@ -355,7 +357,8 @@
"hidden": 1,
"label": "Communications",
"options": "Communication",
"permlevel": 0
"permlevel": 0,
"print_hide": 1
},
{
"amend": 0,

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-10 11:45:37",
"docstatus": 0,
"modified": "2013-09-02 17:25:59",
"modified": "2013-09-10 10:52:20",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -159,7 +159,8 @@
"fieldname": "communication_history",
"fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments"
"options": "icon-comments",
"print_hide": 1
},
{
"allow_on_submit": 0,
@ -168,7 +169,8 @@
"fieldtype": "HTML",
"label": "Communication HTML",
"oldfieldname": "follow_up",
"oldfieldtype": "Table"
"oldfieldtype": "Table",
"print_hide": 1
},
{
"doctype": "DocField",
@ -416,7 +418,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"cancel": 1,

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
"modified": "2013-09-02 16:27:33",
"modified": "2013-09-10 10:52:49",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -168,6 +168,7 @@
"label": "Communication History",
"oldfieldtype": "Section Break",
"options": "icon-comments",
"print_hide": 1,
"read_only": 0
},
{
@ -178,6 +179,7 @@
"label": "Communication HTML",
"oldfieldname": "follow_up",
"oldfieldtype": "Table",
"print_hide": 1,
"read_only": 0
},
{
@ -448,7 +450,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"doctype": "DocPerm",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
"modified": "2013-09-02 16:25:01",
"modified": "2013-09-10 10:46:33",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -841,7 +841,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"amend": 1,

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:24",
"docstatus": 0,
"modified": "2013-09-02 16:26:54",
"modified": "2013-09-10 10:53:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -166,7 +166,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"cancel": 0,

View File

@ -16,7 +16,17 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
refresh: function(doc, dt, dn) {
this._super();
if(!doc.__billing_complete && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
if(!doc.__billing_complete && doc.docstatus==1) {
// show Make Invoice button only if Delivery Note is not created from Sales Invoice
var from_sales_invoice = false;
from_sales_invoice = cur_frm.get_doclist({parentfield: "delivery_note_details"})
.some(function(item) {
return item.prevdoc_doctype==="Sales Invoice" ? true : false;
});
if(!from_sales_invoice)
cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
}
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);

View File

@ -30,8 +30,8 @@ class DocType(DocListController):
self.check_warehouse_is_set_for_stock_item()
self.check_stock_uom_with_bin()
self.validate_conversion_factor()
self.add_default_uom_in_conversion_factor_table()
self.validate_conversion_factor()
self.valiadte_item_type()
self.check_for_active_boms()
self.validate_price_lists()
@ -59,15 +59,38 @@ class DocType(DocListController):
ch = addchild(self.doc, 'uom_conversion_details', 'UOM Conversion Detail', self.doclist)
ch.uom = self.doc.stock_uom
ch.conversion_factor = 1
for d in self.doclist.get({"parentfield": "uom_conversion_details"}):
if d.conversion_factor == 1 and d.uom != self.doc.stock_uom:
self.doclist.remove(d)
def check_stock_uom_with_bin(self):
if not self.doc.fields.get("__islocal"):
bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
self.doc.name)
if self.doc.stock_uom and bin and cstr(bin[0][0]) \
and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."),
raise_exception=1)
matched=True
ref_uom = webnotes.conn.get_value("Stock Ledger Entry",
{"item_code": self.doc.name, "is_cancelled": "No"}, "stock_uom")
if ref_uom:
if cstr(ref_uom) != cstr(self.doc.stock_uom):
matched = False
else:
bin_list = webnotes.conn.sql("select * from tabBin where item_code=%s",
self.doc.item_code, as_dict=1)
for bin in bin_list:
if bin.reserved_qty > 0 or bin.ordered_qty > 0 or bin.indented_qty > 0 \
or bin.planned_qty > 0 and cstr(bin.stock_uom) != cstr(self.doc.stock_uom):
matched = False
break
if matched and bin_list:
webnotes.conn.sql("""update tabBin set stock_uom=%s where item_code=%s""",
(self.doc.stock_uom, self.doc.name))
if not matched:
webnotes.throw(_("Default Unit of Measure can not be changed directly \
because you have already made some transaction(s) with another UOM.\n \
To change default UOM, use 'UOM Replace Utility' tool under Stock module."))
def validate_conversion_factor(self):
check_list = []

View File

@ -8,7 +8,7 @@ from webnotes.utils import cstr, flt, now, cint
from webnotes.model import db_exists
from webnotes.model.bean import copy_doclist
from webnotes.model.code import get_obj
from webnotes import msgprint
from webnotes import msgprint, _
sql = webnotes.conn.sql
@ -41,11 +41,11 @@ class DocType:
raise Exception
def update_item_master(self):
# update stock uom in item master
sql("update `tabItem` set stock_uom = '%s' where name = '%s' " % (self.doc.new_stock_uom, self.doc.item_code))
item_bean = webnotes.bean("Item", self.doc.item_code)
item_bean.doc.stock_uom = self.doc.new_stock_uom
item_bean.save()
# acknowledge user
msgprint("New Stock UOM : " + cstr(self.doc.new_stock_uom) + " updated in Item : " + cstr(self.doc.item_code))
msgprint(_("Default UOM updated in item ") + self.doc.item_code)
def update_bin(self):
# update bin
@ -80,20 +80,14 @@ class DocType:
# Update Stock UOM
def update_stock_uom(self):
# validate mandatory
self.validate_mandatory()
self.validate_uom_integer_type()
# update item master
self.update_item_master()
# update stock ledger entry
self.update_stock_ledger_entry()
# update bin
self.update_bin()
get_obj("Item", self.doc.item_code).on_update()
def validate_uom_integer_type(self):
current_is_integer = webnotes.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number")

View File

@ -2,7 +2,7 @@
{
"creation": "2013-02-01 10:36:25",
"docstatus": 0,
"modified": "2013-09-02 16:24:24",
"modified": "2013-09-10 10:54:02",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -267,7 +267,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"cancel": 0,

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:32",
"docstatus": 0,
"modified": "2013-09-02 16:26:13",
"modified": "2013-09-10 10:50:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -101,13 +101,15 @@
"fieldname": "sb00",
"fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments"
"options": "icon-comments",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "communication_html",
"fieldtype": "HTML",
"label": "Communication HTML"
"label": "Communication HTML",
"print_hide": 1
},
{
"doctype": "DocField",
@ -231,7 +233,8 @@
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
"options": "Communication",
"print_hide": 1
},
{
"cancel": 1,

View File

@ -11,7 +11,7 @@ from website.helpers.cart import _get_cart_quotation
@webnotes.whitelist(allow_guest=True)
def get_product_info(item_code):
"""get product price / stock info"""
if not webnotes.conn.get_default("shopping_cart_enabled"):
if not cint(webnotes.conn.get_default("shopping_cart_enabled")):
return {}
cart_quotation = _get_cart_quotation()