[fix] [minor] merge conflict fixed

This commit is contained in:
Akhilesh Darjee 2013-09-11 14:49:38 +05:30
commit c3ec72c991
17 changed files with 115 additions and 57 deletions

View File

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

View File

@ -40,13 +40,15 @@ class DocType:
msgprint(_("Expense Account is mandatory"), raise_exception=1) msgprint(_("Expense Account is mandatory"), raise_exception=1)
def validate_all_link_fields(self): def validate_all_link_fields(self):
accounts = {"Account": [self.doc.cash_bank_account, self.doc.income_account, self.doc.expense_account], \ accounts = {"Account": [self.doc.cash_bank_account, self.doc.income_account,
"Cost Center": [self.doc.cost_center], "Warehouse": [self.doc.warehouse]} self.doc.expense_account], "Cost Center": [self.doc.cost_center],
"Warehouse": [self.doc.warehouse]}
for link_dt, dn_list in accounts.items(): for link_dt, dn_list in accounts.items():
for link_dn in dn_list: for link_dn in dn_list:
if not webnotes.conn.exists({"doctype": link_dt, "company": self.doc.company, "name": link_dn}): if link_dn and not webnotes.conn.exists({"doctype": link_dt,
msgprint(link_dn +_(" does not belong to ") + self.doc.company) "company": self.doc.company, "name": link_dn}):
webnotes.throw(link_dn +_(" does not belong to ") + self.doc.company)
def on_update(self): def on_update(self):
webnotes.defaults.clear_default("is_pos") 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); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(cint(doc.update_stock)!=1) 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']); cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
}
if(doc.outstanding_amount!=0) if(doc.outstanding_amount!=0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher); 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", "creation": "2013-01-10 16:34:11",
"docstatus": 0, "docstatus": 0,
"modified": "2013-09-02 16:25:44", "modified": "2013-09-10 10:53:50",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -137,13 +137,15 @@
"fieldname": "communication_history", "fieldname": "communication_history",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Communication History", "label": "Communication History",
"options": "icon-comments" "options": "icon-comments",
"print_hide": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "communication_html", "fieldname": "communication_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Communication HTML" "label": "Communication HTML",
"print_hide": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -210,7 +212,8 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 1, "hidden": 1,
"label": "Communications", "label": "Communications",
"options": "Communication" "options": "Communication",
"print_hide": 1
}, },
{ {
"cancel": 0, "cancel": 0,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:24", "creation": "2013-01-10 16:34:24",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-05 14:55:50", "modified": "2013-09-10 17:20:25",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -35,7 +35,7 @@
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"report": 1, "report": 0,
"role": "System Manager", "role": "System Manager",
"submit": 0, "submit": 0,
"write": 1 "write": 1
@ -78,7 +78,6 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "static_parameters", "fieldname": "static_parameters",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"label": "Static Parameters",
"width": "50%" "width": "50%"
}, },
{ {
@ -86,7 +85,7 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "static_parameter_details", "fieldname": "static_parameter_details",
"fieldtype": "Table", "fieldtype": "Table",
"label": "SMS Parameters", "label": "Static Parameters",
"options": "SMS Parameter" "options": "SMS Parameter"
}, },
{ {

View File

@ -16,7 +16,17 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
refresh: function(doc, dt, dn) { refresh: function(doc, dt, dn) {
this._super(); 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) if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note); cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);

View File

@ -29,8 +29,8 @@ class DocType(DocListController):
self.check_warehouse_is_set_for_stock_item() self.check_warehouse_is_set_for_stock_item()
self.check_stock_uom_with_bin() self.check_stock_uom_with_bin()
self.validate_conversion_factor()
self.add_default_uom_in_conversion_factor_table() self.add_default_uom_in_conversion_factor_table()
self.validate_conversion_factor()
self.validate_item_type() self.validate_item_type()
self.check_for_active_boms() self.check_for_active_boms()
self.fill_customer_code() self.fill_customer_code()
@ -58,14 +58,37 @@ class DocType(DocListController):
ch.uom = self.doc.stock_uom ch.uom = self.doc.stock_uom
ch.conversion_factor = 1 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): def check_stock_uom_with_bin(self):
if not self.doc.fields.get("__islocal"): if not self.doc.fields.get("__islocal"):
bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s", matched=True
self.doc.name) ref_uom = webnotes.conn.get_value("Stock Ledger Entry",
if self.doc.stock_uom and bin and cstr(bin[0][0]) \ {"item_code": self.doc.name, "is_cancelled": "No"}, "stock_uom")
and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."), if ref_uom:
raise_exception=1) 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): def validate_conversion_factor(self):
check_list = [] 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 import db_exists
from webnotes.model.bean import copy_doclist from webnotes.model.bean import copy_doclist
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from webnotes import msgprint from webnotes import msgprint, _
sql = webnotes.conn.sql sql = webnotes.conn.sql
@ -41,11 +41,11 @@ class DocType:
raise Exception raise Exception
def update_item_master(self): def update_item_master(self):
# update stock uom in item master item_bean = webnotes.bean("Item", self.doc.item_code)
sql("update `tabItem` set stock_uom = '%s' where name = '%s' " % (self.doc.new_stock_uom, self.doc.item_code)) item_bean.doc.stock_uom = self.doc.new_stock_uom
item_bean.save()
# acknowledge user msgprint(_("Default UOM updated in item ") + self.doc.item_code)
msgprint("New Stock UOM : " + cstr(self.doc.new_stock_uom) + " updated in Item : " + cstr(self.doc.item_code))
def update_bin(self): def update_bin(self):
# update bin # update bin
@ -80,21 +80,15 @@ class DocType:
# Update Stock UOM # Update Stock UOM
def update_stock_uom(self): def update_stock_uom(self):
# validate mandatory
self.validate_mandatory() self.validate_mandatory()
self.validate_uom_integer_type() self.validate_uom_integer_type()
# update item master
self.update_item_master() self.update_item_master()
# update stock ledger entry
self.update_stock_ledger_entry() self.update_stock_ledger_entry()
# update bin
self.update_bin() self.update_bin()
get_obj("Item", self.doc.item_code).on_update()
def validate_uom_integer_type(self): def validate_uom_integer_type(self):
current_is_integer = webnotes.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number") current_is_integer = webnotes.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number")
new_is_integer = webnotes.conn.get_value("UOM", self.doc.new_stock_uom, "must_be_whole_number") new_is_integer = webnotes.conn.get_value("UOM", self.doc.new_stock_uom, "must_be_whole_number")

View File

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

View File

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

View File

@ -11,7 +11,7 @@ from website.helpers.cart import _get_cart_quotation
@webnotes.whitelist(allow_guest=True) @webnotes.whitelist(allow_guest=True)
def get_product_info(item_code): def get_product_info(item_code):
"""get product price / stock info""" """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 {} return {}
cart_quotation = _get_cart_quotation() cart_quotation = _get_cart_quotation()