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

This commit is contained in:
Nabin Hait 2014-03-13 17:23:24 +05:30
commit a8dbb0dd41
162 changed files with 536 additions and 387 deletions

View File

@ -12,10 +12,10 @@ install:
script:
cd ./test_sites/ &&
frappe --reinstall -v test_site &&
frappe --install_app erpnext -v test_site &&
frappe --reinstall test_site &&
frappe --install_app erpnext test_site &&
frappe --request '?cmd=erpnext.setup.page.setup_wizard.setup_wizard.setup_account&currency=USD&first_name=Test&last_name=User&company_name=Wind+Power+LLC&timezone=America/New_York&company_abbr=WP&industry=Manufacturing&country=United states&fy_start_date=2014-01-01&fy_end_date=2014-12-31' test_site &&
frappe --run_tests -v test_site --app erpnext
frappe --run_tests test_site --app erpnext
before_script:
- mysql -e 'create database travis' &&

View File

@ -30,7 +30,6 @@ ERPNext is built on [frappe](https://github.com/frappe/frappe)
1. Install pip: `sudo easy_install pip`
1. Create a `bench` directory
1. Clone `frappe` in the `bench` : `git clone https://github.com/frappe/frappe`
1. Install python libraries `sudo pip install webnotes/requirements.txt`
1. Clone `erpnext` in the `bench`: `git clone https://github.com/frappe/erpnext.git`
1. Clone `shopping-cart` in the `bench`: `git clone https://github.com/frappe/shopping-cart.git`
1. Install the packages: `pip install -e frappe/ erpnext/ shopping-cart/`

View File

@ -153,7 +153,7 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
"dt":filters["dt"],
"acc":filters["acc"],
"account_type": filters['account_type'],
'mcond':get_match_cond(doctype, searchfield),
'mcond':get_match_cond(doctype),
'txt': "%%%s%%" % txt,
"start": start,
"page_len": page_len

View File

@ -74,5 +74,5 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
return{ query:"frappe.core.doctype.profile.profile.profile_query"}
return{ query:"frappe.core.doctype.user.user.user_query"}
}

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"modified": "2014-01-29 13:08:24",
"modified": "2014-01-29 13:08:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -48,7 +48,7 @@
"label": "User",
"oldfieldname": "user",
"oldfieldtype": "Link",
"options": "Profile",
"options": "User",
"read_only": 0
},
{

View File

@ -6,8 +6,9 @@
from __future__ import unicode_literals
import frappe
from frappe import throw, _
from frappe.model.controller import DocListController
class DocType:
class DocType(DocListController):
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
@ -23,15 +24,15 @@ class DocType:
frappe.MandatoryError)
def cleanup_fields_value(self):
fields = ["item_code", "item_group", "brand", "customer", "customer_group",
"territory", "supplier", "supplier_type", "campaign", "sales_partner",
"price", "discount_percentage"]
for logic_field in ["apply_on", "applicable_for", "price_or_discount"]:
fieldname = frappe.scrub(self.doc.fields.get(logic_field) or "")
for field_with_value in ["apply_on", "applicable_for", "price_or_discount"]:
val = self.doc.fields.get(field_with_value)
if val:
fields.remove(frappe.scrub(val))
for field in fields:
self.doc.fields[field] = None
# reset all values except for the logic field
options = (self.meta.get_options(logic_field) or "").split("\n")
for f in options:
if not f: continue
f = frappe.scrub(f)
if f!=fieldname:
self.doc.fields[f] = None

View File

@ -2,7 +2,7 @@
{
"creation": "2014-02-21 15:02:51",
"docstatus": 0,
"modified": "2014-02-28 14:49:15",
"modified": "2014-03-05 18:23:34",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"autoname": "PRULE.#####",
"doctype": "DocType",
"document_type": "Master",
"icon": "icon-gift",
"istable": 0,
"module": "Accounts",
"name": "__common__"

View File

@ -442,4 +442,4 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
and tabAccount.company = '%(company)s'
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})

View File

