Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pdvyas committed May 26, 2015
2 parents 1a804e2 + e1637c4 commit dcbc4d1
Show file tree
Hide file tree
Showing 36 changed files with 355 additions and 229 deletions.
2 changes: 1 addition & 1 deletion erpnext/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '5.0.9'
__version__ = '5.0.10'
6 changes: 3 additions & 3 deletions erpnext/accounts/doctype/journal_entry/journal_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def validate_party(self):
account_type = frappe.db.get_value("Account", d.account, "account_type")
if account_type in ["Receivable", "Payable"]:
if not (d.party_type and d.party):
frappe.throw(_("Row{0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account))
frappe.throw(_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account))
elif d.party_type and d.party:
frappe.throw(_("Row{0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx))
frappe.throw(_("Row {0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx))

def check_credit_limit(self):
customers = list(set([d.party for d in self.get("accounts") if d.party_type=="Customer" and flt(d.debit) > 0]))
Expand Down Expand Up @@ -438,7 +438,7 @@ def validate_credit_debit_note(self):
if self.stock_entry:
if frappe.db.get_value("Stock Entry", self.stock_entry, "docstatus") != 1:
frappe.throw(_("Stock Entry {0} is not submitted").format(self.stock_entry))

if frappe.db.exists({"doctype": "Journal Entry", "stock_entry": self.stock_entry, "docstatus":1}):
frappe.msgprint(_("Warning: Another {0} # {1} exists against stock entry {2}".format(self.voucher_type, self.name, self.stock_entry)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
from frappe import _
from frappe.utils import flt

def execute(filters=None):
Expand All @@ -23,7 +23,7 @@ def execute(filters=None):
purchase_receipt = d.purchase_receipt
elif d.po_detail:
purchase_receipt = ", ".join(frappe.db.sql_list("""select distinct parent
from `tabPurchase Receipt Item` where docstatus=1 and po_detail=%s""", d.po_detail))
from `tabPurchase Receipt Item` where docstatus=1 and prevdoc_detail_docname=%s""", d.po_detail))

expense_account = d.expense_account or aii_account_map.get(d.company)
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
return invoice_expense_map, invoice_tax_map

def get_invoice_po_pr_map(invoice_list):
pi_items = frappe.db.sql("""select parent, purchase_order, purchase_receipt, po_detail
pi_items = frappe.db.sql("""select parent, purchase_order, purchase_receipt, po_detail,
project_name from `tabPurchase Invoice Item` where parent in (%s)
and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
Expand All @@ -160,7 +160,7 @@ def get_invoice_po_pr_map(invoice_list):
pr_list = [d.purchase_receipt]
elif d.po_detail:
pr_list = frappe.db.sql_list("""select distinct parent from `tabPurchase Receipt Item`
where docstatus=1 and po_detail=%s""", d.pr_detail)
where docstatus=1 and prevdoc_detail_docname=%s""", d.po_detail)

if pr_list:
invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault("purchase_receipt", pr_list)
Expand Down
8 changes: 8 additions & 0 deletions erpnext/config/manufacturing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ def get_data():
"name": "BOM Replace Tool",
"description": _("Replace Item / BOM in all BOMs"),
},
{
"type": "page",
"name": "bom-browser",
"icon": "icon-sitemap",
"label": _("BOM Browser"),
"description": _("Tree of Bill of Materials"),
"doctype": "BOM"
}
]
},
{
Expand Down
47 changes: 46 additions & 1 deletion erpnext/crm/doctype/newsletter/newsletter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
from frappe import throw, _
from frappe.model.document import Document
from frappe.email.bulk import check_bulk_limit
from frappe.utils.verified_command import get_signed_params, verify_request
import erpnext.tasks
from erpnext.crm.doctype.newsletter_list.newsletter_list import add_subscribers

class Newsletter(Document):
def onload(self):
Expand Down Expand Up @@ -87,7 +89,6 @@ def get_lead_options():

@frappe.whitelist(allow_guest=True)
def unsubscribe(email, name):
from frappe.utils.verified_command import verify_request
if not verify_request():
return

Expand Down Expand Up @@ -123,3 +124,47 @@ def create_lead(email_id):
"source": "Email"
})
lead.insert()


@frappe.whitelist(allow_guest=True)
def subscribe(email):
url = frappe.utils.get_url("/api/method/erpnext.crm.doctype.newsletter.newsletter.confirm_subscription") +\
"?" + get_signed_params({"email": email})

messages = (
_("Thank you for your interest in subscribing to our updates"),
_("Please verify your email id"),
url,
_("Click here to verify")
)

print url

content = """
<p>{0}. {1}.</p>
<p><a href="{2}">{3}</a></p>
"""

frappe.sendmail(email, subject=_("Confirm Your Email"), content=content.format(*messages), bulk=True)

@frappe.whitelist(allow_guest=True)
def confirm_subscription(email):
if not verify_request():
return

if not frappe.db.exists("Newsletter List", _("Website")):
frappe.get_doc({
"doctype": "Newsletter List",
"title": _("Website")
}).insert(ignore_permissions=True)


frappe.flags.ignore_permissions = True

add_subscribers(_("Website"), email)
frappe.db.commit()

frappe.respond_as_web_page(_("Confirmed"), _("{0} has been successfully added to our Newsletter list.").format(email))



4 changes: 2 additions & 2 deletions erpnext/crm/doctype/newsletter_list/newsletter_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import validate_email_add, strip
from frappe.utils import validate_email_add
from frappe import _
from email.utils import parseaddr

Expand Down Expand Up @@ -75,7 +75,7 @@ def add_subscribers(name, email_list):
"doctype": "Newsletter List Subscriber",
"newsletter_list": name,
"email": email
}).insert()
}).insert(ignore_permissions = frappe.flags.ignore_permissions)

