Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2fda1c779 | ||
|
|
a29577ca71 | ||
|
|
b1454cdf9f | ||
|
|
f668a4d03c | ||
|
|
c2b4ae6667 | ||
|
|
1857bb8b0b | ||
|
|
888a70c2d4 | ||
|
|
9d5b84e78a | ||
|
|
bdc125ad0f | ||
|
|
f0b3014a23 | ||
|
|
0b17a91aba | ||
|
|
83dd3e14e5 | ||
|
|
38f64ea3ab | ||
|
|
cd103c05d6 | ||
|
|
bc1e8b4408 | ||
|
|
4fb7f881c8 | ||
|
|
83a358afc1 | ||
|
|
96bb070781 | ||
|
|
d387dd3bc6 | ||
|
|
9f25575e0c | ||
|
|
e1af7f1a0f | ||
|
|
c35df5ce80 | ||
|
|
2c2868db11 | ||
|
|
17f28c13ed | ||
|
|
3f1f2dd307 | ||
|
|
ab05dcd9f9 | ||
|
|
f21edba97f | ||
|
|
91b0e2348c | ||
|
|
4de91887db | ||
|
|
9b1288605f | ||
|
|
43888546f6 | ||
|
|
68d2e317d2 | ||
|
|
f5940907ae | ||
|
|
90162078d5 | ||
|
|
cba99743a4 | ||
|
|
f44128f81c | ||
|
|
bbca95fd1b | ||
|
|
4df98d52c1 | ||
|
|
28f8664b93 | ||
|
|
be9edae961 | ||
|
|
4223d7c044 | ||
|
|
5f90f7096d | ||
|
|
59c4ae5a46 | ||
|
|
85abdc4fad |
@@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.0.1'
|
||||
__version__ = '6.1.1'
|
||||
|
||||
@@ -402,7 +402,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-20 03:54:14.297995",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Account",
|
||||
@@ -410,7 +410,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -430,7 +430,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -450,7 +450,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -470,7 +470,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2015-02-05 05:11:35.427357",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "C-Form",
|
||||
@@ -352,7 +352,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:25.504801",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cost Center",
|
||||
@@ -326,7 +326,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -346,7 +346,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -366,7 +366,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -386,7 +386,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:27.745408",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Fiscal Year",
|
||||
@@ -161,7 +161,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -442,7 +442,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-09 15:51:04.986518",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GL Entry",
|
||||
@@ -450,7 +450,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe.utils import flt, fmt_money, getdate, formatdate, cstr
|
||||
from frappe.utils import flt, fmt_money, getdate, formatdate
|
||||
from frappe import _
|
||||
|
||||
from frappe.model.document import Document
|
||||
@@ -91,7 +91,7 @@ class GLEntry(Document):
|
||||
|
||||
if self.cost_center and _get_cost_center_company() != self.company:
|
||||
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
|
||||
|
||||
|
||||
def validate_party(self):
|
||||
if self.party_type and self.party:
|
||||
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
|
||||
@@ -124,12 +124,18 @@ def check_freezing_date(posting_date, adv_adj=False):
|
||||
frappe.throw(_("You are not authorized to add or update entries before {0}").format(formatdate(acc_frozen_upto)))
|
||||
|
||||
def update_outstanding_amt(account, party_type, party, against_voucher_type, against_voucher, on_cancel=False):
|
||||
if party_type and party:
|
||||
party_condition = " and ifnull(party_type, '')='{0}' and ifnull(party, '')='{1}'"\
|
||||
.format(frappe.db.escape(party_type), frappe.db.escape(party))
|
||||
else:
|
||||
party_condition = ""
|
||||
|
||||
# get final outstanding amt
|
||||
bal = flt(frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry`
|
||||
where against_voucher_type=%s and against_voucher=%s
|
||||
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s""",
|
||||
(against_voucher_type, against_voucher, account, party_type, party))[0][0] or 0.0)
|
||||
and account = %s {0}""".format(party_condition),
|
||||
(against_voucher_type, against_voucher, account))[0][0] or 0.0)
|
||||
|
||||
if against_voucher_type == 'Purchase Invoice':
|
||||
bal = -bal
|
||||
@@ -137,9 +143,8 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
|
||||
against_voucher_amount = flt(frappe.db.sql("""
|
||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
|
||||
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s
|
||||
and ifnull(against_voucher, '') = ''""",
|
||||
(against_voucher, account, cstr(party_type), cstr(party)))[0][0])
|
||||
and account = %s and ifnull(against_voucher, '') = '' {0}"""
|
||||
.format(party_condition), (against_voucher, account))[0][0])
|
||||
|
||||
if not against_voucher_amount:
|
||||
frappe.throw(_("Against Journal Entry {0} is already adjusted against some other voucher")
|
||||
|
||||
@@ -59,7 +59,6 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
// journal entry
|
||||
if(jvd.reference_type==="Journal Entry") {
|
||||
frappe.model.validate_missing(jvd, "account");
|
||||
|
||||
return {
|
||||
query: "erpnext.accounts.doctype.journal_entry.journal_entry.get_against_jv",
|
||||
filters: {
|
||||
@@ -69,23 +68,32 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
};
|
||||
}
|
||||
|
||||
// against party
|
||||
|
||||
frappe.model.validate_missing(jvd, "party_type");
|
||||
frappe.model.validate_missing(jvd, "party");
|
||||
|
||||
var out = {
|
||||
filters: [
|
||||
[jvd.reference_type, jvd.reference_type.indexOf("Sales")===0 ? "customer" : "supplier", "=", jvd.party],
|
||||
[jvd.reference_type, "docstatus", "=", 1],
|
||||
[jvd.reference_type, "docstatus", "=", 1]
|
||||
]
|
||||
};
|
||||
|
||||
if(in_list(["Sales Invoice", "Purchase Invoice"], jvd.reference_type)) {
|
||||
out.filters.push([jvd.reference_type, "outstanding_amount", "!=", 0]);
|
||||
|
||||
// account filter
|
||||
frappe.model.validate_missing(jvd, "account");
|
||||
|
||||
party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to";
|
||||
out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]);
|
||||
} else {
|
||||
// party_type and party mandatory
|
||||
frappe.model.validate_missing(jvd, "party_type");
|
||||
frappe.model.validate_missing(jvd, "party");
|
||||
|
||||
out.filters.push([jvd.reference_type, "per_billed", "<", 100]);
|
||||
}
|
||||
|
||||
if(jvd.party_type && jvd.party) {
|
||||
out.filters.push([jvd.reference_type,
|
||||
(jvd.reference_type.indexOf("Sales")===0 ? "customer" : "supplier"), "=", jvd.party]);
|
||||
}
|
||||
|
||||
return out;
|
||||
});
|
||||
|
||||
@@ -1002,7 +1002,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:19:18.634225",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry",
|
||||
@@ -1010,7 +1010,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -1050,7 +1050,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:41.346436",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Mode of Payment",
|
||||
@@ -93,7 +93,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -622,7 +622,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-18 17:49:09.098876",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Profile",
|
||||
@@ -650,7 +650,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -2175,7 +2175,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:21:24.432106",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
@@ -2183,7 +2183,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -2203,7 +2203,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2223,7 +2223,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2263,7 +2263,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -2882,7 +2882,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:29:14.270731",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
@@ -2910,7 +2910,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -2930,7 +2930,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -88,13 +88,13 @@ class SalesInvoice(SellingController):
|
||||
self.update_status_updater_args()
|
||||
self.update_prevdoc_status()
|
||||
|
||||
# this sequence because outstanding may get -ve
|
||||
self.make_gl_entries()
|
||||
|
||||
if not self.is_return:
|
||||
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
|
||||
self.check_credit_limit()
|
||||
|
||||
# this sequence because outstanding may get -ve
|
||||
self.make_gl_entries()
|
||||
|
||||
if not cint(self.is_pos) == 1 and not self.is_return:
|
||||
self.update_against_document_in_jv()
|
||||
|
||||
@@ -161,6 +161,17 @@ class SalesInvoice(SellingController):
|
||||
'extra_cond': """ and exists (select name from `tabSales Invoice` where name=`tabSales Invoice Item`.parent and update_stock=1 and is_return=1)"""
|
||||
}
|
||||
])
|
||||
|
||||
def check_credit_limit(self):
|
||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||
|
||||
validate_against_credit_limit = False
|
||||
for d in self.get("items"):
|
||||
if not (d.sales_order or d.delivery_note):
|
||||
validate_against_credit_limit = True
|
||||
break
|
||||
if validate_against_credit_limit:
|
||||
check_credit_limit(self.customer, self.company)
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
pos = self.set_pos_fields(for_validate)
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-05-06 08:51:54.662853",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Taxes and Charges Template",
|
||||
@@ -206,7 +206,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:46.634371",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Shipping Rule",
|
||||
@@ -304,7 +304,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -324,7 +324,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -42,13 +42,13 @@ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
|
||||
wrapper.page.add_menu_item(__('New Company'), function() { newdoc('Company'); }, true);
|
||||
}
|
||||
|
||||
wrapper.page.set_secondary_action(__('Refresh'), function() {
|
||||
wrapper.page.add_menu_item(__('Refresh'), function() {
|
||||
wrapper.$company_select.change();
|
||||
});
|
||||
|
||||
wrapper.page.set_primary_action(__('New'), function() {
|
||||
erpnext.account_chart && erpnext.account_chart.make_new();
|
||||
});
|
||||
}, "octicon octicon-plus");
|
||||
|
||||
// company-select
|
||||
wrapper.$company_select = wrapper.page.add_select("Company", [])
|
||||
@@ -121,7 +121,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
label: __("Add Child"),
|
||||
click: function() {
|
||||
me.make_new()
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
condition: function(node) {
|
||||
@@ -137,8 +138,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
"company": me.company
|
||||
};
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}
|
||||
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
condition: function(node) { return !node.root && me.can_write },
|
||||
@@ -147,7 +148,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
frappe.model.rename_doc(me.ctype, node.label, function(new_name) {
|
||||
node.reload();
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
condition: function(node) { return !node.root && me.can_delete },
|
||||
@@ -156,7 +158,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
frappe.model.delete_doc(me.ctype, node.label, function() {
|
||||
node.parent.remove();
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
}
|
||||
],
|
||||
onrender: function(node) {
|
||||
|
||||
@@ -226,7 +226,7 @@ class GrossProfitGenerator(object):
|
||||
inner join `tabSales Invoice Item` item on item.parent = si.name
|
||||
left join `tabSales Team` sales on sales.parent = si.name
|
||||
where
|
||||
si.docstatus = 1 %s
|
||||
si.docstatus = 1 and si.is_return != 1 %s
|
||||
order by
|
||||
si.posting_date desc, si.posting_time desc""" % (conditions,), self.filters, as_dict=1)
|
||||
|
||||
|
||||
@@ -2032,7 +2032,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 06:26:20.233037",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
@@ -2040,7 +2040,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2080,7 +2080,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -2100,7 +2100,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -511,7 +511,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-25 07:14:56.245716",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier",
|
||||
@@ -579,7 +579,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -619,7 +619,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -1554,7 +1554,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:23:35.148488",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Quotation",
|
||||
@@ -1602,7 +1602,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -1622,7 +1622,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -1642,7 +1642,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
4
erpnext/change_log/v6/v6_1_0.md
Normal file
4
erpnext/change_log/v6/v6_1_0.md
Normal file
@@ -0,0 +1,4 @@
|
||||
- Set default costing rate and billing rate in **Activity Type**
|
||||
- Task not mandatory in **Time Log** and **Expense Claim**
|
||||
- **Stock Settings**: Enable/Disable automatic fetching of Serial Nos. based on FIFO
|
||||
- Fixes in Tree UI for mobile, Gross Profit Report and Credit Limit checking
|
||||
@@ -32,10 +32,6 @@ class SellingController(StockController):
|
||||
self.validate_max_discount()
|
||||
check_active_sales_items(self)
|
||||
|
||||
def check_credit_limit(self):
|
||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||
check_credit_limit(self.customer, self.company)
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
super(SellingController, self).set_missing_values(for_validate)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ blogs.
|
||||
"""
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "6.0.1"
|
||||
app_version = "6.1.1"
|
||||
github_link = "https://github.com/frappe/erpnext"
|
||||
|
||||
error_report_email = "support@erpnext.com"
|
||||
|
||||
@@ -465,7 +465,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-03-02 07:00:45.803789",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Appraisal",
|
||||
@@ -473,7 +473,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -513,7 +513,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-03-02 06:32:50.109677",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Appraisal Template",
|
||||
@@ -99,7 +99,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-20 05:09:39.161541",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Attendance",
|
||||
@@ -305,7 +305,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:35.266252",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Branch",
|
||||
@@ -50,7 +50,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:37.070363",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Deduction Type",
|
||||
@@ -74,7 +74,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:37.460611",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Department",
|
||||
@@ -73,7 +73,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:37.500898",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Designation",
|
||||
@@ -50,7 +50,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:37.761378",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Earning Type",
|
||||
@@ -74,7 +74,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -1893,7 +1893,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-09 02:25:20.987412",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Employee",
|
||||
@@ -1901,7 +1901,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -1921,7 +1921,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:38.516592",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Employment Type",
|
||||
@@ -50,7 +50,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,22 +20,27 @@ class ExpenseClaim(Document):
|
||||
validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
|
||||
self.validate_sanctioned_amount()
|
||||
self.validate_expense_approver()
|
||||
self.validate_task()
|
||||
self.calculate_total_amount()
|
||||
set_employee_name(self)
|
||||
if self.task and not self.project:
|
||||
self.project = frappe.db.get_value("Task", self.task, "project")
|
||||
|
||||
def on_submit(self):
|
||||
if self.approval_status=="Draft":
|
||||
frappe.throw(_("""Approval Status must be 'Approved' or 'Rejected'"""))
|
||||
if self.task:
|
||||
self.update_task()
|
||||
|
||||
self.update_task_and_project()
|
||||
|
||||
def on_cancel(self):
|
||||
self.update_task_and_project()
|
||||
|
||||
def update_task_and_project(self):
|
||||
if self.task:
|
||||
self.update_task()
|
||||
|
||||
elif self.project:
|
||||
frappe.get_doc("Project", self.project).update_project()
|
||||
|
||||
def calculate_total_amount(self):
|
||||
self.total_claimed_amount = 0
|
||||
self.total_claimed_amount = 0
|
||||
self.total_sanctioned_amount = 0
|
||||
for d in self.get('expenses'):
|
||||
self.total_claimed_amount += flt(d.claim_amount)
|
||||
@@ -45,26 +50,22 @@ class ExpenseClaim(Document):
|
||||
if self.exp_approver and "Expense Approver" not in frappe.get_roles(self.exp_approver):
|
||||
frappe.throw(_("{0} ({1}) must have role 'Expense Approver'")\
|
||||
.format(get_fullname(self.exp_approver), self.exp_approver), InvalidExpenseApproverError)
|
||||
|
||||
|
||||
def update_task(self):
|
||||
task = frappe.get_doc("Task", self.task)
|
||||
task.update_total_expense_claim()
|
||||
task.save()
|
||||
|
||||
def validate_task(self):
|
||||
if self.project and not self.task:
|
||||
frappe.throw(_("Task is mandatory if Expense Claim is against a Project"))
|
||||
|
||||
def validate_sanctioned_amount(self):
|
||||
for d in self.get('expenses'):
|
||||
if flt(d.sanctioned_amount) > flt(d.claim_amount):
|
||||
frappe.throw(_("Sanctioned Amount cannot be greater than Claim Amount in Row {0}.").format(d.idx))
|
||||
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_expense_approver(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""
|
||||
select u.name, concat(u.first_name, ' ', u.last_name)
|
||||
select u.name, concat(u.first_name, ' ', u.last_name)
|
||||
from tabUser u, tabUserRole r
|
||||
where u.name = r.parent and r.role = 'Expense Approver' and u.name like %s
|
||||
""", ("%" + txt + "%"))
|
||||
""", ("%" + txt + "%"))
|
||||
|
||||
@@ -11,44 +11,47 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
def test_total_expense_claim_for_project(self):
|
||||
frappe.db.sql("""delete from `tabTask` where project = "_Test Project 1" """)
|
||||
frappe.db.sql("""delete from `tabProject` where name = "_Test Project 1" """)
|
||||
|
||||
frappe.db.sql("""delete from `tabExpense Claim`""")
|
||||
frappe.db.sql("""delete from `tabExpense Claim Detail`""")
|
||||
|
||||
frappe.get_doc({
|
||||
"project_name": "_Test Project 1",
|
||||
"doctype": "Project",
|
||||
"tasks" :
|
||||
[{ "title": "_Test Project Task 1", "status": "Open" }]
|
||||
}).save()
|
||||
|
||||
task_name = frappe.db.get_value("Task",{"project": "_Test Project 1"})
|
||||
|
||||
task_name = frappe.db.get_value("Task", {"project": "_Test Project 1"})
|
||||
|
||||
expense_claim = frappe.get_doc({
|
||||
"doctype": "Expense Claim",
|
||||
"employee": "_T-Employee-0001",
|
||||
"approval_status": "Approved",
|
||||
"project": "_Test Project 1",
|
||||
"task": task_name,
|
||||
"expenses":
|
||||
"expenses":
|
||||
[{ "expense_type": "Food", "claim_amount": 300, "sanctioned_amount": 200 }]
|
||||
})
|
||||
expense_claim.submit()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 200)
|
||||
|
||||
|
||||
expense_claim2 = frappe.get_doc({
|
||||
"doctype": "Expense Claim",
|
||||
"employee": "_T-Employee-0001",
|
||||
"approval_status": "Approved",
|
||||
"project": "_Test Project 1",
|
||||
"task": task_name,
|
||||
"expenses":
|
||||
"expenses":
|
||||
[{ "expense_type": "Food", "claim_amount": 600, "sanctioned_amount": 500 }]
|
||||
})
|
||||
expense_claim2.submit()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 700)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 700)
|
||||
|
||||
|
||||
expense_claim2.cancel()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 200)
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-03-23 05:42:02.016041",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Job Applicant",
|
||||
@@ -199,7 +199,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:40.083704",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Job Opening",
|
||||
@@ -93,7 +93,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -310,7 +310,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-05-08 03:44:08.092937",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Allocation",
|
||||
@@ -318,7 +318,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -559,7 +559,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2015-05-27 18:44:36.708614",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Application",
|
||||
@@ -567,7 +567,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -628,7 +628,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -649,7 +649,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:40.729590",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Block List",
|
||||
@@ -203,7 +203,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-29 05:15:24",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Type",
|
||||
@@ -182,7 +182,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -222,7 +222,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -822,7 +822,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-20 05:12:10.770423",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Salary Slip",
|
||||
@@ -830,7 +830,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -871,7 +871,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -524,7 +524,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-04-06 06:56:02.395512",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Salary Structure",
|
||||
@@ -532,7 +532,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
|
||||
@@ -713,7 +713,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-12 08:52:36.656865",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "BOM",
|
||||
@@ -741,7 +741,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -11,7 +11,5 @@ class ManufacturingSettings(Document):
|
||||
pass
|
||||
|
||||
def get_mins_between_operations():
|
||||
if not hasattr(frappe.local, "_mins_between_operations"):
|
||||
frappe.local._mins_between_operations = cint(frappe.db.get_single_value("Manufacturing Settings",
|
||||
"mins_between_operations")) or 10
|
||||
return relativedelta(minutes=frappe.local._mins_between_operations)
|
||||
return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings",
|
||||
"mins_between_operations")) or 10)
|
||||
|
||||
@@ -871,7 +871,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:27:08.064900",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Order",
|
||||
@@ -879,7 +879,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -899,7 +899,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
import frappe
|
||||
|
||||
from frappe.utils import flt, nowdate, get_datetime, getdate, date_diff, cint
|
||||
from frappe.utils import flt, get_datetime, getdate, date_diff, cint
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
|
||||
@@ -14,6 +14,7 @@ from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHol
|
||||
from erpnext.projects.doctype.time_log.time_log import OverlapError
|
||||
from erpnext.stock.doctype.stock_entry.stock_entry import get_additional_costs
|
||||
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
|
||||
from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
|
||||
|
||||
class OverProductionError(frappe.ValidationError): pass
|
||||
class StockOverProductionError(frappe.ValidationError): pass
|
||||
@@ -106,8 +107,7 @@ class ProductionOrder(Document):
|
||||
def stop_unstop(self, status):
|
||||
""" Called from client side on Stop/Unstop event"""
|
||||
self.update_status(status)
|
||||
qty = (flt(self.qty)-flt(self.produced_qty)) * ((status == 'Stopped') and -1 or 1)
|
||||
self.update_planned_qty(qty)
|
||||
self.update_planned_qty()
|
||||
frappe.msgprint(_("Production Order status is {0}").format(status))
|
||||
self.notify_modified()
|
||||
|
||||
@@ -154,30 +154,30 @@ class ProductionOrder(Document):
|
||||
frappe.throw(_("For Warehouse is required before Submit"))
|
||||
frappe.db.set(self,'status', 'Submitted')
|
||||
self.make_time_logs()
|
||||
self.update_planned_qty(self.qty)
|
||||
self.update_planned_qty()
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
self.validate_cancel()
|
||||
|
||||
frappe.db.set(self,'status', 'Cancelled')
|
||||
self.update_planned_qty()
|
||||
self.delete_time_logs()
|
||||
|
||||
def validate_cancel(self):
|
||||
if self.status == "Stopped":
|
||||
frappe.throw(_("Stopped Production Order cannot be cancelled, Unstop it first to cancel"))
|
||||
|
||||
# Check whether any stock entry exists against this Production Order
|
||||
stock_entry = frappe.db.sql("""select name from `tabStock Entry`
|
||||
where production_order = %s and docstatus = 1""", self.name)
|
||||
if stock_entry:
|
||||
frappe.throw(_("Cannot cancel because submitted Stock Entry {0} exists").format(stock_entry[0][0]))
|
||||
|
||||
frappe.db.set(self,'status', 'Cancelled')
|
||||
self.update_planned_qty(-self.qty)
|
||||
self.delete_time_logs()
|
||||
|
||||
def update_planned_qty(self, qty):
|
||||
"""update planned qty in bin"""
|
||||
args = {
|
||||
"item_code": self.production_item,
|
||||
"warehouse": self.fg_warehouse,
|
||||
"posting_date": nowdate(),
|
||||
"planned_qty": flt(qty)
|
||||
}
|
||||
from erpnext.stock.utils import update_bin
|
||||
update_bin(args)
|
||||
def update_planned_qty(self):
|
||||
update_bin_qty(self.production_item, self.fg_warehouse, {
|
||||
"planned_qty": get_planned_qty(self.production_item, self.fg_warehouse)
|
||||
})
|
||||
|
||||
def set_production_order_operations(self):
|
||||
"""Fetch operations from BOM and set in 'Production Order'"""
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-03-10 15:12:52.857454",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Workstation",
|
||||
@@ -349,7 +349,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -200,4 +200,9 @@ erpnext.patches.v5_8.add_credit_note_print_heading
|
||||
execute:frappe.delete_doc_if_exists("Print Format", "Credit Note - Negative Invoice")
|
||||
|
||||
# V6.0
|
||||
erpnext.patches.v6_0.set_default_title
|
||||
erpnext.patches.v6_0.set_default_title # 2015-09-03
|
||||
erpnext.patches.v6_0.default_activity_rate
|
||||
execute:frappe.db.set_value("Stock Settings", None, "automatically_set_serial_nos_based_on_fifo", 1)
|
||||
execute:frappe.db.sql("""update `tabProject` set percent_complete=round(percent_complete, 2) where percent_complete is not null""")
|
||||
erpnext.patches.v6_0.fix_outstanding_amount
|
||||
erpnext.patches.v6_0.fix_planned_qty
|
||||
@@ -40,8 +40,8 @@ def rename_and_reload_doctypes():
|
||||
|
||||
frappe.reload_doctype("Item")
|
||||
frappe.reload_doc("Stock", "DocType", "Item Variant Attribute")
|
||||
frappe.reload_doctype("Item Attribute Value")
|
||||
frappe.reload_doctype("Item Attribute")
|
||||
frappe.reload_doc("Stock", "DocType", "Item Attribute Value")
|
||||
frappe.reload_doc("Stock", "DocType", "Item Attribute")
|
||||
|
||||
def migrate_manage_variants():
|
||||
item_attribute = {}
|
||||
|
||||
11
erpnext/patches/v6_0/default_activity_rate.py
Normal file
11
erpnext/patches/v6_0/default_activity_rate.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for cost in frappe.db.get_list("Activity Cost", filters = {"employee": ""},
|
||||
fields = ("name", "activity_type", "costing_rate", "billing_rate")):
|
||||
activity_type = frappe.get_doc("Activity Type", cost.activity_type)
|
||||
activity_type.costing_rate = cost.costing_rate
|
||||
activity_type.billing_rate = cost.billing_rate
|
||||
activity_type.save()
|
||||
|
||||
frappe.delete_doc("Activity Cost", cost.name)
|
||||
16
erpnext/patches/v6_0/fix_outstanding_amount.py
Normal file
16
erpnext/patches/v6_0/fix_outstanding_amount.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# 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
|
||||
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
|
||||
|
||||
def execute():
|
||||
for dt, party_field, account_field in (("Sales Invoice", "customer", "debit_to"),
|
||||
("Purchase Invoice", "supplier", "credit_to")):
|
||||
|
||||
wrong_invoices = frappe.db.sql("""select name, {0} as account from `tab{1}`
|
||||
where docstatus=1 and ifnull({2}, '')=''""".format(account_field, dt, party_field))
|
||||
|
||||
for invoice, account in wrong_invoices:
|
||||
update_outstanding_amt(account, party_field.title(), None, dt, invoice)
|
||||
14
erpnext/patches/v6_0/fix_planned_qty.py
Normal file
14
erpnext/patches/v6_0/fix_planned_qty.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# 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
|
||||
from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
|
||||
|
||||
def execute():
|
||||
for item_code, warehouse in frappe.db.sql("""select distinct production_item, fg_warehouse
|
||||
from `tabProduction Order`"""):
|
||||
if frappe.db.exists("Item", item_code) and frappe.db.exists("Warehouse", warehouse):
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
"planned_qty": get_planned_qty(item_code, warehouse)
|
||||
})
|
||||
@@ -7,7 +7,7 @@
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"document_type": "Setup",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@@ -219,7 +219,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-06-16 03:12:25.644839",
|
||||
"modified": "2015-08-31 06:43:42.804365",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Activity Cost",
|
||||
|
||||
8
erpnext/projects/doctype/activity_type/activity_type.js
Normal file
8
erpnext/projects/doctype/activity_type/activity_type.js
Normal file
@@ -0,0 +1,8 @@
|
||||
frappe.ui.form.on("Activity Type", {
|
||||
refresh: function(frm) {
|
||||
frm.add_custom_button("Activity Cost per Employee", function() {
|
||||
frappe.route_options = {"activity_type": frm.doc.name};
|
||||
frappe.set_route("List", "Activity Cost");
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,92 +1,157 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:activity_type",
|
||||
"creation": "2013-03-05 10:14:59",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:activity_type",
|
||||
"creation": "2013-03-05 10:14:59",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "activity_type",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Activity Type",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "activity_type",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Activity Type",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "costing_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Default Costing Rate",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "billing_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Default Billing Rate",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-flag",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-18 13:05:23.608066",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Activity Type",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-flag",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Activity Type",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Projects User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Projects User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 0,
|
||||
],
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 4,
|
||||
"modified": "2015-08-12 08:51:43.620261",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Project",
|
||||
@@ -908,7 +908,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -46,8 +46,6 @@ class Project(Document):
|
||||
"""sync tasks and remove table"""
|
||||
if self.flags.dont_sync_tasks: return
|
||||
|
||||
|
||||
task_added_or_deleted = False
|
||||
task_names = []
|
||||
for t in self.tasks:
|
||||
if t.task_id:
|
||||
@@ -55,7 +53,6 @@ class Project(Document):
|
||||
else:
|
||||
task = frappe.new_doc("Task")
|
||||
task.project = self.name
|
||||
task_added_or_deleted = True
|
||||
|
||||
task.update({
|
||||
"subject": t.title,
|
||||
@@ -73,14 +70,15 @@ class Project(Document):
|
||||
# delete
|
||||
for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}):
|
||||
frappe.delete_doc("Task", t.name)
|
||||
task_added_or_deleted = True
|
||||
|
||||
if task_added_or_deleted:
|
||||
self.update_project()
|
||||
self.update_percent_complete()
|
||||
self.update_costing()
|
||||
|
||||
def update_project(self):
|
||||
self.update_percent_complete()
|
||||
self.update_costing()
|
||||
self.flags.dont_sync_tasks = True
|
||||
self.save()
|
||||
|
||||
def update_percent_complete(self):
|
||||
total = frappe.db.sql("""select count(*) from tabTask where project=%s""", self.name)[0][0]
|
||||
@@ -88,21 +86,34 @@ class Project(Document):
|
||||
completed = frappe.db.sql("""select count(*) from tabTask where
|
||||
project=%s and status in ('Closed', 'Cancelled')""", self.name)[0][0]
|
||||
|
||||
self.percent_complete = flt(completed) / total * 100
|
||||
self.percent_complete = flt(flt(completed) / total * 100, 2)
|
||||
|
||||
def update_costing(self):
|
||||
total_cost = frappe.db.sql("""select sum(ifnull(total_costing_amount, 0)) as costing_amount,
|
||||
sum(ifnull(total_billing_amount, 0)) as billing_amount, sum(ifnull(total_expense_claim, 0)) as expense_claim,
|
||||
min(act_start_date) as start_date, max(act_end_date) as end_date, sum(actual_time) as time
|
||||
from `tabTask` where project = %s""", self.name, as_dict=1)[0]
|
||||
from_time_log = frappe.db.sql("""select
|
||||
sum(ifnull(costing_amount, 0)) as costing_amount,
|
||||
sum(ifnull(billing_amount, 0)) as billing_amount,
|
||||
min(from_time) as start_date,
|
||||
max(to_time) as end_date,
|
||||
sum(hours) as time
|
||||
from `tabTime Log` where project = %s and docstatus = 1""", self.name, as_dict=1)[0]
|
||||
|
||||
from_expense_claim = frappe.db.sql("""select
|
||||
sum(ifnull(total_sanctioned_amount, 0)) as total_sanctioned_amount
|
||||
from `tabExpense Claim` where project = %s and approval_status='Approved'
|
||||
and docstatus = 1""",
|
||||
self.name, as_dict=1)[0]
|
||||
|
||||
self.actual_start_date = from_time_log.start_date
|
||||
self.actual_end_date = from_time_log.end_date
|
||||
|
||||
self.total_costing_amount = from_time_log.costing_amount
|
||||
self.total_billing_amount = from_time_log.billing_amount
|
||||
self.actual_time = from_time_log.time
|
||||
|
||||
self.total_expense_claim = from_expense_claim.total_sanctioned_amount
|
||||
|
||||
self.gross_margin = flt(self.total_billing_amount) - flt(self.total_costing_amount)
|
||||
|
||||
self.total_costing_amount = total_cost.costing_amount
|
||||
self.total_billing_amount = total_cost.billing_amount
|
||||
self.total_expense_claim = total_cost.expense_claim
|
||||
self.actual_start_date = total_cost.start_date
|
||||
self.actual_end_date = total_cost.end_date
|
||||
self.actual_time = total_cost.time
|
||||
self.gross_margin = flt(total_cost.billing_amount) - flt(total_cost.costing_amount)
|
||||
if self.total_billing_amount:
|
||||
self.per_gross_margin = (self.gross_margin / flt(self.total_billing_amount)) *100
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ frappe.listview_settings['Project'] = {
|
||||
filters:[["status","=", "Open"]],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.status=="Open" && doc.percent_complete) {
|
||||
return [__("{0}% Complete", [doc.percent_complete]), "orange", "percent_complete,>,0|status,=,Open"];
|
||||
return [__("{0}% Complete", [cint(doc.percent_complete)]), "orange", "percent_complete,>,0|status,=,Open"];
|
||||
} else {
|
||||
return [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status];
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 5,
|
||||
"modified": "2015-04-30 05:48:55.176993",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Task",
|
||||
@@ -690,7 +690,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -57,7 +57,7 @@ class Task(Document):
|
||||
|
||||
def update_time_and_costing(self):
|
||||
tl = frappe.db.sql("""select min(from_time) as start_date, max(to_time) as end_date,
|
||||
sum(billing_amount) as total_billing_amount, sum(costing_amount) as total_costing_amount,
|
||||
sum(billing_amount) as total_billing_amount, sum(costing_amount) as total_costing_amount,
|
||||
sum(hours) as time from `tabTime Log` where task = %s and docstatus=1"""
|
||||
,self.name, as_dict=1)[0]
|
||||
if self.status == "Open":
|
||||
@@ -70,10 +70,7 @@ class Task(Document):
|
||||
|
||||
def update_project(self):
|
||||
if self.project and not self.flags.from_project:
|
||||
project = frappe.get_doc("Project", self.project)
|
||||
project.flags.dont_sync_tasks = True
|
||||
project.update_project()
|
||||
project.save()
|
||||
frappe.get_doc("Project", self.project).update_project()
|
||||
|
||||
def check_recursion(self):
|
||||
if self.flags.ignore_recursion_check: return
|
||||
|
||||
@@ -26,21 +26,21 @@ class TestTimeLog(unittest.TestCase):
|
||||
prod_order.set_production_order_operations()
|
||||
prod_order.save()
|
||||
|
||||
time_log = make_time_log_test_record(for_manufacturing= 1, production_order= prod_order.name, qty= 1,
|
||||
time_log = make_time_log_test_record(for_manufacturing= 1, production_order= prod_order.name, qty= 1,
|
||||
employee= "_T-Employee-0003", do_not_save= True, simulate=1)
|
||||
|
||||
self.assertRaises(NotSubmittedError, time_log.save)
|
||||
|
||||
def test_time_log_on_holiday(self):
|
||||
prod_order = make_prod_order_test_record(item= "_Test FG Item 2", qty= 1,
|
||||
prod_order = make_prod_order_test_record(item= "_Test FG Item 2", qty= 1,
|
||||
planned_start_date= now(), do_not_save= True)
|
||||
prod_order.set_production_order_operations()
|
||||
prod_order.save()
|
||||
prod_order.submit()
|
||||
|
||||
time_log = make_time_log_test_record(from_time= "2013-02-01 10:00:00", to_time= "2013-02-01 20:00:00",
|
||||
for_manufacturing= 1, production_order= prod_order.name, qty= 1,
|
||||
operation= prod_order.operations[0].operation, operation_id= prod_order.operations[0].name,
|
||||
for_manufacturing= 1, production_order= prod_order.name, qty= 1,
|
||||
operation= prod_order.operations[0].operation, operation_id= prod_order.operations[0].name,
|
||||
workstation= "_Test Workstation 1", do_not_save= True)
|
||||
|
||||
self.assertRaises(WorkstationHolidayError , time_log.save)
|
||||
@@ -61,59 +61,81 @@ class TestTimeLog(unittest.TestCase):
|
||||
employee="_T-Employee-0006",do_not_save= True)
|
||||
self.assertRaises(NegativeHoursError, time_log.save)
|
||||
|
||||
def test_default_activity_cost(self):
|
||||
activity_type = frappe.get_doc("Activity Type", "_Test Activity Type")
|
||||
activity_type.billing_rate = 20
|
||||
activity_type.costing_rate = 15
|
||||
activity_type.save()
|
||||
|
||||
project_name = "_Test Project for Activity Type"
|
||||
|
||||
frappe.db.sql("delete from `tabTime Log` where project=%s or employee='_T-Employee-0002'", project_name)
|
||||
frappe.delete_doc("Project", project_name)
|
||||
project = frappe.get_doc({"doctype": "Project", "project_name": project_name}).insert()
|
||||
|
||||
make_time_log_test_record(employee="_T-Employee-0002", hours=2,
|
||||
activity_type = "_Test Activity Type", project = project.name)
|
||||
|
||||
project = frappe.get_doc("Project", project.name)
|
||||
self.assertTrue(project.total_costing_amount, 30)
|
||||
self.assertTrue(project.total_billing_amount, 40)
|
||||
|
||||
def test_total_activity_cost_for_project(self):
|
||||
frappe.db.sql("""delete from `tabTask` where project = "_Test Project 1" """)
|
||||
frappe.db.sql("""delete from `tabProject` where name = "_Test Project 1" """)
|
||||
|
||||
frappe.db.sql("""delete from `tabTime Log` where name = "_Test Project 1" """)
|
||||
|
||||
if not frappe.db.exists('Activity Cost', {"activity_type": "_Test Activity Type"}):
|
||||
activity_cost = frappe.get_doc({
|
||||
"doctype": "Activity Cost",
|
||||
"employee": "",
|
||||
"employee": "_T-Employee-0002",
|
||||
"activity_type": "_Test Activity Type",
|
||||
"billing_rate": 100,
|
||||
"costing_rate": 50
|
||||
})
|
||||
activity_cost.insert()
|
||||
|
||||
|
||||
frappe.get_doc({
|
||||
"project_name": "_Test Project 1",
|
||||
"doctype": "Project",
|
||||
"tasks" :
|
||||
[{ "title": "_Test Project Task 1", "status": "Open" }]
|
||||
}).save()
|
||||
|
||||
|
||||
task_name = frappe.db.get_value("Task",{"project": "_Test Project 1"})
|
||||
|
||||
time_log = make_time_log_test_record(employee="_T-Employee-0002", hours=2, task= task_name)
|
||||
|
||||
time_log = make_time_log_test_record(employee="_T-Employee-0002", hours=2,
|
||||
task=task_name)
|
||||
self.assertEqual(time_log.costing_rate, 50)
|
||||
self.assertEqual(time_log.costing_amount, 100)
|
||||
self.assertEqual(time_log.billing_rate, 100)
|
||||
self.assertEqual(time_log.billing_amount, 200)
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_billing_amount"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 200)
|
||||
|
||||
time_log2 = make_time_log_test_record(employee="_T-Employee-0003", hours=2, task= task_name)
|
||||
|
||||
time_log2 = make_time_log_test_record(employee="_T-Employee-0002",
|
||||
hours=2, task= task_name, from_time = now_datetime() + datetime.timedelta(hours= 3))
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_billing_amount"), 400)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 400)
|
||||
|
||||
|
||||
time_log2.cancel()
|
||||
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_billing_amount"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 200)
|
||||
time_log.cancel()
|
||||
|
||||
|
||||
test_ignore = ["Time Log Batch", "Sales Invoice"]
|
||||
|
||||
def make_time_log_test_record(**args):
|
||||
args = frappe._dict(args)
|
||||
|
||||
time_log = frappe.new_doc("Time Log")
|
||||
|
||||
|
||||
time_log.from_time = args.from_time or now_datetime()
|
||||
time_log.hours = args.hours or 1
|
||||
time_log.to_time = args.to_time or time_log.from_time + datetime.timedelta(hours= time_log.hours)
|
||||
|
||||
|
||||
time_log.project = args.project
|
||||
time_log.task = args.task
|
||||
time_log.for_manufacturing = args.for_manufacturing
|
||||
@@ -126,7 +148,7 @@ def make_time_log_test_record(**args):
|
||||
time_log.billable = args.billable or 1
|
||||
time_log.employee = args.employee
|
||||
time_log.user = args.user
|
||||
|
||||
|
||||
if not args.do_not_save:
|
||||
if args.simulate:
|
||||
while True:
|
||||
@@ -141,4 +163,4 @@ def make_time_log_test_record(**args):
|
||||
if not args.do_not_submit:
|
||||
time_log.submit()
|
||||
|
||||
return time_log
|
||||
return time_log
|
||||
|
||||
@@ -17,6 +17,8 @@ frappe.ui.form.on("Time Log", "refresh", function(frm) {
|
||||
if (frm.doc.__islocal && !frm.doc.user) {
|
||||
frm.set_value("user", user);
|
||||
}
|
||||
|
||||
frm.toggle_reqd("activity_type", !frm.doc.for_manufacturing);
|
||||
});
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,16 +26,16 @@ class TimeLog(Document):
|
||||
self.check_workstation_timings()
|
||||
self.validate_production_order()
|
||||
self.validate_manufacturing()
|
||||
self.validate_task()
|
||||
self.set_project_if_missing()
|
||||
self.update_cost()
|
||||
|
||||
def on_submit(self):
|
||||
self.update_production_order()
|
||||
self.update_task()
|
||||
self.update_task_and_project()
|
||||
|
||||
def on_cancel(self):
|
||||
self.update_production_order()
|
||||
self.update_task()
|
||||
self.update_task_and_project()
|
||||
|
||||
def before_update_after_submit(self):
|
||||
self.set_status()
|
||||
@@ -57,14 +57,17 @@ class TimeLog(Document):
|
||||
self.status="Billed"
|
||||
|
||||
def set_title(self):
|
||||
"""Set default title for the Time Log"""
|
||||
if self.title:
|
||||
return
|
||||
|
||||
from frappe.utils import get_fullname
|
||||
if self.production_order:
|
||||
self.title = _("{0} for {1}").format(self.operation, self.production_order)
|
||||
elif self.task:
|
||||
self.title = _("{0} for {1}").format(self.activity_type, self.task)
|
||||
elif self.project:
|
||||
self.title = _("{0} for {1}").format(self.activity_type, self.project)
|
||||
elif self.activity_type and (self.task or self.project):
|
||||
self.title = _("{0} for {1}").format(self.activity_type, self.task or self.project)
|
||||
else:
|
||||
self.title = self.activity_type
|
||||
self.title = self.task or self.project or get_fullname(frappe.session.user)
|
||||
|
||||
def validate_overlap(self):
|
||||
"""Checks if 'Time Log' entries overlap for a user, workstation. """
|
||||
@@ -111,6 +114,11 @@ class TimeLog(Document):
|
||||
from frappe.utils import time_diff_in_seconds
|
||||
self.hours = flt(time_diff_in_seconds(self.to_time, self.from_time)) / 3600
|
||||
|
||||
def set_project_if_missing(self):
|
||||
"""Set project if task is set"""
|
||||
if self.task and not self.project:
|
||||
self.project = frappe.db.get_value("Task", self.task, "project")
|
||||
|
||||
def validate_time_log_for(self):
|
||||
if not self.for_manufacturing:
|
||||
for fld in ["production_order", "operation", "workstation", "completed_qty"]:
|
||||
@@ -221,25 +229,26 @@ class TimeLog(Document):
|
||||
def update_cost(self):
|
||||
rate = get_activity_cost(self.employee, self.activity_type)
|
||||
if rate:
|
||||
self.costing_rate = rate.get('costing_rate')
|
||||
self.billing_rate = rate.get('billing_rate')
|
||||
self.costing_rate = flt(rate.get('costing_rate'))
|
||||
self.billing_rate = flt(rate.get('billing_rate'))
|
||||
self.costing_amount = self.costing_rate * self.hours
|
||||
if self.billable:
|
||||
self.billing_amount = self.billing_rate * self.hours
|
||||
else:
|
||||
self.billing_amount = 0
|
||||
|
||||
def validate_task(self):
|
||||
# if a time log is being created against a project without production order
|
||||
if (self.project and not self.production_order) and not self.task:
|
||||
frappe.throw(_("Task is Mandatory if Time Log is against a project"))
|
||||
def update_task_and_project(self):
|
||||
"""Update costing rate in Task or Project if either is set"""
|
||||
|
||||
def update_task(self):
|
||||
if self.task and frappe.db.exists("Task", self.task):
|
||||
if self.task:
|
||||
task = frappe.get_doc("Task", self.task)
|
||||
task.update_time_and_costing()
|
||||
task.save()
|
||||
|
||||
elif self.project:
|
||||
frappe.get_doc("Project", self.project).update_project()
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_events(start, end, filters=None):
|
||||
"""Returns events for Gantt / Calendar view rendering.
|
||||
@@ -270,9 +279,10 @@ def get_events(start, end, filters=None):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_activity_cost(employee=None, activity_type=None):
|
||||
rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where employee= %s
|
||||
and activity_type= %s""", (employee, activity_type), as_dict=1)
|
||||
rate = frappe.db.get_values("Activity Cost", {"employee": employee,
|
||||
"activity_type": activity_type}, ["costing_rate", "billing_rate"], as_dict=True)
|
||||
if not rate:
|
||||
rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where ifnull(employee, '')=''
|
||||
and activity_type= %s""", (activity_type), as_dict=1)
|
||||
rate = frappe.db.get_values("Activity Type", {"activity_type": activity_type},
|
||||
["costing_rate", "billing_rate"], as_dict=True)
|
||||
|
||||
return rate[0] if rate else {}
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-04-15 08:00:52.746961",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Time Log Batch",
|
||||
@@ -269,7 +269,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:35.510179",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Campaign",
|
||||
@@ -139,7 +139,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -796,7 +796,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-25 07:09:26.411627",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Customer",
|
||||
@@ -804,7 +804,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
@@ -964,7 +964,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -10,6 +10,7 @@ from frappe.utils import flt
|
||||
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
from erpnext.utilities.address_and_contact import load_address_and_contact
|
||||
from frappe.desk.reportview import build_match_conditions
|
||||
|
||||
class Customer(TransactionBase):
|
||||
def get_feed(self):
|
||||
@@ -146,11 +147,16 @@ def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
|
||||
else:
|
||||
fields = ["name", "customer_name", "customer_group", "territory"]
|
||||
|
||||
match_conditions = build_match_conditions("Customer")
|
||||
match_conditions = "and {}".format(match_conditions) if match_conditions else ""
|
||||
|
||||
return frappe.db.sql("""select %s from `tabCustomer` where docstatus < 2
|
||||
and (%s like %s or customer_name like %s) order by
|
||||
and (%s like %s or customer_name like %s)
|
||||
{match_conditions}
|
||||
order by
|
||||
case when name like %s then 0 else 1 end,
|
||||
case when customer_name like %s then 0 else 1 end,
|
||||
name, customer_name limit %s, %s""" %
|
||||
name, customer_name limit %s, %s""".format(match_conditions=match_conditions) %
|
||||
(", ".join(fields), searchfield, "%s", "%s", "%s", "%s", "%s", "%s"),
|
||||
("%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, start, page_len))
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:39.190793",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Industry Type",
|
||||
@@ -70,7 +70,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -549,7 +549,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-20 05:04:05.403625",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Installation Note",
|
||||
@@ -557,7 +557,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-03 11:23:26.263254",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Product Bundle",
|
||||
@@ -139,7 +139,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -159,7 +159,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
@@ -2553,7 +2553,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:28:35.983445",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order",
|
||||
@@ -2561,7 +2561,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -2601,7 +2601,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -2621,7 +2621,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2641,7 +2641,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2661,7 +2661,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -175,6 +175,10 @@ class SalesOrder(SellingController):
|
||||
self.update_prevdoc_status('cancel')
|
||||
|
||||
frappe.db.set(self, 'status', 'Cancelled')
|
||||
|
||||
def check_credit_limit(self):
|
||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||
check_credit_limit(self.customer, self.company)
|
||||
|
||||
def check_nextdoc_docstatus(self):
|
||||
# Checks Delivery Note
|
||||
|
||||
@@ -8,10 +8,16 @@ import unittest
|
||||
from erpnext.selling.doctype.sales_order.sales_order \
|
||||
import make_material_request, make_delivery_note, make_sales_invoice, WarehouseRequired
|
||||
|
||||
from frappe.tests.test_permissions import set_user_permission_doctypes
|
||||
|
||||
class TestSalesOrder(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
frappe.set_user("Administrator")
|
||||
|
||||
for role in ("Stock User", "Sales User"):
|
||||
set_user_permission_doctypes(doctype="Sales Order", role=role,
|
||||
apply_user_permissions=0, user_permission_doctypes=None)
|
||||
|
||||
def test_make_material_request(self):
|
||||
so = make_sales_order(do_not_submit=True)
|
||||
|
||||
@@ -187,6 +193,10 @@ class TestSalesOrder(unittest.TestCase):
|
||||
existing_reserved_qty_item2 + 20)
|
||||
|
||||
def test_warehouse_user(self):
|
||||
for role in ("Stock User", "Sales User"):
|
||||
set_user_permission_doctypes(doctype="Sales Order", role=role,
|
||||
apply_user_permissions=1, user_permission_doctypes=["Warehouse"])
|
||||
|
||||
frappe.permissions.add_user_permission("Warehouse", "_Test Warehouse 1 - _TC", "test@example.com")
|
||||
frappe.permissions.add_user_permission("Warehouse", "_Test Warehouse 2 - _TC1", "test2@example.com")
|
||||
frappe.permissions.add_user_permission("Company", "_Test Company 1", "test2@example.com")
|
||||
|
||||
@@ -7,7 +7,7 @@ frappe.pages["Sales Browser"].on_page_load = function(wrapper){
|
||||
single_column: true,
|
||||
});
|
||||
|
||||
wrapper.page.set_secondary_action(__('Refresh'), function() {
|
||||
wrapper.page.add_menu_item(__('Refresh'), function() {
|
||||
wrapper.make_tree();
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ erpnext.SalesChart = Class.extend({
|
||||
|
||||
me.page.set_primary_action(__("New"), function() {
|
||||
me.new_node();
|
||||
});
|
||||
}, "octicon octicon-plus");
|
||||
|
||||
this.tree = new frappe.ui.Tree({
|
||||
parent: $(parent),
|
||||
@@ -80,7 +80,8 @@ erpnext.SalesChart = Class.extend({
|
||||
condition: function(node) { return me.can_create && node.expandable; },
|
||||
click: function(node) {
|
||||
me.new_node();
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
label:__("Rename"),
|
||||
@@ -89,7 +90,8 @@ erpnext.SalesChart = Class.extend({
|
||||
frappe.model.rename_doc(me.ctype, node.label, function(new_name) {
|
||||
node.$a.html(new_name);
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
},
|
||||
{
|
||||
label:__("Delete"),
|
||||
@@ -98,7 +100,8 @@ erpnext.SalesChart = Class.extend({
|
||||
frappe.model.delete_doc(me.ctype, node.label, function() {
|
||||
node.parent.remove();
|
||||
});
|
||||
}
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:24.597639",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Brand",
|
||||
@@ -94,7 +94,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -114,7 +114,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -134,7 +134,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -154,7 +154,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -1092,7 +1092,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-14 02:23:45.064575",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Company",
|
||||
@@ -1120,7 +1120,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-03-23 14:45:09.645344",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Currency Exchange",
|
||||
@@ -113,7 +113,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -133,7 +133,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -153,7 +153,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-09 12:43:18.846143",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Customer Group",
|
||||
@@ -344,7 +344,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -430,7 +430,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2015-07-13 05:28:26.719060",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Item Group",
|
||||
@@ -458,7 +458,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -498,7 +498,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -518,7 +518,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -538,7 +538,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:42.732646",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Print Heading",
|
||||
@@ -94,7 +94,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -568,7 +568,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-19 09:26:41.397649",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Sales Partner",
|
||||
@@ -596,7 +596,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -320,7 +320,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:46.204837",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Sales Person",
|
||||
@@ -348,7 +348,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-24 17:35:22.087557",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Supplier Type",
|
||||
@@ -136,7 +136,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:25.035649",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Terms and Conditions",
|
||||
@@ -94,7 +94,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -114,7 +114,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -154,7 +154,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -174,7 +174,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -281,7 +281,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:25.602509",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Territory",
|
||||
@@ -330,7 +330,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -350,7 +350,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -370,7 +370,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:23.143040",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "UOM",
|
||||
@@ -112,7 +112,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -1,54 +1,56 @@
|
||||
from frappe import _
|
||||
|
||||
items = [
|
||||
_('Accounting'),
|
||||
_('Advertising'),
|
||||
_('Aerospace'),
|
||||
_('Agriculture'),
|
||||
_('Airline'),
|
||||
_('Apparel & Accessories'),
|
||||
_('Automotive'),
|
||||
_('Banking'),
|
||||
_('Biotechnology'),
|
||||
_('Broadcasting'),
|
||||
_('Brokerage'),
|
||||
_('Chemical'),
|
||||
_('Computer'),
|
||||
_('Consulting'),
|
||||
_('Consumer Products'),
|
||||
_('Cosmetics'),
|
||||
_('Defense'),
|
||||
_('Department Stores'),
|
||||
_('Education'),
|
||||
_('Electronics'),
|
||||
_('Energy'),
|
||||
_('Entertainment & Leisure'),
|
||||
_('Executive Search'),
|
||||
_('Financial Services'),
|
||||
_('Food, Beverage & Tobacco'),
|
||||
_('Grocery'),
|
||||
_('Health Care'),
|
||||
_('Internet Publishing'),
|
||||
_('Investment Banking'),
|
||||
_('Legal'),
|
||||
_('Manufacturing'),
|
||||
_('Motion Picture & Video'),
|
||||
_('Music'),
|
||||
_('Newspaper Publishers'),
|
||||
_('Online Auctions'),
|
||||
_('Pension Funds'),
|
||||
_('Pharmaceuticals'),
|
||||
_('Private Equity'),
|
||||
_('Publishing'),
|
||||
_('Real Estate'),
|
||||
_('Retail & Wholesale'),
|
||||
_('Securities & Commodity Exchanges'),
|
||||
_('Service'),
|
||||
_('Soap & Detergent'),
|
||||
_('Software'),
|
||||
_('Sports'),
|
||||
_('Technology'),
|
||||
_('Telecommunications'),
|
||||
_('Television'),
|
||||
_('Transportation'),
|
||||
_('Venture Capital')]
|
||||
def get_industry_types():
|
||||
return [
|
||||
_('Accounting'),
|
||||
_('Advertising'),
|
||||
_('Aerospace'),
|
||||
_('Agriculture'),
|
||||
_('Airline'),
|
||||
_('Apparel & Accessories'),
|
||||
_('Automotive'),
|
||||
_('Banking'),
|
||||
_('Biotechnology'),
|
||||
_('Broadcasting'),
|
||||
_('Brokerage'),
|
||||
_('Chemical'),
|
||||
_('Computer'),
|
||||
_('Consulting'),
|
||||
_('Consumer Products'),
|
||||
_('Cosmetics'),
|
||||
_('Defense'),
|
||||
_('Department Stores'),
|
||||
_('Education'),
|
||||
_('Electronics'),
|
||||
_('Energy'),
|
||||
_('Entertainment & Leisure'),
|
||||
_('Executive Search'),
|
||||
_('Financial Services'),
|
||||
_('Food, Beverage & Tobacco'),
|
||||
_('Grocery'),
|
||||
_('Health Care'),
|
||||
_('Internet Publishing'),
|
||||
_('Investment Banking'),
|
||||
_('Legal'),
|
||||
_('Manufacturing'),
|
||||
_('Motion Picture & Video'),
|
||||
_('Music'),
|
||||
_('Newspaper Publishers'),
|
||||
_('Online Auctions'),
|
||||
_('Pension Funds'),
|
||||
_('Pharmaceuticals'),
|
||||
_('Private Equity'),
|
||||
_('Publishing'),
|
||||
_('Real Estate'),
|
||||
_('Retail & Wholesale'),
|
||||
_('Securities & Commodity Exchanges'),
|
||||
_('Service'),
|
||||
_('Soap & Detergent'),
|
||||
_('Software'),
|
||||
_('Sports'),
|
||||
_('Technology'),
|
||||
_('Telecommunications'),
|
||||
_('Television'),
|
||||
_('Transportation'),
|
||||
_('Venture Capital')
|
||||
]
|
||||
|
||||
@@ -3,163 +3,165 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
items = [
|
||||
_("Centrifugal casting"),
|
||||
_("Continuous casting"),
|
||||
_("Die casting"),
|
||||
_("Evaporative-pattern casting"),
|
||||
_("Full-mold casting"),
|
||||
_("Lost-foam casting"),
|
||||
_("Investment casting"),
|
||||
_("Countergravity casting"),
|
||||
_("Permanent mold casting"),
|
||||
_("Resin casting"),
|
||||
_("Sand casting"),
|
||||
_("Shell molding"),
|
||||
_("Spray forming"),
|
||||
_("Vacuum molding"),
|
||||
_("Molding"),
|
||||
_("Compaction plus sintering"),
|
||||
_("Hot isostatic pressing"),
|
||||
_("Metal injection molding"),
|
||||
_("Injection molding"),
|
||||
_("Compression molding"),
|
||||
_("Blow molding"),
|
||||
_("Dip molding"),
|
||||
_("Rotational molding"),
|
||||
_("Thermoforming"),
|
||||
_("Laminating"),
|
||||
_("Shrink fitting"),
|
||||
_("Shrink wrapping"),
|
||||
_("End tube forming"),
|
||||
_("Tube beading"),
|
||||
_("Forging"),
|
||||
_("Rolling"),
|
||||
_("Cold rolling"),
|
||||
_("Hot rolling"),
|
||||
_("Cryorolling"),
|
||||
_("Cross-rolling"),
|
||||
_("Pressing"),
|
||||
_("Embossing"),
|
||||
_("Stretch forming"),
|
||||
_("Blanking"),
|
||||
_("Drawing"),
|
||||
_("Bulging"),
|
||||
_("Necking"),
|
||||
_("Nosing"),
|
||||
_("Deep drawing"),
|
||||
_("Bending"),
|
||||
_("Hemming"),
|
||||
_("Shearing"),
|
||||
_("Piercing"),
|
||||
_("Trimming"),
|
||||
_("Shaving"),
|
||||
_("Notching"),
|
||||
_("Perforating"),
|
||||
_("Nibbling"),
|
||||
_("Lancing"),
|
||||
_("Cutting"),
|
||||
_("Stamping"),
|
||||
_("Coining"),
|
||||
_("Straight shearing"),
|
||||
_("Slitting"),
|
||||
_("Redrawing"),
|
||||
_("Ironing"),
|
||||
_("Flattening"),
|
||||
_("Swaging"),
|
||||
_("Spinning"),
|
||||
_("Peening"),
|
||||
_("Explosive forming"),
|
||||
_("Electroforming"),
|
||||
_("Staking"),
|
||||
_("Seaming"),
|
||||
_("Flanging"),
|
||||
_("Straightening"),
|
||||
_("Decambering"),
|
||||
_("Cold sizing"),
|
||||
_("Hubbing"),
|
||||
_("Hot metal gas forming"),
|
||||
_("Curling"),
|
||||
_("Hydroforming"),
|
||||
_("Machining"),
|
||||
_("Milling"),
|
||||
_("Hammering"),
|
||||
_("Smelting"),
|
||||
_("Refining"),
|
||||
_("Annealing"),
|
||||
_("Pickling"),
|
||||
_("Coating"),
|
||||
_("Turning"),
|
||||
_("Facing"),
|
||||
_("Boring"),
|
||||
_("Knurling"),
|
||||
_("Hard turning"),
|
||||
_("Drilling"),
|
||||
_("Reaming"),
|
||||
_("Countersinking"),
|
||||
_("Tapping"),
|
||||
_("Sawing"),
|
||||
_("Filing"),
|
||||
_("Broaching"),
|
||||
_("Shaping"),
|
||||
_("Planing"),
|
||||
_("Double housing"),
|
||||
_("Abrasive jet machining"),
|
||||
_("Water jet cutting"),
|
||||
_("Photochemical machining"),
|
||||
_("Honing"),
|
||||
_("Electro-chemical grinding"),
|
||||
_("Finishing & industrial finishing"),
|
||||
_("Abrasive blasting"),
|
||||
_("Buffing"),
|
||||
_("Burnishing"),
|
||||
_("Electroplating"),
|
||||
_("Electropolishing"),
|
||||
_("Magnetic field-assisted finishing"),
|
||||
_("Etching"),
|
||||
_("Linishing"),
|
||||
_("Mass finishing"),
|
||||
_("Tumbling"),
|
||||
_("Spindle finishing"),
|
||||
_("Vibratory finishing"),
|
||||
_("Plating"),
|
||||
_("Polishing"),
|
||||
_("Superfinishing"),
|
||||
_("Wire brushing"),
|
||||
_("Routing"),
|
||||
_("Hobbing"),
|
||||
_("Ultrasonic machining"),
|
||||
_("Electron beam machining"),
|
||||
_("Electrochemical machining"),
|
||||
_("Laser cutting"),
|
||||
_("Laser drilling"),
|
||||
_("Grinding"),
|
||||
_("Gashing"),
|
||||
_("Biomachining"),
|
||||
_("Joining"),
|
||||
_("Welding"),
|
||||
_("Brazing"),
|
||||
_("Sintering"),
|
||||
_("Adhesive bonding"),
|
||||
_("Nailing"),
|
||||
_("Screwing"),
|
||||
_("Riveting"),
|
||||
_("Clinching"),
|
||||
_("Pinning"),
|
||||
_("Stitching"),
|
||||
_("Stapling"),
|
||||
_("Press fitting"),
|
||||
_("3D printing"),
|
||||
_("Direct metal laser sintering"),
|
||||
_("Fused deposition modeling"),
|
||||
_("Laminated object manufacturing"),
|
||||
_("Laser engineered net shaping"),
|
||||
_("Selective laser sintering"),
|
||||
_("Mining"),
|
||||
_("Quarrying"),
|
||||
_("Blasting"),
|
||||
_("Woodworking"),
|
||||
_("Lapping"),
|
||||
_("Morticing"),
|
||||
_("Crushing"),
|
||||
_("Packaging and labeling")]
|
||||
def get_operations():
|
||||
return [
|
||||
_("Centrifugal casting"),
|
||||
_("Continuous casting"),
|
||||
_("Die casting"),
|
||||
_("Evaporative-pattern casting"),
|
||||
_("Full-mold casting"),
|
||||
_("Lost-foam casting"),
|
||||
_("Investment casting"),
|
||||
_("Countergravity casting"),
|
||||
_("Permanent mold casting"),
|
||||
_("Resin casting"),
|
||||
_("Sand casting"),
|
||||
_("Shell molding"),
|
||||
_("Spray forming"),
|
||||
_("Vacuum molding"),
|
||||
_("Molding"),
|
||||
_("Compaction plus sintering"),
|
||||
_("Hot isostatic pressing"),
|
||||
_("Metal injection molding"),
|
||||
_("Injection molding"),
|
||||
_("Compression molding"),
|
||||
_("Blow molding"),
|
||||
_("Dip molding"),
|
||||
_("Rotational molding"),
|
||||
_("Thermoforming"),
|
||||
_("Laminating"),
|
||||
_("Shrink fitting"),
|
||||
_("Shrink wrapping"),
|
||||
_("End tube forming"),
|
||||
_("Tube beading"),
|
||||
_("Forging"),
|
||||
_("Rolling"),
|
||||
_("Cold rolling"),
|
||||
_("Hot rolling"),
|
||||
_("Cryorolling"),
|
||||
_("Cross-rolling"),
|
||||
_("Pressing"),
|
||||
_("Embossing"),
|
||||
_("Stretch forming"),
|
||||
_("Blanking"),
|
||||
_("Drawing"),
|
||||
_("Bulging"),
|
||||
_("Necking"),
|
||||
_("Nosing"),
|
||||
_("Deep drawing"),
|
||||
_("Bending"),
|
||||
_("Hemming"),
|
||||
_("Shearing"),
|
||||
_("Piercing"),
|
||||
_("Trimming"),
|
||||
_("Shaving"),
|
||||
_("Notching"),
|
||||
_("Perforating"),
|
||||
_("Nibbling"),
|
||||
_("Lancing"),
|
||||
_("Cutting"),
|
||||
_("Stamping"),
|
||||
_("Coining"),
|
||||
_("Straight shearing"),
|
||||
_("Slitting"),
|
||||
_("Redrawing"),
|
||||
_("Ironing"),
|
||||
_("Flattening"),
|
||||
_("Swaging"),
|
||||
_("Spinning"),
|
||||
_("Peening"),
|
||||
_("Explosive forming"),
|
||||
_("Electroforming"),
|
||||
_("Staking"),
|
||||
_("Seaming"),
|
||||
_("Flanging"),
|
||||
_("Straightening"),
|
||||
_("Decambering"),
|
||||
_("Cold sizing"),
|
||||
_("Hubbing"),
|
||||
_("Hot metal gas forming"),
|
||||
_("Curling"),
|
||||
_("Hydroforming"),
|
||||
_("Machining"),
|
||||
_("Milling"),
|
||||
_("Hammering"),
|
||||
_("Smelting"),
|
||||
_("Refining"),
|
||||
_("Annealing"),
|
||||
_("Pickling"),
|
||||
_("Coating"),
|
||||
_("Turning"),
|
||||
_("Facing"),
|
||||
_("Boring"),
|
||||
_("Knurling"),
|
||||
_("Hard turning"),
|
||||
_("Drilling"),
|
||||
_("Reaming"),
|
||||
_("Countersinking"),
|
||||
_("Tapping"),
|
||||
_("Sawing"),
|
||||
_("Filing"),
|
||||
_("Broaching"),
|
||||
_("Shaping"),
|
||||
_("Planing"),
|
||||
_("Double housing"),
|
||||
_("Abrasive jet machining"),
|
||||
_("Water jet cutting"),
|
||||
_("Photochemical machining"),
|
||||
_("Honing"),
|
||||
_("Electro-chemical grinding"),
|
||||
_("Finishing & industrial finishing"),
|
||||
_("Abrasive blasting"),
|
||||
_("Buffing"),
|
||||
_("Burnishing"),
|
||||
_("Electroplating"),
|
||||
_("Electropolishing"),
|
||||
_("Magnetic field-assisted finishing"),
|
||||
_("Etching"),
|
||||
_("Linishing"),
|
||||
_("Mass finishing"),
|
||||
_("Tumbling"),
|
||||
_("Spindle finishing"),
|
||||
_("Vibratory finishing"),
|
||||
_("Plating"),
|
||||
_("Polishing"),
|
||||
_("Superfinishing"),
|
||||
_("Wire brushing"),
|
||||
_("Routing"),
|
||||
_("Hobbing"),
|
||||
_("Ultrasonic machining"),
|
||||
_("Electron beam machining"),
|
||||
_("Electrochemical machining"),
|
||||
_("Laser cutting"),
|
||||
_("Laser drilling"),
|
||||
_("Grinding"),
|
||||
_("Gashing"),
|
||||
_("Biomachining"),
|
||||
_("Joining"),
|
||||
_("Welding"),
|
||||
_("Brazing"),
|
||||
_("Sintering"),
|
||||
_("Adhesive bonding"),
|
||||
_("Nailing"),
|
||||
_("Screwing"),
|
||||
_("Riveting"),
|
||||
_("Clinching"),
|
||||
_("Pinning"),
|
||||
_("Stitching"),
|
||||
_("Stapling"),
|
||||
_("Press fitting"),
|
||||
_("3D printing"),
|
||||
_("Direct metal laser sintering"),
|
||||
_("Fused deposition modeling"),
|
||||
_("Laminated object manufacturing"),
|
||||
_("Laser engineered net shaping"),
|
||||
_("Selective laser sintering"),
|
||||
_("Mining"),
|
||||
_("Quarrying"),
|
||||
_("Blasting"),
|
||||
_("Woodworking"),
|
||||
_("Lapping"),
|
||||
_("Morticing"),
|
||||
_("Crushing"),
|
||||
_("Packaging and labeling")
|
||||
]
|
||||
|
||||
@@ -177,9 +177,9 @@ def install(country=None):
|
||||
{'doctype': "Print Heading", 'print_heading': _("Debit Note")}
|
||||
]
|
||||
|
||||
from erpnext.setup.page.setup_wizard.fixtures import industry_type
|
||||
records += [{"doctype":"Industry Type", "industry": d} for d in industry_type.items]
|
||||
# records += [{"doctype":"Operation", "operation": d} for d in operations.items]
|
||||
from erpnext.setup.page.setup_wizard.fixtures.industry_type import get_industry_types
|
||||
records += [{"doctype":"Industry Type", "industry": d} for d in get_industry_types()]
|
||||
# records += [{"doctype":"Operation", "operation": d} for d in get_operations()]
|
||||
|
||||
from frappe.modules import scrub
|
||||
for r in records:
|
||||
|
||||
@@ -109,7 +109,8 @@ def setup_account(args=None):
|
||||
def update_user_name(args):
|
||||
if args.get("email"):
|
||||
args['name'] = args.get("email")
|
||||
frappe.flags.mute_emails = True
|
||||
|
||||
_mute_emails, frappe.flags.mute_emails = frappe.flags.mute_emails, True
|
||||
doc = frappe.get_doc({
|
||||
"doctype":"User",
|
||||
"email": args.get("email"),
|
||||
@@ -118,7 +119,7 @@ def update_user_name(args):
|
||||
})
|
||||
doc.flags.no_welcome_mail = True
|
||||
doc.insert()
|
||||
frappe.flags.mute_emails = False
|
||||
frappe.flags.mute_emails = _mute_emails
|
||||
from frappe.auth import _update_password
|
||||
_update_password(args.get("email"), args.get("password"))
|
||||
|
||||
@@ -223,6 +224,7 @@ def set_defaults(args):
|
||||
stock_settings.stock_uom = _("Nos")
|
||||
stock_settings.auto_indent = 1
|
||||
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
||||
stock_settings.automatically_set_serial_nos_based_on_fifo = 1
|
||||
stock_settings.save()
|
||||
|
||||
selling_settings = frappe.get_doc("Selling Settings")
|
||||
|
||||
@@ -323,7 +323,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:24.087304",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Bin",
|
||||
@@ -331,7 +331,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -351,7 +351,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -371,7 +371,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -2438,7 +2438,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:29:47.032037",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note",
|
||||
@@ -2446,7 +2446,7 @@
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -2486,7 +2486,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -2506,7 +2506,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2526,7 +2526,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -214,6 +214,17 @@ class DeliveryNote(SellingController):
|
||||
self.cancel_packing_slips()
|
||||
|
||||
self.make_gl_entries_on_cancel()
|
||||
|
||||
def check_credit_limit(self):
|
||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||
|
||||
validate_against_credit_limit = False
|
||||
for d in self.get("items"):
|
||||
if not (d.against_sales_order or d.against_sales_invoice):
|
||||
validate_against_credit_limit = True
|
||||
break
|
||||
if validate_against_credit_limit:
|
||||
check_credit_limit(self.customer, self.company)
|
||||
|
||||
def validate_packed_qty(self):
|
||||
"""
|
||||
|
||||
@@ -2090,7 +2090,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"modified": "2015-08-25 08:31:05.907086",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
@@ -2138,7 +2138,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2158,7 +2158,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2178,7 +2178,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2198,7 +2198,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2218,7 +2218,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
@@ -2238,7 +2238,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
|
||||
@@ -510,7 +510,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 03:40:16.238465",
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Material Request",
|
||||
@@ -558,7 +558,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
@@ -578,7 +578,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user