[minor] merge master

This commit is contained in:
Rushabh Mehta 2013-08-14 18:41:42 +05:30
commit 170be3b717
14 changed files with 70 additions and 43 deletions

View File

@ -150,12 +150,22 @@ class DocType(SellingController):
def set_missing_values(self, for_validate=False):
self.set_pos_fields(for_validate)
if not self.doc.debit_to:
self.doc.debit_to = self.get_customer_account()
if not self.doc.due_date:
self.doc.due_date = self.get_due_date()
super(DocType, self).set_missing_values(for_validate)
def set_customer_defaults(self):
# TODO cleanup these methods
self.doc.fields.update(self.get_debit_to())
self.get_cust_and_due_date()
if self.doc.customer:
self.doc.debit_to = self.get_customer_account()
elif self.doc.debit_to:
self.doc.customer = webnotes.conn.get_value('Account', self.doc.debit_to, 'master_name')
self.doc.due_date = self.get_due_date()
super(DocType, self).set_customer_defaults()
@ -231,16 +241,9 @@ class DocType(SellingController):
You must first create it from the Customer Master" %
(self.doc.customer, self.doc.company))
def get_debit_to(self):
acc_head = self.get_customer_account()
return acc_head and {'debit_to' : acc_head} or {}
def get_cust_and_due_date(self):
def get_due_date(self):
"""Set Due Date = Posting Date + Credit Days"""
if self.doc.debit_to:
self.doc.customer = webnotes.conn.get_value('Account', self.doc.debit_to, 'master_name')
due_date = None
if self.doc.posting_date:
credit_days = 0
if self.doc.debit_to:
@ -251,9 +254,11 @@ class DocType(SellingController):
credit_days = webnotes.conn.get_value("Company", self.doc.company, "credit_days")
if credit_days:
self.doc.due_date = add_days(self.doc.posting_date, credit_days)
due_date = add_days(self.doc.posting_date, credit_days)
else:
self.doc.due_date = self.doc.posting_date
due_date = self.doc.posting_date
return due_date
def get_barcode_details(self, barcode):
return get_obj('Sales Common').get_barcode_details(barcode)

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-27 16:30:52",
"docstatus": 0,
"modified": "2013-07-11 14:41:59",
"modified": "2013-08-14 12:47:45",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -19,14 +19,18 @@
"name": "__common__",
"parent": "Financial Statements",
"parentfield": "roles",
"parenttype": "Page",
"role": "Accounts Manager"
"parenttype": "Page"
},
{
"doctype": "Page",
"name": "Financial Statements"
},
{
"doctype": "Page Role"
"doctype": "Page Role",
"role": "Accounts Manager"
},
{
"doctype": "Page Role",
"role": "Analytics"
}
]

View File

@ -389,7 +389,8 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
grid: { hoverable: true, clickable: true },
xaxis: { mode: "time",
min: dateutil.str_to_obj(this.from_date).getTime(),
max: dateutil.str_to_obj(this.to_date).getTime() }
max: dateutil.str_to_obj(this.to_date).getTime() },
series: { downsample: { threshold: 1000 } }
}
},
});

View File

@ -16,11 +16,14 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(doc.__islocal) {
var last_route = wn.route_history.slice(-2, -1)[0];
if(last_route && last_route[0]==="Form") {
var doctype = last_route[1],
docname = last_route.slice(2).join("/");
if(["Customer", "Quotation", "Sales Order", "Sales Invoice", "Delivery Note",
"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
"Maintenance Schedule"]
.indexOf(last_route[1])!==-1) {
var refdoc = wn.model.get_doc(last_route[1], last_route[2]);
.indexOf(doctype)!==-1) {
var refdoc = wn.model.get_doc(doctype, docname);
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Customer" : true) {
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
@ -30,16 +33,16 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
}
if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
.indexOf(last_route[1])!==-1) {
var refdoc = wn.model.get_doc(last_route[1], last_route[2]);
.indexOf(doctype)!==-1) {
var refdoc = wn.model.get_doc(doctype, docname);
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
cur_frm.set_value("supplier_name", refdoc.supplier_name);
if(cur_frm.doc.doctype==="Address")
cur_frm.set_value("address_title", cur_frm.doc.supplier_name);
}
if(["Lead", "Quotation"]
.indexOf(last_route[1])!==-1) {
var refdoc = wn.model.get_doc(last_route[1], last_route[2]);
.indexOf(doctype)!==-1) {
var refdoc = wn.model.get_doc(doctype, docname);
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Lead" : true) {
cur_frm.set_value("lead", refdoc.lead || refdoc.name);

View File

@ -207,4 +207,4 @@ def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len,
"fcond": get_filters_cond(doctype, filters, []),
"mcond": get_match_cond(doctype),
"start": "%(start)s", "page_len": "%(page_len)s", "txt": "%(txt)s"
}, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) }, debug=True)
}, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) })

View File

@ -14,12 +14,8 @@ class SellingController(StockController):
def onload_post_render(self):
# contact, address, item details and pos details (if applicable)
self.set_missing_values()
self.set_taxes("other_charges", "charge")
if self.meta.get_field("debit_to") and not self.doc.debit_to:
self.doc.debit_to = self.get_debit_to().get("debit_to")
def set_missing_values(self, for_validate=False):
super(SellingController, self).set_missing_values(for_validate)

View File