@ -19,7 +19,7 @@ erpnext.POS = Class.extend({
<table class="table table-condensed table-hover" id="cart" style="table-layout: fixed;">\
<thead>\
<tr>\
<th style="width: 40%">Item</th>\
<th style="width: 40%">'+__("Item")+'</th>\
<th style="width: 9%"></th>\
<th style="width: 17%; text-align: right;">Qty</th>\
<th style="width: 9%"></th>\
@ -35,7 +35,7 @@ erpnext.POS = Class.extend({
<div class="net-total-area">\
<table class="table table-condensed">\
<tr>\
<td><b>Net Total</b></td>\
<td><b>'+__("Net Total")+'</b></td>\
<td style="text-align: right;" class="net-total"></td>\
</tr>\
</table>\
@ -44,7 +44,7 @@ erpnext.POS = Class.extend({
<table class="table table-condensed">\
<thead>\
<tr>\
<th style="width: 60%">Taxes</th>\
<th style="width: 60%">'+__("Taxes")+'</th>\
<th style="width: 40%; text-align: right;"></th>\
</tr>\
</thead>\
@ -55,7 +55,7 @@ erpnext.POS = Class.extend({
<div class="discount-amount-area">\
<table class="table table-condensed">\
<tr>\
<td style="vertical-align: middle;" width="50%"><b>Discount Amount</b></td>\
<td style="vertical-align: middle;" width="50%"><b>'+__("Discount Amount")+'</b></td>\
<td width="20%"></td>\
<td style="text-align: right;">\
<input type="text" class="form-control discount-amount" \
@ -67,23 +67,32 @@ erpnext.POS = Class.extend({
<div class="grand-total-area">\
<table class="table table-condensed">\
<tr>\
<td style="vertical-align: middle;"><b>Grand Total</b></td>\
<td style="vertical-align: middle;"><b>'+__("Grand Total")+'</b></td>\
<td style="text-align: right; font-size: 200%; \
font-size: bold;" class="grand-total"></td>\
</tr>\
</table>\
</div>\
<div class="paid-amount-area">\
<table class="table table-condensed">\
<tr>\
<td style="vertical-align: middle;">'+__("Amount Paid")+'</td>\
<td style="text-align: right; \
font-size: bold;" class="paid-amount"></td>\
</tr>\
</table>\
</div>\
</div>\
</div>\
<br><br>\
<div class="row">\
<div class="col-sm-9">\
<button class="btn btn-success btn-lg make-payment">\
<i class="icon-money"></i> Make Payment</button>\
<i class="icon-money"></i> '+__("Make Payment")+'</button>\
</div>\
<div class="col-sm-3">\
<button class="btn btn-default btn-lg remove-items" style="display: none;">\
<i class="icon-trash"></i> Del</button>\
<i class="icon-trash"></i> '+__("Del")+'</button>\
</div>\
</div>\
<br><br>\
@ -439,6 +448,12 @@ erpnext.POS = Class.extend({
me.frm.doc.currency));
this.wrapper.find(".grand-total").text(format_currency(this.frm.doc[this.grand_total],
me.frm.doc.currency));
$(".paid-amount-area").toggle(!!this.frm.doc.paid_amount);
if(this.frm.doc.paid_amount) {
this.wrapper.find(".paid-amount").text(format_currency(this.frm.doc.paid_amount,
me.frm.doc.currency));
}
},
call_when_local: function() {
var me = this;
@ -484,25 +499,16 @@ erpnext.POS = Class.extend({
disable_text_box_and_button: function() {
var me = this;
// if form is submitted & cancelled then disable all input box & buttons
if (this.frm.doc.docstatus>=1) {
$(this.wrapper).find('input, button').each(function () {
$(this).prop('disabled', true);
});
$(this.wrapper).find(".remove-items").hide();
$(this.wrapper).find(".make-payment").hide();
}
else {
$(this.wrapper).find('input, button').each(function () {
$(this).prop('disabled', false);
});
$(this.wrapper).find(".make-payment").show();
}
$(this.wrapper)
.find(".remove-items, .make-payment, .increase-qty, .decrease-qty")
.toggle(this.frm.doc.docstatus===0);
$(this.wrapper).find('input, button').prop("disabled", !(this.frm.doc.docstatus===0));
},
hide_payment_button: function() {
var me = this;
// Show Make Payment button only in Sales Invoice
if (this.frm.doctype != "Sales Invoice")
$(this.wrapper).find(".make-payment").hide();
$(this.wrapper)
.find(".make-payment")
.toggle(this.frm.doctype == "Sales Invoice" && this.frm.doc.is_pos);
},
refresh_delete_btn: function() {
$(this.wrapper).find(".remove-items").toggle($(".item-cart .warning").length ? true : false);
@ -568,6 +574,9 @@ erpnext.POS = Class.extend({
frappe.call({
method: 'erpnext.accounts.doctype.sales_invoice.pos.get_mode_of_payment',
callback: function(r) {
if(!r.message.length) {
msgprint(__("Please add to Modes of Payment from Setup."))
}
for (x=0; x<=r.message.length - 1; x++) {
mode_of_payment.push(r.message[x].name);
}

View File

@ -49,4 +49,4 @@ def get_item_code(barcode_serial_no):
@frappe.whitelist()
def get_mode_of_payment():
return frappe.db.sql("""select name from `tabMode of Payment`""", as_dict=1)
return frappe.get_list("Mode of Payment")

View File

@ -184,8 +184,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
this.frm.set_value("write_off_amount",
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount), precision("write_off_amount"));
}
this.frm.script_manager.trigger("write_off_amount");
},
write_off_amount: function() {

View File

@ -744,9 +744,9 @@ def send_notification(new_rv):
message = get_html(new_rv.doc, new_rv.doclist, "SalesInvoice"))
def notify_errors(inv, customer, owner):
from frappe.profile import get_system_managers
from frappe.utils.user import get_system_managers
frappe.sendmail(recipients=get_system_managers() + [frappe.db.get_value("Profile", owner, "email")],
frappe.sendmail(recipients=get_system_managers() + [frappe.db.get_value("User", owner, "email")],
subject="[Urgent] Error while creating recurring invoice for %s" % inv,
message = frappe.get_template("template/emails/recurring_invoice_failed.html").render({
"name": inv,
@ -793,7 +793,7 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
and tabAccount.company = '%(company)s'
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
@frappe.whitelist()

View File

@ -42,7 +42,7 @@ pscript['onload_Accounts Browser'] = function(wrapper){
'</ol>'+
'<p>'+frappe._('Please setup your chart of accounts before you start Accounting Entries')+'</p></div>').appendTo(main);
if (frappe.boot.profile.can_create.indexOf("Company") !== -1) {
if (frappe.boot.user.can_create.indexOf("Company") !== -1) {
wrapper.appframe.add_button(frappe._('New Company'), function() { newdoc('Company'); },
'icon-plus');
}
@ -137,7 +137,7 @@ erpnext.AccountsChart = Class.extend({
{
condition: function(node) {
return !node.root && me.ctype === 'Account'
&& frappe.boot.profile.can_read.indexOf("GL Entry") !== -1
&& frappe.boot.user.can_read.indexOf("GL Entry") !== -1
},
label: __("View Ledger"),
click: function(node, btn) {

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-22 16:16:03",
"docstatus": 0,
"modified": "2013-04-30 17:55:54",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Purchase Invoice",
"report_name": "Accounts Payable",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-16 11:31:13",
"docstatus": 0,
"modified": "2013-05-24 12:02:52",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Sales Invoice",
"report_name": "Accounts Receivable",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-05-01 12:13:25",
"docstatus": 0,
"modified": "2013-05-01 12:13:25",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Journal Voucher",
"report_name": "Bank Clearance Summary",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-30 18:30:21",
"docstatus": 0,
"modified": "2013-05-01 10:53:12",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 0,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Journal Voucher",
"report_name": "Bank Reconciliation Statement",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-18 12:56:36",
"docstatus": 0,
"modified": "2013-06-18 12:56:36",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Cost Center",
"report_name": "Budget Variance Report",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-03 16:17:34",
"docstatus": 0,
"modified": "2013-06-03 16:17:34",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Account",
"report_name": "Customer Account Head",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-07-30 17:28:49",
"docstatus": 0,
"modified": "2014-02-11 12:40:04",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project_name` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`base_amount` - ifnull((select sum(base_amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` != \"Stopped\" and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc",
"ref_doctype": "Sales Invoice",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-12-06 13:22:23",
"docstatus": 0,
"modified": "2013-12-06 13:22:23",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "GL Entry",
"report_name": "General Ledger",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-02-25 17:03:34",
"docstatus": 0,
"modified": "2013-02-25 17:03:34",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Sales Invoice",
"report_name": "Gross Profit",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-05 15:37:30",
"docstatus": 0,
"modified": "2013-06-05 15:37:30",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Purchase Invoice",
"report_name": "Item-wise Purchase Register",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-13 17:50:55",
"docstatus": 0,
"modified": "2013-05-13 17:50:55",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Sales Invoice",
"report_name": "Item-wise Sales Register",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-02-21 14:26:44",
"docstatus": 0,
"modified": "2014-02-11 15:53:01",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc",
"ref_doctype": "Sales Invoice",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-12-02 17:06:37",
"docstatus": 0,
"modified": "2013-12-02 17:06:39",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Journal Voucher",
"report_name": "Payment Period Based On Invoice Date",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-13 18:46:55",
"docstatus": 0,
"modified": "2013-06-13 18:46:55",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Invoice Trends",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-28 15:54:16",
"docstatus": 0,
"modified": "2014-02-11 13:01:05",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t`tabPurchase Order Item`.billed_amt as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - ifnull(`tabPurchase Order Item`.billed_amt, 0)) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.billed_amt, 0) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc",
"ref_doctype": "Purchase Invoice",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-29 16:13:11",
"docstatus": 0,
"modified": "2013-04-30 17:51:19",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Register",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-07-30 18:35:10",
"docstatus": 0,
"modified": "2014-02-11 11:46:57",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project_name` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n\t `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`base_amount` - ifnull((select sum(base_amount) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and\n\t`tabPurchase Receipt`.`status` != \"Stopped\" and\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc",
"ref_doctype": "Purchase Invoice",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-13 18:44:21",
"docstatus": 0,
"modified": "2013-06-13 18:44:21",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Sales Invoice",
"report_name": "Sales Invoice Trends",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-05-06 12:28:23",
"docstatus": 0,
"modified": "2013-05-06 12:41:15",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"",
"ref_doctype": "Sales Invoice",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-23 18:15:29",
"docstatus": 0,
"modified": "2013-04-30 17:53:10",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Sales Invoice",
"report_name": "Sales Register",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-04 12:56:17",
"docstatus": 0,
"modified": "2013-06-04 12:56:46",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Accounts",
"name": "__common__",
"ref_doctype": "Account",
"report_name": "Supplier Account Head",

View File

@ -40,7 +40,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
from frappe.widgets.reportview import get_match_cond
filters.update({
"txt": txt,
"mcond": get_match_cond(filters["from"], searchfield),
"mcond": get_match_cond(filters["from"]),
"start": start,
"page_len": page_len
})

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-03 14:55:53",
"docstatus": 0,
"modified": "2013-07-11 12:28:00",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Buying",
"name": "__common__",
"query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item\nwhere\n\tpo.name = po_item.parent and po.docstatus = 1\norder by po.name desc",
"ref_doctype": "Purchase Order",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-13 18:45:01",
"docstatus": 0,
"modified": "2013-06-13 18:45:01",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Buying",
"name": "__common__",
"ref_doctype": "Purchase Order",
"report_name": "Purchase Order Trends",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-13 16:10:02",
"docstatus": 0,
"modified": "2014-01-24 18:19:11",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Buying",
"name": "__common__",
"query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc",
"ref_doctype": "Purchase Order",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-10-09 10:38:40",
"docstatus": 0,
"modified": "2013-10-09 10:53:52",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Buying",
"name": "__common__",
"query": "SELECT\n `tabSupplier`.name as \"Supplier:Link/Supplier:120\",\n\t`tabSupplier`.supplier_name as \"Supplier Name::120\",\n\t`tabSupplier`.supplier_type as \"Supplier Type:Link/Supplier Type:120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n concat_ws(', ', `tabContact`.first_name, `tabContact`.last_name) as 'Contact Name::180',\n\t`tabContact`.phone as \"Phone\",\n\t`tabContact`.mobile_no as \"Mobile No\",\n\t`tabContact`.email_id as \"Email Id::120\",\n\t`tabContact`.is_primary_contact as \"Is Primary Contact::120\"\nFROM\n\t`tabSupplier`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.supplier=`tabSupplier`.name\n\t)\n\tleft join `tabContact` on (\n\t\t`tabContact`.supplier=`tabSupplier`.name\n\t)\nWHERE\n\t`tabSupplier`.docstatus<2\nORDER BY\n\t`tabSupplier`.name asc",
"ref_doctype": "Supplier",

View File

@ -103,9 +103,14 @@ data = [
},
{
"type": "doctype",
"name": "Shipping Rules",
"name": "Shipping Rule",
"description": _("Rules for adding shipping costs.")
},
{
"type": "doctype",
"name": "Pricing Rule",
"description": _("Rules for applying pricing and discount.")
},
{
"type": "doctype",
"name": "Currency",

View File

@ -87,6 +87,11 @@ data = [
"description": _("Multiple Item prices."),
"route": "Report/Item Price"
},
{
"type": "doctype",
"name": "Pricing Rule",
"description": _("Rules for applying pricing and discount.")
},
]
},
{

View File

@ -121,7 +121,7 @@ data = [
},
{
"type": "doctype",
"name": "Shipping Rules",
"name": "Shipping Rule",
"description": _("Rules for adding shipping costs.")
},
{
@ -135,6 +135,11 @@ data = [
"description": _("Multiple Item prices."),
"route": "Report/Item Price"
},
{
"type": "doctype",
"name": "Pricing Rule",
"description": _("Rules for applying pricing and discount.")
},
{
"type": "doctype",
"name": "Sales BOM",

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.widgets.reportview import get_match_cond
from frappe.model.db_query import DatabaseQuery
def get_filters_cond(doctype, filters, conditions):
if filters:
@ -16,9 +17,12 @@ def get_filters_cond(doctype, filters, conditions):
else:
flt.append([doctype, f[0], '=', f[1]])
from frappe.widgets.reportview import build_filter_conditions
build_filter_conditions(flt, conditions)
cond = ' and ' + ' and '.join(conditions)
query = DatabaseQuery(doctype)
query.filters = flt
query.conditions = conditions
query.build_filter_conditions()
cond = ' and ' + ' and '.join(query.conditions)
else:
cond = ''
return cond
@ -36,7 +40,7 @@ def employee_query(doctype, txt, searchfield, start, page_len, filters):
case when employee_name like "%(txt)s" then 0 else 1 end,
name
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len})
# searches for leads which are not converted
def lead_query(doctype, txt, searchfield, start, page_len, filters):
@ -53,7 +57,7 @@ def lead_query(doctype, txt, searchfield, start, page_len, filters):
case when company_name like "%(txt)s" then 0 else 1 end,
lead_name asc
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len})
# searches for customer
def customer_query(doctype, txt, searchfield, start, page_len, filters):
@ -76,7 +80,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
case when customer_name like "%(txt)s" then 0 else 1 end,
name, customer_name
limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
'start': start, 'page_len': page_len})
# searches for supplier
@ -98,7 +102,7 @@ def supplier_query(doctype, txt, searchfield, start, page_len, filters):
case when supplier_name like "%(txt)s" then 0 else 1 end,
name, supplier_name
limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype), 'start': start,
'page_len': page_len})
def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
@ -134,7 +138,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
{fcond} {mcond}
limit %(start)s, %(page_len)s """.format(key=searchfield,
fcond=get_filters_cond(doctype, filters, conditions),
mcond=get_match_cond(doctype, searchfield)),
mcond=get_match_cond(doctype)),
{
"today": nowdate(),
"txt": "%%%s%%" % txt,
@ -153,7 +157,7 @@ def bom(doctype, txt, searchfield, start, page_len, filters):
%(fcond)s %(mcond)s
limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
'fcond': get_filters_cond(doctype, filters, conditions),
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len})
def get_project_name(doctype, txt, searchfield, start, page_len, filters):
cond = ''
@ -165,7 +169,7 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s
order by `tabProject`.name asc
limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype),'start': start, 'page_len': page_len})
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
@ -202,7 +206,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
order by batch_no desc
limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'],
'warehouse': filters['warehouse'], 'posting_date': filters['posting_date'],
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
'start': start, 'page_len': page_len})
else:
return frappe.db.sql("""select name from tabBatch
@ -214,5 +218,5 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
order by name desc
limit %(start)s, %(page_len)s""" % {'item_code': filters['item_code'],
'posting_date': filters['posting_date'], 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield),'start': start,
'mcond':get_match_cond(doctype),'start': start,
'page_len': page_len})

View File

@ -23,7 +23,7 @@ frappe.pages['activity'].onload = function(wrapper) {
wrapper.appframe.set_title_right("Refresh", function() { list.run(); });
// Build Report Button
if(frappe.boot.profile.can_get_report.indexOf("Feed")!=-1) {
if(frappe.boot.user.can_get_report.indexOf("Feed")!=-1) {
wrapper.appframe.add_primary_action(frappe._('Build Report'), function() {
frappe.set_route('Report', "Feed");
}, 'icon-th')

View File

@ -29,10 +29,6 @@ bean_event:*:on_update = erpnext.home.update_feed
bean_event:*:on_submit = erpnext.home.update_feed
bean_event:Comment:on_update = erpnext.home.make_comment_feed
bean_event:*:on_update = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
bean_event:*:on_cancel = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
bean_event:*:on_trash = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
bean_event:Stock Entry:on_submit = erpnext.stock.doctype.material_request.material_request.update_completed_qty
bean_event:Stock Entry:on_cancel = erpnext.stock.doctype.material_request.material_request.update_completed_qty
@ -43,18 +39,18 @@ standard_queries = Customer:erpnext.selling.doctype.customer.customer.get_custom
#### Frequently
scheduler_event = all:erpnext.support.doctype.support_ticket.get_support_mails.get_support_mails
scheduler_event = all:erpnext.hr.doctype.job_applicant.get_job_applications.get_job_applications
scheduler_event = all:erpnext.selling.doctype.lead.get_leads.get_leads
scheduler_event:all = erpnext.support.doctype.support_ticket.get_support_mails.get_support_mails
scheduler_event:all = erpnext.hr.doctype.job_applicant.get_job_applications.get_job_applications
scheduler_event:all = erpnext.selling.doctype.lead.get_leads.get_leads
#### Daily
scheduler_event = daily:erpnext.accounts.doctype.sales_invoice.sales_invoice.manage_recurring_invoices
scheduler_event = daily:erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily
scheduler_event = daily:erpnext.stock.utils.reorder_item
scheduler_event = daily:erpnext.setup.doctype.email_digest.email_digest.send
scheduler_event = daily:support.doctype.support_ticket.support_ticket.auto_close_tickets
scheduler_event:daily = erpnext.accounts.doctype.sales_invoice.sales_invoice.manage_recurring_invoices
scheduler_event:daily_long = erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily
scheduler_event:daily = erpnext.stock.utils.reorder_item
scheduler_event:daily = erpnext.setup.doctype.email_digest.email_digest.send
scheduler_event:daily = erpnext.support.doctype.support_ticket.support_ticket.auto_close_tickets
#### Weekly
scheduler_event = weekly:erpnext.setup.doctype.backup_manager.backup_manager.take_backups_weekly
scheduler_event:weekly_long = erpnext.setup.doctype.backup_manager.backup_manager.take_backups_weekly

View File

@ -5,7 +5,7 @@ frappe.provide("erpnext.hr");
erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
setup: function() {
this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.profile.profile.profile_query"} }
return { query:"frappe.core.doctype.user.user.user_query"} }
this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) {
return { query: "erpnext.controllers.queries.employee_query"} }
},
@ -33,8 +33,8 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
callback: function(r) {
var df = frappe.meta.get_docfield("Employee Leave Approver", "leave_approver",
me.frm.doc.name);
df.options = $.map(r.message, function(profile) {
return {value: profile, label: frappe.user_info(profile).fullname};
df.options = $.map(r.message, function(user) {
return {value: user, label: frappe.user_info(user).fullname};
});
me.frm.fields_dict.employee_leave_approvers.refresh();
}

View File

@ -39,10 +39,10 @@ class DocType(DocListController):
self.validate_duplicate_user_id()
def on_update(self):
if self.doc.user_id:
if self.doc.user_id and frappe.db.get_value("User", self.doc.user_id, 'docstatus') == 0:
self.restrict_user()
self.update_user_default()
self.update_profile()
self.update_user()
self.update_dob_event()
self.restrict_leave_approver()
@ -71,47 +71,47 @@ class DocType(DocListController):
frappe.defaults.add_default("Employee", self.doc.name, user, "Restriction")
def update_profile(self):
def update_user(self):
# add employee role if missing
if not "Employee" in frappe.db.sql_list("""select role from tabUserRole
where parent=%s""", self.doc.user_id):
from frappe.profile import add_role
from frappe.utils.user import add_role
add_role(self.doc.user_id, "Employee")
profile_wrapper = frappe.bean("Profile", self.doc.user_id)
user_wrapper = frappe.bean("User", self.doc.user_id)
# copy details like Fullname, DOB and Image to Profile
# copy details like Fullname, DOB and Image to User
if self.doc.employee_name:
employee_name = self.doc.employee_name.split(" ")
if len(employee_name) >= 3:
profile_wrapper.doc.last_name = " ".join(employee_name[2:])
profile_wrapper.doc.middle_name = employee_name[1]
user_wrapper.doc.last_name = " ".join(employee_name[2:])
user_wrapper.doc.middle_name = employee_name[1]
elif len(employee_name) == 2:
profile_wrapper.doc.last_name = employee_name[1]
user_wrapper.doc.last_name = employee_name[1]
profile_wrapper.doc.first_name = employee_name[0]
user_wrapper.doc.first_name = employee_name[0]
if self.doc.date_of_birth:
profile_wrapper.doc.birth_date = self.doc.date_of_birth
user_wrapper.doc.birth_date = self.doc.date_of_birth
if self.doc.gender:
profile_wrapper.doc.gender = self.doc.gender
user_wrapper.doc.gender = self.doc.gender
if self.doc.image:
if not profile_wrapper.doc.user_image == self.doc.image:
profile_wrapper.doc.user_image = self.doc.image
if not user_wrapper.doc.user_image == self.doc.image:
user_wrapper.doc.user_image = self.doc.image
try:
frappe.doc({
"doctype": "File Data",
"file_name": self.doc.image,
"attached_to_doctype": "Profile",
"attached_to_doctype": "User",
"attached_to_name": self.doc.user_id
}).insert()
except frappe.DuplicateEntryError, e:
# already exists
pass
profile_wrapper.ignore_permissions = True
profile_wrapper.save()
user_wrapper.ignore_permissions = True
user_wrapper.save()
def validate_date(self):
if self.doc.date_of_birth and self.doc.date_of_joining and getdate(self.doc.date_of_birth) >= getdate(self.doc.date_of_joining):
@ -143,7 +143,7 @@ class DocType(DocListController):
throw(_("Please enter relieving date."))
def validate_for_enabled_user_id(self):
enabled = frappe.db.sql("""select name from `tabProfile` where
enabled = frappe.db.sql("""select name from `tabUser` where
name=%s and enabled=1""", self.doc.user_id)
if not enabled:
throw("{id}: {user_id} {msg}".format(**{
@ -164,11 +164,11 @@ class DocType(DocListController):
}))
def validate_employee_leave_approver(self):
from frappe.profile import Profile
from frappe.utils.user import User
from erpnext.hr.doctype.leave_application.leave_application import InvalidLeaveApproverError
for l in self.doclist.get({"parentfield": "employee_leave_approvers"}):
if "Leave Approver" not in Profile(l.leave_approver).get_roles():
if "Leave Approver" not in User(l.leave_approver).get_roles():
throw(_("Invalid Leave Approver") + ": \"" + l.leave_approver + "\"",
exc=InvalidLeaveApproverError)
@ -212,4 +212,4 @@ def get_retirement_date(date_of_birth=None):
if date_of_birth:
dt = getdate(date_of_birth) + datetime.timedelta(21915)
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
return ret
return ret

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 09:04:18",
"docstatus": 0,
"modified": "2014-02-03 18:06:03",
"modified": "2014-02-03 18:06:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -126,7 +126,7 @@
"fieldname": "user_id",
"fieldtype": "Link",
"label": "User ID",
"options": "Profile"
"options": "User"
},
{
"doctype": "DocField",

View File

@ -21,6 +21,7 @@ class JobsMailbox(POP3Mailbox):
applicant = frappe.bean("Job Applicant", name)
if applicant.doc.status!="Rejected":
applicant.doc.status = "Open"
applicant.ignore_permissions = True
applicant.doc.save()
else:
name = (mail.from_real_name and (mail.from_real_name + " - ") or "") \
@ -32,6 +33,8 @@ class JobsMailbox(POP3Mailbox):
"email_id": mail.from_email,
"status": "Open"
})
applicant.ignore_permissions = True
applicant.ignore_mandatory = True
applicant.insert()
mail.save_attachments_in_doc(applicant.doc)

View File

@ -16,8 +16,8 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
method: "erpnext.hr.utils.get_leave_approver_list",
callback: function(r) {
cur_frm.set_df_property("leave_approver", "options", $.map(r.message,
function(profile) {
return {value: profile, label: frappe.user_info(profile).fullname};
function(user) {
return {value: user, label: frappe.user_info(user).fullname};
}));
if(leave_approver) cur_frm.set_value("leave_approver", leave_approver);
cur_frm.cscript.get_leave_balance(cur_frm.doc);
@ -116,6 +116,6 @@ cur_frm.cscript.calculate_total_days = function(doc, dt, dn) {
cur_frm.fields_dict.employee.get_query = function() {
return {
query: "hr.doctype.leave_application.leave_application.query_for_permitted_employees"
query: "erpnext.hr.doctype.leave_application.leave_application.query_for_permitted_employees"
};
}

View File

@ -2,7 +2,7 @@
{
"creation": "2013-02-20 11:18:11",
"docstatus": 0,
"modified": "2014-01-20 17:48:55",
"modified": "2014-01-20 17:48:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -55,7 +55,7 @@
"fieldname": "leave_approver",
"fieldtype": "Select",
"label": "Leave Approver",
"options": "link:Profile",
"options": "link:User",
"permlevel": 0
},
{

View File

@ -41,7 +41,7 @@ class TestLeaveApplication(unittest.TestCase):
def test_block_list(self):
self._clear_roles()
from frappe.profile import add_role
from frappe.utils.user import add_role
add_role("test1@example.com", "HR User")
frappe.db.set_value("Department", "_Test Department",
@ -64,7 +64,7 @@ class TestLeaveApplication(unittest.TestCase):
self._clear_roles()
self._clear_applications()
from frappe.profile import add_role
from frappe.utils.user import add_role
add_role("test@example.com", "Employee")
add_role("test2@example.com", "Leave Approver")
@ -80,7 +80,7 @@ class TestLeaveApplication(unittest.TestCase):
def test_global_block_list(self):
self._clear_roles()
from frappe.profile import add_role
from frappe.utils.user import add_role
add_role("test1@example.com", "Employee")
add_role("test@example.com", "Leave Approver")
@ -105,7 +105,7 @@ class TestLeaveApplication(unittest.TestCase):
def test_leave_approval(self):
self._clear_roles()
from frappe.profile import add_role
from frappe.utils.user import add_role
add_role("test@example.com", "Employee")
add_role("test1@example.com", "Leave Approver")
add_role("test2@example.com", "Leave Approver")

View File

@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:47",
"docstatus": 0,
"modified": "2013-12-20 19:23:19",
"modified": "2013-12-20 19:23:18",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -19,7 +19,7 @@
"in_list_view": 1,
"label": "Allow User",
"name": "__common__",
"options": "Profile",
"options": "User",
"parent": "Leave Block List Allow",
"parentfield": "fields",
"parenttype": "DocType",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-05-06 17:56:03",
"docstatus": 0,
"modified": "2013-05-06 17:56:03",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "HR",
"name": "__common__",
"ref_doctype": "Employee",
"report_name": "Employee Birthday",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-06 18:43:53",
"docstatus": 0,
"modified": "2013-05-06 18:47:43",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"doctype": "Report",
"is_standard": "Yes",
"json": "{\"filters\":[],\"columns\":[[\"name\",\"Employee\"],[\"employee_number\",\"Employee\"],[\"date_of_joining\",\"Employee\"],[\"branch\",\"Employee\"],[\"department\",\"Employee\"],[\"designation\",\"Employee\"],[\"gender\",\"Employee\"],[\"status\",\"Employee\"],[\"company\",\"Employee\"],[\"employment_type\",\"Employee\"],[\"grade\",\"Employee\"],[\"reports_to\",\"Employee\"],[\"company_email\",\"Employee\"]],\"sort_by\":\"Employee.bank_ac_no\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}",
"module": "HR",
"name": "__common__",
"ref_doctype": "Employee",
"report_name": "Employee Information",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-02-22 15:29:34",
"docstatus": 0,
"modified": "2013-02-22 15:53:01",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "HR",
"name": "__common__",
"ref_doctype": "Employee",
"report_name": "Employee Leave Balance",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-13 14:04:03",
"docstatus": 0,
"modified": "2013-05-13 14:32:42",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 0,
"doctype": "Report",
"is_standard": "Yes",
"module": "HR",
"name": "__common__",
"ref_doctype": "Attendance",
"report_name": "Monthly Attendance Sheet",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-07 18:09:42",
"docstatus": 0,
"modified": "2013-05-07 18:09:42",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "HR",
"name": "__common__",
"ref_doctype": "Salary Slip",
"report_name": "Monthly Salary Register",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-08-12 12:44:27",
"docstatus": 0,
"modified": "2013-08-12 12:44:27",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Manufacturing",
"name": "__common__",
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) = `tabProduction Order`.qty",
"ref_doctype": "Production Order",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-03 17:48:46",
"docstatus": 0,
"modified": "2013-05-07 11:49:56",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 0,
"doctype": "Report",
"is_standard": "Yes",
"module": "Manufacturing",
"name": "__common__",
"query": "select\n ste.production_order as \"Production Order:Link/Production Order:120\",\n ste.posting_date as \"Issue Date:Date:140\",\n ste_item.item_code as \"Item Code:Link/Item:120\",\n\tste_item.description as \"Description::150\",\n\tste_item.transfer_qty as \"Qty:Float:100\",\n\tste_item.stock_uom as \"UOM:Link/UOM:80\",\n\tste_item.amount as \"Amount:Currency:120\",\n\tste_item.serial_no as \"Serial No:Link/Serial No:80\",\n\tste_item.s_warehouse as \"Source Warehouse:Link/Warehouse:120\",\n\tste_item.t_warehouse as \"Target Warehouse:Link/Warehouse:120\",\n\tpro.production_item as \"Finished Goods:Link/Item:120\", \n\tste.name as \"Stock Entry:Link/Stock Entry:120\"\nfrom\n\t`tabStock Entry` ste, `tabStock Entry Detail` ste_item, `tabProduction Order` pro\nwhere\n\tifnull(ste.production_order, '') != '' and ste.name = ste_item.parent \n\tand ste.production_order = pro.name and ste.docstatus = 1 \n\tand ste.purpose = 'Manufacture/Repack'\norder by ste.posting_date, ste.production_order, ste_item.item_code",
"ref_doctype": "Production Order",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-08-12 12:32:30",
"docstatus": 0,
"modified": "2013-08-12 12:42:29",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Manufacturing",
"name": "__common__",
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND NOT EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
"ref_doctype": "Production Order",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-08-12 12:43:47",
"docstatus": 0,
"modified": "2013-08-12 12:43:47",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Manufacturing",
"name": "__common__",
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
"ref_doctype": "Production Order",

View File

@ -1,3 +1,4 @@
erpnext.patches.4_0.validate_v3_patch
erpnext.patches.4_0.update_user_properties
erpnext.patches.4_0.move_warehouse_user_to_restrictions
erpnext.patches.4_0.new_permissions
@ -26,3 +27,4 @@ erpnext.patches.4_0.customer_discount_to_pricing_rule
execute:frappe.db.sql("""delete from `tabWebsite Item Group` where ifnull(item_group, '')=''""")
erpnext.patches.4_0.remove_module_home_pages
erpnext.patches.4_0.split_email_settings
erpnext.patches.4_0.fix_employee_user_id

View File

@ -7,6 +7,8 @@ import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "pricing_rule")
frappe.db.auto_commit_on_many_writes = True
for d in frappe.db.sql("""select * from `tabCustomer Discount`
where ifnull(parent, '') != '' and docstatus < 2""", as_dict=1):
if not d.item_group:
@ -24,6 +26,7 @@ def execute():
"price_or_discount": "Discount",
"discount_percentage": d.discount
}]).insert()
frappe.db.auto_commit_on_many_writes = False
frappe.delete_doc("DocType", "Customer Discount")

View File

@ -0,0 +1,13 @@
import frappe
from frappe.utils import get_fullname
def execute():
for user_id in frappe.db.sql_list("""select distinct user_id from `tabEmployee`
where ifnull(user_id, '')!=''
group by user_id having count(name) > 1"""):
fullname = get_fullname(user_id)
employee = frappe.db.get_value("Employee", {"employee_name": fullname, "user_id": user_id})
if employee:
frappe.db.sql("""update `tabEmployee` set user_id=null
where user_id=%s and name!=%s""", (user_id, employee))

View File

@ -6,8 +6,8 @@ import frappe
def execute():
from frappe.core.page.user_properties import user_properties
for warehouse, profile in frappe.db.sql("""select parent, user from `tabWarehouse User`"""):
user_properties.add(profile, "Warehouse", warehouse)
for warehouse, user in frappe.db.sql("""select parent, user from `tabWarehouse User`"""):
user_properties.add(user, "Warehouse", warehouse)
frappe.delete_doc("DocType", "Warehouse User")
frappe.reload_doc("stock", "doctype", "warehouse")

View File

@ -42,10 +42,10 @@ def update_user_match():
meta = frappe.get_doctype(doctype)
# for each user with roles of this doctype, check if match condition applies
for profile in frappe.db.sql_list("""select name from `tabProfile`
for user in frappe.db.sql_list("""select name from `tabUser`
where enabled=1 and user_type='System User'"""):
user_roles = frappe.get_roles(profile)
user_roles = frappe.get_roles(user)
perms = meta.get({"doctype": "DocPerm", "permlevel": 0,
"role": ["in", [["All"] + user_roles]], "read": 1})
@ -69,9 +69,9 @@ def update_user_match():
# add that doc's restriction to that user
for match in user_matches:
for name in frappe.db.sql_list("""select name from `tab{doctype}`
where `{field}`=%s""".format(doctype=doctype, field=match.split(":")[0]), profile):
where `{field}`=%s""".format(doctype=doctype, field=match.split(":")[0]), user):
frappe.defaults.add_default(doctype, name, profile, "Restriction")
frappe.defaults.add_default(doctype, name, user, "Restriction")
def add_employee_restrictions_to_leave_approver():
from frappe.core.page.user_properties import user_properties

View File

@ -0,0 +1,12 @@
# 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
def execute():
from frappe.modules.patch_handler import executed
last_v3_patch = 'patches.1401.fix_planned_qty'
if not executed(last_v3_patch):
raise Exception, "site not ready to migrate to version 4"

View File

@ -85,5 +85,5 @@ def get_project(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
order by name
limit %(start)s, %(page_len)s """ % {'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
'start': start, 'page_len': page_len})

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-05 09:11:06",
"docstatus": 0,
"modified": "2013-12-20 19:21:53",
"modified": "2013-12-20 19:21:54",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -40,7 +40,7 @@
"fieldname": "created_by",
"fieldtype": "Link",
"label": "Created By",
"options": "Profile",
"options": "User",
"read_only": 1
},
{

View File

@ -15,7 +15,7 @@ def execute(filters=None):
"To Datetime::140", "Hours::70", "Activity Type::120", "Task:Link/Task:150",
"Task Subject::180", "Project:Link/Project:120", "Status::70"]
profile_map = get_profile_map()
user_map = get_user_map()
task_map = get_task_map()
conditions = build_conditions(filters)
@ -23,17 +23,17 @@ def execute(filters=None):
where docstatus < 2 %s order by owner asc""" % (conditions, ), filters, as_dict=1)
if time_logs:
profiles = [time_logs[0].owner]
users = [time_logs[0].owner]
data = []
total_hours = total_employee_hours = count = 0
for tl in time_logs:
if tl.owner not in profiles:
profiles.append(tl.owner)
if tl.owner not in users:
users.append(tl.owner)
data.append(["", "", "", "Total", total_employee_hours, "", "", "", "", ""])
total_employee_hours = 0
data.append([tl.name, profile_map[tl.owner], tl.from_time, tl.to_time, tl.hours,
data.append([tl.name, user_map[tl.owner], tl.from_time, tl.to_time, tl.hours,
tl.activity_type, tl.task, task_map.get(tl.task), tl.project, tl.status])
count += 1
@ -48,15 +48,15 @@ def execute(filters=None):
return columns, data
def get_profile_map():
profiles = frappe.db.sql("""select name,
def get_user_map():
users = frappe.db.sql("""select name,
concat(first_name, if(last_name, (' ' + last_name), '')) as fullname
from tabProfile""", as_dict=1)
profile_map = {}
for p in profiles:
profile_map.setdefault(p.name, []).append(p.fullname)
from tabUser""", as_dict=1)
user_map = {}
for p in users:
user_map.setdefault(p.name, []).append(p.fullname)
return profile_map
return user_map
def get_task_map():
tasks = frappe.db.sql("""select name, subject from tabTask""", as_dict=1)

View File

@ -2,13 +2,14 @@
{
"creation": "2013-04-03 11:27:52",
"docstatus": 0,
"modified": "2013-04-03 11:48:07",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Projects",
"name": "__common__",
"ref_doctype": "Time Log",
"report_name": "Daily Time Log Summary",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-03 17:37:41",
"docstatus": 0,
"modified": "2013-06-03 17:37:41",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Projects",
"name": "__common__",
"ref_doctype": "Project",
"report_name": "Project wise Stock Tracking ",

View File

@ -1,11 +1,11 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
// searches for enabled profiles
// searches for enabled users
frappe.provide("erpnext.queries");
$.extend(erpnext.queries, {
profile: function() {
return { query: "frappe.core.doctype.profile.profile.profile_query" };
user: function() {
return { query: "frappe.core.doctype.user.user.user_query" };
},
lead: function() {

View File

@ -5,9 +5,9 @@
frappe.provide('erpnext.toolbar');
erpnext.toolbar.setup = function() {
// profile
// user
var $user = $('#toolbar-user');
$user.append('<li><a href="#Form/Profile/'+user+'"><i class="icon-fixed-width icon-user"></i> '
$user.append('<li><a href="#Form/User/'+user+'"><i class="icon-fixed-width icon-user"></i> '
+frappe._("My Settings")+'...</a></li>');
$user.append('<li class="divider"></li>');
$user.append('<li><a href="https://erpnext.com/manual" target="_blank">\

View File

@ -22,6 +22,7 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
"source": "Email"
})
lead.ignore_permissions = True
lead.ignore_mandatory = True
lead.insert()
lead_name = lead.doc.name

View File

@ -12,14 +12,14 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
},
onload: function() {
if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) {
if(cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.profile.profile.profile_query" } }
return { query:"frappe.core.doctype.user.user.user_query" } }
}
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
if(cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.profile.profile.profile_query" } }
return { query:"frappe.core.doctype.user.user.user_query" } }
}
if(in_list(user_roles,'System Manager')) {

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-10 11:45:37",
"docstatus": 0,
"modified": "2014-01-20 17:48:53",
"modified": "2014-01-20 17:48:54",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -171,7 +171,7 @@
"label": "Lead Owner",
"oldfieldname": "lead_owner",
"oldfieldtype": "Link",
"options": "Profile",
"options": "User",
"search_index": 1
},
{
@ -190,7 +190,7 @@
"label": "Next Contact By",
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "Profile",
"options": "User",
"print_hide": 0,
"reqd": 0,
"width": "100px"

View File

@ -45,8 +45,8 @@ erpnext.selling.Opportunity = frappe.ui.form.Controller.extend({
setup_queries: function() {
var me = this;
if(this.frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
this.frm.set_query("contact_by", erpnext.queries.profile);
if(this.frm.fields_dict.contact_by.df.options.match(/^User/)) {
this.frm.set_query("contact_by", erpnext.queries.user);
}
this.frm.set_query("customer_address", function() {

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
"modified": "2014-01-20 17:48:58",
"modified": "2014-01-20 17:48:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -400,7 +400,7 @@
"label": "Next Contact By",
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "Profile",
"options": "User",
"read_only": 0,
"width": "75px"
},

View File

@ -39,5 +39,5 @@ def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
where is_stock_item="No" and is_sales_item="Yes"
and name not in (select name from `tabSales BOM`) and %s like %s
%s limit %s, %s""" % (searchfield, "%s",
get_match_cond(doctype, searchfield),"%s", "%s"),
get_match_cond(doctype),"%s", "%s"),
("%%%s%%" % txt, start, page_len))

View File

@ -281,10 +281,10 @@ class TestSalesOrder(unittest.TestCase):
def test_warehouse_user(self):
frappe.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
frappe.bean("Profile", "test@example.com").get_controller()\
frappe.bean("User", "test@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
frappe.bean("Profile", "test2@example.com").get_controller()\
frappe.bean("User", "test2@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
frappe.set_user("test@example.com")

View File

@ -57,8 +57,8 @@ erpnext.SalesChart = Class.extend({
var me = this;
me.ctype = ctype;
me.can_read = frappe.model.can_read(this.ctype);
me.can_create = frappe.boot.profile.can_create.indexOf(this.ctype) !== -1 ||
frappe.boot.profile.in_create.indexOf(this.ctype) !== -1;
me.can_create = frappe.boot.user.can_create.indexOf(this.ctype) !== -1 ||
frappe.boot.user.in_create.indexOf(this.ctype) !== -1;
me.can_write = frappe.model.can_write(this.ctype);
me.can_delete = frappe.model.can_delete(this.ctype);
@ -144,9 +144,14 @@ erpnext.SalesChart = Class.extend({
return frappe.call({
method: 'erpnext.selling.page.sales_browser.sales_browser.add_node',
args: v,
callback: function() {
d.hide();
node.reload();
callback: function(r) {
if(!r.exc) {
d.hide();
node.reload();
if(!node.expanded) {
node.toggle_node();
}
}
}
})
});

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-21 13:40:05",
"docstatus": 0,
"modified": "2013-06-21 15:06:40",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Sales BOM",
"report_name": "Available Stock for Packing Items",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-11-28 14:58:06",
"docstatus": 0,
"modified": "2013-11-28 15:02:48",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Customer",
"report_name": "Customer Acquisition and Loyalty",

View File

@ -2,13 +2,14 @@
{
"creation": "2012-10-04 18:45:27",
"docstatus": 0,
"modified": "2013-02-22 15:53:01",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"query": "SELECT\n\t`tabCustomer`.name as customer_id,\n\t`tabCustomer`.customer_name,\n\t`tabCustomer`.customer_group,\n\t`tabAddress`.address_line1,\n\t`tabAddress`.address_line2,\n\t`tabAddress`.city,\n\t`tabAddress`.state,\n\t`tabAddress`.pincode,\n\t`tabAddress`.country,\n\t`tabAddress`.is_primary_address, \n\t`tabContact`.first_name,\n\t`tabContact`.last_name,\n\t`tabContact`.phone,\n\t`tabContact`.mobile_no,\n\t`tabContact`.email_id,\n\t`tabContact`.is_primary_contact\nFROM\n\t`tabCustomer`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.customer=`tabCustomer`.name\n\t)\n\tleft join `tabContact` on (\n\t\t`tabContact`.customer=`tabCustomer`.name\n\t)\nWHERE\n\t`tabCustomer`.docstatus<2\nORDER BY\n\t`tabCustomer`.name asc",
"ref_doctype": "Customer",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-07 12:27:07",
"docstatus": 0,
"modified": "2013-06-07 12:27:07",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Sales Order",
"report_name": "Customers Not Buying Since Long Time ",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-23 17:42:24",
"docstatus": 0,
"modified": "2014-02-11 12:20:17",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -11,6 +11,7 @@
"disabled": 0,
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"query": "select\n so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Float:100\",\n\tso_item.stock_uom as \"UOM:Link/UOM:80\",\n\tso_item.base_rate as \"Rate:Currency:120\",\n\tso_item.base_amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n\tso.territory as \"Territory:Link/Territory:130\",\n so.project_name as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item\nwhere\n\tso.name = so_item.parent\n\tand so.docstatus = 1\norder by so.name desc",
"ref_doctype": "Sales Order",

View File

@ -2,15 +2,16 @@
{
"creation": "2013-10-22 11:58:16",
"docstatus": 0,
"modified": "2013-11-06 15:01:09",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n `tabLead`.owner as \"Owner:Link/Profile:120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
"query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
"ref_doctype": "Lead",
"report_name": "Lead Details",
"report_type": "Query Report"

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-21 16:46:45",
"docstatus": 0,
"modified": "2013-06-21 16:55:54",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"query": "select \n so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n so_item.`parent` = so.`name` and mr_item.sales_order_no = so.name\n and mr_item.parent = mr.name \n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\norder by so.name desc, so_item.item_code asc",
"ref_doctype": "Sales Order",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-07 16:01:16",
"docstatus": 0,
"modified": "2013-06-12 16:31:23",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 0,
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Quotation",
"report_name": "Quotation Trends",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-13 18:43:30",
"docstatus": 0,
"modified": "2013-06-13 18:43:30",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Sales Order",
"report_name": "Sales Order Trends",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-21 12:14:15",
"docstatus": 0,
"modified": "2013-06-21 12:14:15",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Sales Order",
"report_name": "Sales Person Target Variance Item Group-Wise",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-03 11:31:05",
"docstatus": 0,
"modified": "2013-05-03 11:31:05",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -10,6 +10,7 @@
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Sales Order",
"report_name": "Sales Person-wise Transaction Summary",

View File

@ -2,13 +2,14 @@
{
"creation": "2013-06-21 12:15:00",
"docstatus": 0,
"modified": "2013-06-21 12:15:00",
"modified": "2014-03-07 15:30:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"module": "Selling",
"name": "__common__",
"ref_doctype": "Sales Order",
"report_name": "Territory Target Variance Item Group-Wise",

View File

@ -403,13 +403,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
// paid_amount and write_off_amount is only for POS Invoice
// total_advance is only for non POS Invoice
if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
"paid_amount"]);
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount - this.frm.doc.total_advance;
this.frm.doc.paid_amount = this.frm.doc.is_pos? flt(total_amount_to_pay): 0.0;
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - this.frm.doc.paid_amount,
precision("outstanding_amount"));
if(this.frm.doc.paid_amount==null) {
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
"paid_amount"]);
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount
- this.frm.doc.total_advance;
this.frm.doc.paid_amount = this.frm.doc.is_pos ? flt (total_amount_to_pay) : 0.0;
this.frm.set_value("outstanding_amount", flt(total_amount_to_pay
- this.frm.doc.paid_amount, precision("outstanding_amount")));
}
}
},

View File

@ -184,7 +184,7 @@ class DocType(TransactionBase):
if m['approving_user']:
app_specific_user.append(m['approving_user'])
elif m['approving_role']:
user_lst = [z[0] for z in frappe.db.sql("select distinct t1.name from `tabProfile` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])]
user_lst = [z[0] for z in frappe.db.sql("select distinct t1.name from `tabUser` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])]
for x in user_lst:
if not x in app_user:
app_user.append(x)

View File

@ -65,11 +65,11 @@ cur_frm.cscript.transaction = function(doc, cdt, cdn){
}
cur_frm.fields_dict.system_user.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.profile.profile.profile_query" }
return { query:"frappe.core.doctype.user.user.user_query" }
}
cur_frm.fields_dict.approving_user.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.profile.profile.profile_query" }
return { query:"frappe.core.doctype.user.user.user_query" }
}
cur_frm.fields_dict['approving_role'].get_query = cur_frm.fields_dict['system_role'].get_query;

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:22",
"docstatus": 0,
"modified": "2014-01-20 17:48:24",
"modified": "2014-01-20 17:48:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -102,7 +102,7 @@
"label": "Applicable To (User)",
"oldfieldname": "system_user",
"oldfieldtype": "Link",
"options": "Profile"
"options": "User"
},
{
"description": "This will be used for setting rule in HR module",
@ -142,7 +142,7 @@
"label": "Approving User",
"oldfieldname": "approving_user",
"oldfieldtype": "Link",
"options": "Profile"
"options": "User"
},
{
"doctype": "DocField",

View File

@ -21,7 +21,7 @@ def get_dropbox_authorize_url():
sess = get_dropbox_session()
request_token = sess.obtain_request_token()
return_address = get_request_site_address(True) \
+ "?cmd=setup.doctype.backup_manager.backup_dropbox.dropbox_callback"
+ "?cmd=erpnext.setup.doctype.backup_manager.backup_dropbox.dropbox_callback"
url = sess.build_authorize_url(request_token, return_address)
@ -71,13 +71,12 @@ def dropbox_callback(oauth_token=None, not_approved=False):
def backup_to_dropbox():
from dropbox import client, session
from conf import dropbox_access_key, dropbox_secret_key
from frappe.utils.backups import new_backup
from frappe.utils import get_files_path, get_backups_path
if not frappe.db:
frappe.connect()
sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
sess = session.DropboxSession(frappe.conf.dropbox_access_key, frappe.conf.dropbox_secret_key, "app_folder")
sess.set_token(frappe.db.get_value("Backup Manager", None, "dropbox_access_key"),
frappe.db.get_value("Backup Manager", None, "dropbox_access_secret"))
@ -120,13 +119,11 @@ def get_dropbox_session():
from dropbox import session
except:
frappe.msgprint(_("Please install dropbox python module"), raise_exception=1)
try:
from conf import dropbox_access_key, dropbox_secret_key
except ImportError:
frappe.msgprint(_("Please set Dropbox access keys in") + " conf.py",
raise_exception=True)
sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
if not (frappe.conf.dropbox_access_key or frappe.conf.dropbox_secret_key):
frappe.throw(_("Please set Dropbox access keys in your site config"))
sess = session.DropboxSession(frappe.conf.dropbox_access_key, frappe.conf.dropbox_secret_key, "app_folder")
return sess
def upload_file_to_dropbox(filename, folder, dropbox_client):

Some files were not shown because too many files have changed in this diff Show More