count += 1
else:
Expand Down
6 changes: 3 additions & 3 deletions erpnext/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
app_icon = "icon-th"
app_color = "#e74c3c"
app_version = "5.0.9"
app_version = "5.0.10"

error_report_email = "support@erpnext.com"

Expand Down Expand Up @@ -96,8 +96,8 @@
]
}

default_mail_footer = """<div style="padding: 7px; margin-top: 7px;">
<a style="color: #8D99A6; font-size: 85%; text-decoration: none;" href="https://erpnext.com" target="_blank">
default_mail_footer = """<div style="padding: 15px; text-align: center;">
<a href="https://erpnext.com?source=via_email_footer" target="_blank" style="color: #8d99a6;">
Sent via ERPNext
</a>
</div>"""
Expand Down
45 changes: 27 additions & 18 deletions erpnext/manufacturing/doctype/bom/bom.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

// On REFRESH
frappe.provide("erpnext.bom");
cur_frm.cscript.refresh = function(doc,dt,dn){
cur_frm.toggle_enable("item", doc.__islocal);
toggle_operations(cur_frm);

if (!doc.__islocal && doc.docstatus<2) {
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost);
}
}

cur_frm.cscript.update_cost = function() {
return frappe.call({
doc: cur_frm.doc,
method: "update_cost",
freeze: true,
callback: function(r) {
if(!r.exc) cur_frm.refresh_fields();
frappe.ui.form.on("BOM", {
onload_post_render: function(frm) {
frm.get_field("items").grid.set_multiple_add("item_code", "qty");
},
refresh: function(frm) {
frm.toggle_enable("item", frm.doc.__islocal);
toggle_operations(frm);

if (!frm.doc.__islocal && frm.doc.docstatus<2) {
frm.add_custom_button(__("Update Cost"), function() {
frm.events.update_cost(frm);
});
frm.add_custom_button(__("Browse BOM"), function() {
frappe.set_route("bom-browser", frm.doc.name);
});
}
})
}
},
update_cost: function(frm) {
return frappe.call({
doc: frm.doc,
method: "update_cost",
freeze: true,
callback: function(r) {
if(!r.exc) frm.refresh_fields();
}
})
}
});

cur_frm.add_fetch("item", "description", "description");
cur_frm.add_fetch("item", "image", "image");
Expand Down
Empty file.
Empty file.
90 changes: 90 additions & 0 deletions erpnext/manufacturing/page/bom_browser/bom_browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

frappe.pages['bom-browser'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'BOM Browser',
single_column: true
});

page.main.css({
"min-height": "300px",
"padding-bottom": "25px"
});

page.tree_area = $('<div class="padding"><p class="text-muted">'+
__("Select BOM to start")
+'</p></div>').appendTo(page.main);

frappe.breadcrumbs.add(frappe.breadcrumbs.last_module || "Manufacturing");

var make_tree = function() {
erpnext.bom_tree = new erpnext.BOMTree(page.$bom_select.val(), page, page.tree_area);
}

page.$bom_select = wrapper.page.add_field({fieldname: "bom",
fieldtype:"Link", options: "BOM", label: __("BOM")}).$input
.change(function() {
make_tree();
});

page.set_secondary_action(__('Refresh'), function() {
make_tree();
});
}


frappe.pages['bom-browser'].on_page_show = function(wrapper){
// set from route
var bom = null;
if(frappe.get_route()[1]) {
var bom = frappe.get_route().splice(1).join("/");
}
if(frappe.route_options && frappe.route_options.bom) {
var bom = frappe.route_options.bom;
}
if(bom) {
wrapper.page.$bom_select.val(bom).trigger("change");
}
};

erpnext.BOMTree = Class.extend({
init: function(root, page, parent) {
$(parent).empty();
var me = this;
me.page = page;
me.bom = page.$bom_select.val();
me.can_read = frappe.model.can_read("BOM");
me.can_create = frappe.boot.user.can_create.indexOf("BOM") !== -1 ||
frappe.boot.user.in_create.indexOf("BOM") !== -1;
me.can_write = frappe.model.can_write("BOM");
me.can_delete = frappe.model.can_delete("BOM");

this.tree = new frappe.ui.Tree({
parent: $(parent),
label: me.bom,
args: {parent: me.bom},
method: 'erpnext.manufacturing.page.bom_browser.bom_browser.get_children',
toolbar: [
{toggle_btn: true},
{
label:__("Edit"),
condition: function(node) {
return node.expandable;
},
click: function(node) {
frappe.set_route("Form", "BOM", node.data.parent);
}
}
],
get_label: function(node) {
if(node.data.qty) {
return node.data.qty + " x " + node.data.value;
} else {
return node.data.value;
}
}
});
}
});
21 changes: 21 additions & 0 deletions erpnext/manufacturing/page/bom_browser/bom_browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"content": null,
"creation": "2015-05-25 02:57:33.472044",
"docstatus": 0,
"doctype": "Page",
"modified": "2015-05-25 02:57:33.472044",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "bom-browser",
"owner": "Administrator",
"page_name": "bom-browser",
"roles": [
{
"role": "Manufacturing User"
}
],
"script": null,
"standard": "Yes",
"style": null,
"title": "BOM Browser"
}
15 changes: 15 additions & 0 deletions erpnext/manufacturing/page/bom_browser/bom_browser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals
import frappe

@frappe.whitelist()
def get_children(parent):
return frappe.db.sql("""select item_code as value,
bom_no as parent, qty,
if(ifnull(bom_no, "")!="", 1, 0) as expandable
from `tabBOM Item`
where parent=%s
order by idx
""", parent, as_dict=True)
3 changes: 2 additions & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,5 @@ erpnext.patches.v5_0.repost_requested_qty
erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency
erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle
erpnext.patches.v5_0.rename_pos_setting
erpnext.patches.v5_0.update_operation_description
erpnext.patches.v5_0.update_operation_description
erpnext.patches.v5_0.set_footer_address
7 changes: 7 additions & 0 deletions erpnext/patches/v5_0/set_footer_address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import frappe

def execute():
frappe.reload_doctype("System Settings")
ss = frappe.get_doc("System Settings", "System Settings")
ss.email_footer_address = frappe.db.get_default("company")
ss.save()
6 changes: 4 additions & 2 deletions erpnext/patches/v5_0/update_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ def execute():
for m in frappe.get_all("Project Milestone", "*"):
if (m.milestone and m.milestone_date
and frappe.db.exists("Project", m.parent)):
frappe.get_doc({
task = frappe.get_doc({
"doctype": "Task",
"subject": m.milestone,
"expected_start_date": m.milestone_date,
"status": "Open" if m.status=="Pending" else "Closed",
"project": m.parent,
}).insert(ignore_permissions=True)
})
task.flags.ignore_mandatory = True
task.insert(ignore_permissions=True)

# remove project milestone
frappe.delete_doc("DocType", "Project Milestone")
Expand Down
Binary file removed erpnext/public/images/erpnext-fade.png
Binary file not shown.
Binary file added erpnext/public/images/erpnext-footer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dcbc4d1

Please sign in to comment.