@ -156,20 +156,23 @@ class DocType:
raise_exception=InvalidLeaveApproverError)
def update_dob_event(self):
if self.doc.date_of_birth:
get_events = webnotes.conn.sql("""select name from `tabEvent` where repeat_on='Every Year'
if self.doc.status == "Active" and self.doc.date_of_birth:
birthday_event = webnotes.conn.sql("""select name from `tabEvent` where repeat_on='Every Year'
and ref_type='Employee' and ref_name=%s""", self.doc.name)
starts_on = self.doc.date_of_birth + " 00:00:00"
ends_on = self.doc.date_of_birth + " 00:15:00"
if get_events:
webnotes.conn.sql("""update `tabEvent` set starts_on=%s, ends_on=%s
where name=%s""", (starts_on, ends_on, get_events[0][0]))
if birthday_event:
event = webnotes.bean("Event", birthday_event[0][0])
event.doc.starts_on = starts_on
event.doc.ends_on = ends_on
event.save()
else:
webnotes.bean({
"doctype": "Event",
"subject": _("Birthday") + ": " + self.doc.employee_name,
"description": _("Happy Birthday!") + " " + self.doc.employee_name,
"starts_on": starts_on,
"ends_on": ends_on,
"event_type": "Public",

View File

@ -59,7 +59,7 @@ def validate_install():
return is_redhat, is_debian
def install_using_yum():
packages = "python python-setuptools MySQL-python httpd git memcached ntp vim-enhanced screen"
packages = "python python-setuptools gcc python-devel MySQL-python httpd git memcached ntp vim-enhanced screen"
print "-"*80
print "Installing Packages: (This may take some time)"
@ -108,7 +108,7 @@ def update_config_for_redhat():
def install_using_apt():
exec_in_shell("apt-get update")
packages = "python python-setuptools python-mysqldb apache2 git memcached ntp vim screen htop"
packages = "python python-setuptools python-dev build-essential python-pip python-mysqldb apache2 git memcached ntp vim screen htop"
print "-"*80
print "Installing Packages: (This may take some time)"
print packages
@ -145,7 +145,11 @@ def install_python_modules():
print python_modules
print "-"*80
exec_in_shell("easy_install pip")
if not exec_in_shell("which pip"):
exec_in_shell("easy_install pip")
exec_in_shell("pip install --upgrade pip")
exec_in_shell("pip install --upgrade virtualenv")
exec_in_shell("pip install -q %s" % python_modules)
def install_erpnext(install_path):

View File

@ -148,6 +148,7 @@ def make_stock_entry(production_order_id, purpose):
stock_entry.doc.production_order = production_order_id
stock_entry.doc.company = production_order.doc.company
stock_entry.doc.bom_no = production_order.doc.bom_no
stock_entry.doc.use_multi_level_bom = production_order.doc.use_multi_level_bom
stock_entry.doc.fg_completed_qty = flt(production_order.doc.qty) - flt(production_order.doc.produced_qty)
if purpose=="Material Transfer":
@ -155,5 +156,5 @@ def make_stock_entry(production_order_id, purpose):
else:
stock_entry.doc.from_warehouse = production_order.doc.wip_warehouse
stock_entry.doc.to_warehouse = production_order.doc.fg_warehouse
return [d.fields for d in stock_entry.doclist]

View File

@ -5,7 +5,9 @@ from __future__ import unicode_literals
import webnotes
def execute():
for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where ifnull(date_of_birth, '')!=''"""):
obj = webnotes.get_obj("Employee", employee)
obj.update_dob_event()
webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and
ifnull(date_of_birth, '')!=''"""):
obj = webnotes.get_obj("Employee", employee)
obj.update_dob_event()

View File

@ -253,6 +253,6 @@ patch_list = [
"patches.august_2013.p01_hr_settings",
"patches.august_2013.p02_rename_price_list",
"patches.august_2013.p03_pos_setting_replace_customer_account",
"patches.august_2013.p04_employee_birthdays",
"patches.august_2013.p05_update_serial_no_status",
"patches.august_2013.p05_employee_birthdays",
]

View File

@ -69,12 +69,18 @@ def get_item_details(args):
if cint(args.is_pos):
pos_settings = get_pos_settings(args.company)
<<<<<<< HEAD
out.update(apply_pos_settings(pos_settings, out))
if args.doctype in ("Sales Invoice", "Delivery Note"):
if item_bean.doc.has_serial_no and not args.serial_no:
out.serial_no = _get_serial_nos_by_fifo(args, item_bean)
=======
if pos_settings:
out.update(apply_pos_settings(pos_settings, out))
>>>>>>> 3d1ecf5254c5887a48c04003c7dce8a218136ddd
return out
def _get_serial_nos_by_fifo(args, item_bean):

View File

@ -176,7 +176,8 @@ erpnext.StockAgeing = erpnext.StockGridReport.extend({
xaxis: {
ticks: $.map(me.data, function(item, idx) { return [[idx+1, item.name]] }),
max: 20
}
},
series: { downsample: { threshold: 1000 } }
}
}
});

View File

@ -235,6 +235,7 @@ erpnext.StockLedger = erpnext.StockGridReport.extend({
min: dateutil.str_to_obj(this.from_date).getTime(),
max: dateutil.str_to_obj(this.to_date).getTime(),
},
series: { downsample: { threshold: 1000 } }
}
},
get_tooltip_text: function(label, x, y) {