Patch to delete previous report

This commit is contained in:
Kanchan Chauhan 2016-07-15 14:06:20 +05:30
commit 9846b945d9
56 changed files with 425 additions and 183 deletions

View File

@ -47,7 +47,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(doc.docstatus===0) {
cur_frm.add_custom_button(__('Purchase Order'), function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
source_doctype: "Purchase Order",
get_query_filters: {
@ -61,7 +61,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
}, __("Get items from"));
cur_frm.add_custom_button(__('Purchase Receipt'), function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
source_doctype: "Purchase Receipt",
get_query_filters: {

View File

@ -101,7 +101,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
sales_order_btn: function() {
this.$sales_order_btn = cur_frm.add_custom_button(__('Sales Order'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
source_doctype: "Sales Order",
get_query_filters: {
@ -118,7 +118,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
delivery_note_btn: function() {
this.$delivery_note_btn = cur_frm.add_custom_button(__('Delivery Note'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
source_doctype: "Delivery Note",
get_query: function() {

View File

@ -8,43 +8,43 @@ from frappe.utils import nowdate, getdate
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
data = get_entries(filters)
return columns, data
def get_columns():
return [
_("Payment Document") + ":Link/DocType:130",
_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
_("Posting Date") + ":Date:100",
_("Payment Document") + ":Link/DocType:130",
_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
_("Posting Date") + ":Date:100",
_("Cheque/Reference No") + "::120",
_("Clearance Date") + ":Date:100",
_("Against Account") + ":Link/Account:170",
_("Clearance Date") + ":Date:100",
_("Against Account") + ":Link/Account:170",
_("Amount") + ":Currency:120"
]
def get_conditions(filters):
conditions = ""
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
return conditions
def get_entries(filters):
conditions = get_conditions(filters)
journal_entries = frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date,
journal_entries = frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date,
jv.cheque_no, jv.clearance_date, jvd.against_account, (jvd.debit - jvd.credit)
from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
where jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0}
order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1)
payment_entries = frappe.db.sql("""select "Payment Entry", name, posting_date,
payment_entries = frappe.db.sql("""select "Payment Entry", name, posting_date,
reference_no, clearance_date, party, if(paid_from=%(account)s, paid_amount, received_amount)
from `tabPayment Entry`
where docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0}
order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1, debug=1)
order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1)
return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))

View File

@ -2,7 +2,8 @@
// License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Profit and Loss Statement"] = $.extend({}, erpnext.financial_statements);
frappe.query_reports["Profit and Loss Statement"] = $.extend({},
erpnext.financial_statements);
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
"fieldname": "accumulated_values",

View File

@ -87,7 +87,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
},
get_items_from_open_material_requests: function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier",
source_name: this.frm.doc.supplier,
get_query_filters: {
@ -150,7 +150,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
add_from_mappers: function() {
cur_frm.add_custom_button(__('Material Request'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
source_doctype: "Material Request",
get_query_filters: {
@ -165,7 +165,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.add_custom_button(__('Supplier Quotation'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
source_doctype: "Supplier Quotation",
get_query_filters: {

View File

@ -135,7 +135,7 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Material Request'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_request_for_quotation",
source_doctype: "Material Request",
get_query_filters: {

View File

@ -15,7 +15,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
else if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Material Request'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
source_doctype: "Material Request",
get_query_filters: {

View File

@ -28,16 +28,14 @@ def get_variant(template, args, variant=None):
return find_variant(template, args, variant)
def validate_item_variant_attributes(item, args):
attribute_values = {}
for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"],
filters={"parent": ["in", args.keys()]}):
def validate_item_variant_attributes(item, args=None):
if not args:
args = {d.attribute.lower():d.attribute_value for d in item.attributes}
(attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
attribute_values = get_attribute_values()
numeric_attributes = frappe._dict((t.attribute.lower(), t) for t in \
frappe.db.sql("""select attribute, from_range, to_range, increment from `tabItem Variant Attribute`
where parent = %s and numeric_values=1""", (item), as_dict=1))
numeric_attributes = frappe._dict({d.attribute.lower(): d for d
in item.attributes if d.numeric_values==1})
for attribute, value in args.items():
if attribute.lower() in numeric_attributes:
@ -56,7 +54,7 @@ def validate_item_variant_attributes(item, args):
#avoid precision error by rounding the remainder
remainder = flt((flt(value) - from_range) % increment, precision)
is_incremental = remainder==0 or remainder==0 or remainder==increment
is_incremental = remainder==0 or remainder==increment
if not (is_in_range and is_incremental):
frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}")\
@ -66,6 +64,16 @@ def validate_item_variant_attributes(item, args):
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format(
value, attribute), InvalidItemAttributeValueError)
def get_attribute_values():
if not frappe.flags.attribute_values:
attribute_values = {}
for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"]):
(attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
frappe.flags.attribute_values = attribute_values
return frappe.flags.attribute_values
def find_variant(template, args, variant_item_code=None):
conditions = ["""(iv_attribute.attribute="{0}" and iv_attribute.attribute_value="{1}")"""\
.format(frappe.db.escape(key), frappe.db.escape(cstr(value))) for key, value in args.items()]

View File

@ -128,7 +128,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
cur_frm.cscript.lead = function(doc, cdt, cdn) {
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
source_name: cur_frm.doc.lead,
frm: cur_frm

View File

@ -4,7 +4,7 @@ import frappe, sys
import erpnext
import frappe.utils
from erpnext.demo.setup_data import setup_data
from erpnext.demo.user import hr, sales, purchase, manufacturing, stock
from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts
"""
Make a demo
@ -68,8 +68,7 @@ def simulate():
purchase.work()
manufacturing.work()
stock.work()
# run_stock()
# run_accounts()
accounts.work()
# run_projects()
# run_messages()

View File

@ -330,6 +330,6 @@ def setup_user_roles():
if not frappe.db.get_global('demo_accounts_user'):
user = frappe.get_doc('User', 'LeonAbdulov@example.com')
user.add_roles('Accounts User', 'Accounts Manager')
user.add_roles('Accounts User', 'Accounts Manager', 'Sales User', 'Purchase User')
frappe.db.set_global('demo_accounts_user', user.name)

View File

@ -15,8 +15,7 @@ def work():
if random.random() < 0.5:
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
report = "Ordered Items to be Billed"
for so in list(set([r[0] for r in
query_report.run(report)["result"]
for so in list(set([r[0] for r in query_report.run(report)["result"]
if r[0]!="Total"]))[:random.randint(1, 5)]:
si = frappe.get_doc(make_sales_invoice(so))
si.posting_date = frappe.flags.current_date

View File

@ -131,10 +131,13 @@ def make_subcontract():
po.is_subcontracted = "Yes"
po.supplier = get_random("Supplier")
item_code = get_random("Item", {"is_sub_contracted_item": 1})
moq = frappe.db.get_value('Item', item_code, 'min_order_qty')
po.append("items", {
"item_code": get_random("Item", {"is_sub_contracted_item": 1}),
"item_code": item_code,
"schedule_date": frappe.utils.add_days(frappe.flags.current_date, 7),
"qty": 20
"qty": moq
})
po.set_missing_values()
try:

View File

@ -13,7 +13,7 @@ ERPNext is a trademark of Frappe Technologies</p>
<p>Version 3, 29 June 2007</p>
<p>http://www.gnu.org/copyleft/gpl.html</p>
<p><a href="http://www.gnu.org/copyleft/gpl.html" rel="nofollow">http://www.gnu.org/copyleft/gpl.html</a></p>
<p>TERMS AND CONDITIONS
0. Definitions.</p>

View File

@ -24,7 +24,7 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
}
cur_frm.cscript.kra_template = function(doc, dt, dn) {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
source_name: cur_frm.doc.kra_template,
frm: cur_frm

View File

@ -32,8 +32,8 @@ frappe.ui.form.on('Salary Structure', {
},
toggle_fields: function(frm) {
frm.toggle_display('time_sheet_earning_detail', frm.doc.salary_slip_based_on_timesheet);
frm.toggle_reqd('salary_component', frm.doc.salary_slip_based_on_timesheet);
frm.toggle_display(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
frm.toggle_reqd(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
}
})

View File

@ -8,6 +8,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -349,6 +350,31 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "time_sheet_earning_detail",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -379,14 +405,13 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "time_sheet_earning_detail",
"fieldtype": "Section Break",
"fieldname": "column_break_17",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -428,30 +453,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_17",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -779,7 +780,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-07-02 18:04:06.529332",
"modified": "2016-07-13 23:56:01.550518",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Structure",

View File

@ -20,7 +20,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
if (this.frm.doc.docstatus === 0) {
this.frm.add_custom_button(__('Sales Order'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
source_doctype: "Sales Order",
get_query_filters: {

View File

@ -19,7 +19,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Maintenance Schedule'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
source_doctype: "Maintenance Schedule",
get_query_filters: {
@ -31,7 +31,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
}, __("Get items from"));
cur_frm.add_custom_button(__('Warranty Claim'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit",
source_doctype: "Warranty Claim",
get_query_filters: {
@ -43,7 +43,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
}, __("Get items from"));
cur_frm.add_custom_button(__('Sales Order'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
source_doctype: "Sales Order",
get_query_filters: {

View File

@ -293,4 +293,5 @@ erpnext.patches.v7_0.rename_time_sheet_doctype
execute:frappe.delete_doc_if_exists("Report", "Customers Not Buying Since Long Time")
erpnext.patches.v7_0.make_is_group_fieldtype_as_check
execute:frappe.reload_doc('projects', 'doctype', 'timesheet', force=True)
execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance")
execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance")

View File

@ -3,8 +3,7 @@ import frappe
from erpnext.manufacturing.doctype.production_order.production_order import make_timesheet, add_timesheet_detail
def execute():
if "note" not in frappe.db.get_table_columns("timesheet"):
frappe.reload_doc('projects', 'doctype', 'timesheet')
frappe.reload_doc('projects', 'doctype', 'timesheet')
for data in frappe.get_all('Time Log', fields=["*"],
filters = [["docstatus", "<", "2"]]):

View File

@ -0,0 +1,18 @@
from __future__ import unicode_literals
import frappe
def execute():
for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]:
# convert to 1 or 0
frappe.db.sql("update `tab{doctype}` set is_group = if(is_group='Yes',1,0) "
.format(doctype=doctype))
frappe.db.commit()
# alter fields to int
frappe.db.sql("alter table `tab{doctype}` change is_group is_group int(1) default '0'"
.format(doctype=doctype))
frappe.reload_doctype(doctype)

View File

@ -1,7 +1,7 @@
import frappe
def execute():
if frappe.db.table_exists("Time Sheet"):
if frappe.db.table_exists("Time Sheet") and not frappe.db.table_exists("Timesheet"):
frappe.rename_doc("DocType", "Time Sheet", "Timesheet")
frappe.rename_doc("DocType", "Time Sheet Detail", "Timesheet Detail")

View File

@ -86,28 +86,30 @@ def make_salary_structure(employee):
return salary_structure
def make_timesheet(employee, simulate=False, billable = 0):
update_activity_type("_Test Activity Type")
def make_timesheet(employee, simulate=False, billable = 0, activity_type="_Test Activity Type", project=None, task=None):
update_activity_type(activity_type)
timesheet = frappe.new_doc("Timesheet")
timesheet.employee = employee
timesheet_detail = timesheet.append('time_logs', {})
timesheet_detail.billable = billable
timesheet_detail.activity_type = "_Test Activity Type"
timesheet_detail.activity_type = activity_type
timesheet_detail.from_time = now_datetime()
timesheet_detail.hours = 2
timesheet_detail.to_time = timesheet_detail.from_time + datetime.timedelta(hours= timesheet_detail.hours)
timesheet_detail.project = project
timesheet_detail.task = task
for data in timesheet.get('time_logs'):
if simulate:
while True:
try:
timesheet.save()
timesheet.save(ignore_permissions=True)
break
except OverlapError:
data.from_time = data.from_time + datetime.timedelta(minutes=10)
data.to_time = data.from_time + datetime.timedelta(hours= data.hours)
else:
timesheet.save()
timesheet.save(ignore_permissions=True)
timesheet.submit()

View File

@ -1,5 +1,6 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
frappe.ui.form.on("Timesheet", {
setup: function(frm) {

View File

@ -225,8 +225,9 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "employee",
"fieldname": "employee_name",
"fieldtype": "Read Only",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@ -235,12 +236,12 @@
"label": "Employee Name",
"length": 0,
"no_copy": 0,
"options": "employee.employee_name",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -636,7 +637,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-07-13 01:18:57.918882",
"modified": "2016-07-13 23:44:05.086570",
"modified_by": "Administrator",
"module": "Projects",
"name": "Timesheet",
@ -661,6 +662,66 @@
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"apply_user_permissions": 0,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "HR User",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"apply_user_permissions": 0,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Manufacturing User",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Employee",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,

View File

@ -141,31 +141,34 @@ class Timesheet(Document):
def validate_overlap(self, data):
if self.production_order:
self.validate_overlap_for("workstation", data)
self.validate_overlap_for("workstation", data, data.workstation)
else:
self.validate_overlap_for("user", data)
self.validate_overlap_for("employee", data)
self.validate_overlap_for("user", data, self.user)
self.validate_overlap_for("employee", data, self.employee)
def validate_overlap_for(self, fieldname, args):
existing = self.get_overlap_for(fieldname, args)
def validate_overlap_for(self, fieldname, args, value):
if not value: return
existing = self.get_overlap_for(fieldname, args, value)
if existing:
frappe.throw(_("Row {0}: From Time and To Time overlap with existing from and to time").format(args.idx),
OverlapError)
def get_overlap_for(self, fieldname, args):
if not args.get(fieldname):
return
def get_overlap_for(self, fieldname, args, value):
cond = "ts.`{0}`".format(fieldname)
if fieldname == 'workstation':
cond = "tsd.`{0}`".format(fieldname)
existing = frappe.db.sql("""select ts.name as name, tsd.from_time as from_time, tsd.to_time as to_time from
`tabTimesheet Detail` tsd, `tabTimesheet` ts where tsd.`{0}`=%(val)s and tsd.parent = ts.name and
`tabTimesheet Detail` tsd, `tabTimesheet` ts where {0}=%(val)s and tsd.parent = ts.name and
(
(%(from_time)s > tsd.from_time and %(from_time)s < tsd.to_time) or
(%(to_time)s > tsd.from_time and %(to_time)s < tsd.to_time) or
(%(from_time)s <= tsd.from_time and %(to_time)s >= tsd.to_time))
and tsd.name!=%(name)s
and ts.docstatus < 2""".format(fieldname),
and ts.docstatus < 2""".format(cond),
{
"val": args.get(fieldname),
"val": value,
"from_time": args.from_time,
"to_time": args.to_time,
"name": args.name or "No Name"
@ -184,7 +187,7 @@ class Timesheet(Document):
if self.time_logs:
for data in self.time_logs:
if data.idx == index:
overlapping = self.get_overlap_for("workstation", data)
overlapping = self.get_overlap_for("workstation", data, data.workstation)
if not overlapping:
frappe.throw(_("Logical error: Must find overlapping"))

View File

@ -62,7 +62,7 @@ $.extend(erpnext.queries, {
},
not_a_group_filter: function() {
return { filters: { is_group: "No" } };
return { filters: { is_group: 0 } };
},
employee: function() {

View File

@ -120,6 +120,65 @@ $.extend(erpnext.utils, {
}
});
erpnext.utils.map_current_doc = function(opts) {
if(opts.get_query_filters) {
opts.get_query = function() {
return {filters: opts.get_query_filters};
}
}
var _map = function() {
// remove first item row if empty
if($.isArray(cur_frm.doc.items)) {
if(!cur_frm.doc.items[0].item_code) {
cur_frm.doc.items = cur_frm.doc.items.splice(1);
}
}
return frappe.call({
// Sometimes we hit the limit for URL length of a GET request
// as we send the full target_doc. Hence this is a POST request.
type: "POST",
method: opts.method,
args: {
"source_name": opts.source_name,
"target_doc": cur_frm.doc
},
callback: function(r) {
if(!r.exc) {
var doc = frappe.model.sync(r.message);
cur_frm.refresh();
}
}
});
}
if(opts.source_doctype) {
var d = new frappe.ui.Dialog({
title: __("Get From ") + __(opts.source_doctype),
fields: [
{
fieldtype: "Link",
label: __(opts.source_doctype),
fieldname: opts.source_doctype,
options: opts.source_doctype,
get_query: opts.get_query,
reqd:1
},
]
});
d.set_primary_action(__('Get Items'), function() {
var values = d.get_values();
if(!values)
return;
opts.source_name = values[opts.source_doctype];
d.hide();
_map();
})
d.show();
} else if(opts.source_name) {
_map();
}
}
// add description on posting time
$(document).on('app_ready', function() {
if(!frappe.datetime.is_timezone_same()) {

View File

@ -46,7 +46,7 @@ cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_
cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) {
return{
filters:{'is_group': 'No'}
filters:{'is_group': 0}
}
}

View File

@ -49,7 +49,7 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('From Delivery Note'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_installation_note",
source_doctype: "Delivery Note",
get_query_filters: {

View File

@ -29,7 +29,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Opportunity'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
source_doctype: "Opportunity",
get_query_filters: {

View File

@ -97,7 +97,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Quotation'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
source_doctype: "Quotation",
get_query_filters: {

View File

@ -20,7 +20,7 @@ cur_frm.cscript.set_root_readonly = function(doc) {
cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) {
return {
filters: {
'is_group': "Yes"
'is_group': 1
}
}
}

View File

@ -3,11 +3,13 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:customer_group_name",
"beta": 0,
"creation": "2013-01-10 16:34:23",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -17,6 +19,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Customer Group Name",
@ -26,6 +29,7 @@
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -42,6 +46,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Parent Customer Group",
@ -52,6 +57,7 @@
"options": "Customer Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -65,19 +71,21 @@
"collapsible": 0,
"description": "Only leaf nodes are allowed in transaction",
"fieldname": "is_group",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Has Child Node",
"label": "Is Group",
"length": 0,
"no_copy": 0,
"oldfieldname": "is_group",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -93,12 +101,14 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -114,6 +124,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Price List",
@ -122,6 +133,7 @@
"options": "Price List",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -137,6 +149,7 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Credit Days Based On",
@ -146,6 +159,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -162,6 +176,7 @@
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Credit Days",
@ -169,6 +184,7 @@
"no_copy": 0,
"permlevel": 1,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -184,6 +200,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Credit Limit",
@ -191,6 +208,7 @@
"no_copy": 0,
"permlevel": 1,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -206,6 +224,7 @@
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "lft",
@ -215,6 +234,7 @@
"oldfieldtype": "Int",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
@ -230,6 +250,7 @@
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "rgt",
@ -239,6 +260,7 @@
"oldfieldtype": "Int",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
@ -255,6 +277,7 @@
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "old_parent",
@ -265,6 +288,7 @@
"options": "Customer Group",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
@ -280,6 +304,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Receivable Account",
@ -287,6 +312,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -304,6 +330,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Accounts",
@ -312,6 +339,7 @@
"options": "Party Account",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -324,13 +352,14 @@
"hide_toolbar": 0,
"icon": "icon-sitemap",
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2015-11-16 06:29:44.374615",
"modified": "2016-07-14 12:43:08.949307",
"modified_by": "Administrator",
"module": "Setup",
"name": "Customer Group",
@ -457,7 +486,10 @@
"write": 0
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "parent_customer_group"
"search_fields": "parent_customer_group",
"sort_order": "DESC",
"track_seen": 0
}

View File

@ -2,13 +2,13 @@
{
"customer_group_name": "_Test Customer Group",
"doctype": "Customer Group",
"is_group": "No",
"is_group": 0,
"parent_customer_group": "All Customer Groups"
},
{
"customer_group_name": "_Test Customer Group 1",
"doctype": "Customer Group",
"is_group": "No",
"is_group": 0,
"parent_customer_group": "All Customer Groups"
}
]

View File

@ -9,7 +9,7 @@ frappe.ui.form.on("Item Group", {
frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
return{
filters:[
['Item Group', 'is_group', '=', 'Yes'],
['Item Group', 'is_group', '=', 1],
['Item Group', 'name', '!=', doc.item_group_name]
]
}

View File

@ -10,6 +10,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -95,18 +96,18 @@
"collapsible": 0,
"description": "Only leaf nodes are allowed in transaction",
"fieldname": "is_group",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Has Child Node",
"label": "Is Group",
"length": 0,
"no_copy": 0,
"oldfieldname": "is_group",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -461,7 +462,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 3,
"modified": "2016-06-23 14:44:46.228923",
"modified": "2016-07-14 12:41:09.269478",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",

View File

@ -1,68 +1,68 @@
[
{
"doctype": "Item Group",
"is_group": "No",
"is_group": 0,
"item_group_name": "_Test Item Group",
"parent_item_group": "All Item Groups",
"default_cost_center": "_Test Cost Center 2 - _TC"
},
{
"doctype": "Item Group",
"is_group": "No",
"is_group": 0,
"item_group_name": "_Test Item Group Desktops",
"parent_item_group": "All Item Groups"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group A",
"parent_item_group": "All Item Groups"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group B",
"parent_item_group": "All Item Groups"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group B - 1",
"parent_item_group": "_Test Item Group B"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group B - 2",
"parent_item_group": "_Test Item Group B"
},
{
"doctype": "Item Group",
"is_group": "No",
"is_group": 0,
"item_group_name": "_Test Item Group B - 3",
"parent_item_group": "_Test Item Group B"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group C",
"parent_item_group": "All Item Groups"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group C - 1",
"parent_item_group": "_Test Item Group C"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group C - 2",
"parent_item_group": "_Test Item Group C"
},
{
"doctype": "Item Group",
"is_group": "Yes",
"is_group": 1,
"item_group_name": "_Test Item Group D",
"parent_item_group": "All Item Groups"
}

View File

@ -15,6 +15,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, dt, dn) {
return{
filters:{ 'is_group': "No" }
filters:{ 'is_group': 0 }
}
}

View File

@ -20,7 +20,7 @@ cur_frm.cscript.set_root_readonly = function(doc) {
cur_frm.fields_dict['parent_sales_person'].get_query = function(doc, cdt, cdn) {
return{
filters: [
['Sales Person', 'is_group', '=', 'Yes'],
['Sales Person', 'is_group', '=', 1],
['Sales Person', 'name', '!=', doc.sales_person_name]
]
}

View File

@ -3,12 +3,14 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:sales_person_name",
"beta": 0,
"creation": "2013-01-10 16:34:24",
"custom": 0,
"description": "All Sales Transactions can be tagged against multiple **Sales Persons** so that you can set and monitor targets.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -18,6 +20,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Name and Employee ID",
@ -42,6 +45,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Sales Person Name",
@ -68,6 +72,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Parent Sales Person",
@ -91,17 +96,18 @@
"bold": 0,
"collapsible": 0,
"fieldname": "is_group",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Has Child Node",
"label": "Is Group",
"length": 0,
"no_copy": 0,
"oldfieldname": "is_group",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -120,6 +126,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -142,6 +149,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Employee",
@ -166,6 +174,7 @@
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "lft",
@ -191,6 +200,7 @@
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "rgt",
@ -216,6 +226,7 @@
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "old_parent",
@ -242,6 +253,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Person Targets",
@ -267,6 +279,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Targets",
@ -294,6 +307,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Target Distribution",
@ -317,13 +331,14 @@
"hide_toolbar": 0,
"icon": "icon-user",
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-01-06 02:36:22.551330",
"modified": "2016-07-14 12:44:43.408367",
"modified_by": "Administrator",
"module": "Setup",
"name": "Sales Person",
@ -390,7 +405,10 @@
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "parent_sales_person"
"search_fields": "parent_sales_person",
"sort_order": "ASC",
"track_seen": 0
}

View File

@ -5,7 +5,7 @@ frappe.treeview_settings["Sales Person"] = {
{fieldtype:'Link', fieldname:'employee',
label:__('Employee'), options:'Employee',
description: __("Please enter Employee Id of this sales person")},
{fieldtype:'Select', fieldname:'is_group', label:__('Group Node'), options:'No\nYes',
{fieldtype:'Check', fieldname:'is_group', label:__('Group Node'),
description: __("Further nodes can be only created under 'Group' type nodes")}
],
}

View File

@ -2,21 +2,21 @@
{
"doctype": "Sales Person",
"employee": "_T-Employee-0001",
"is_group": "No",
"is_group": 0,
"parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person"
},
{
"doctype": "Sales Person",
"employee": "_T-Employee-0002",
"is_group": "No",
"is_group": 0,
"parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person 1"
},
{
"doctype": "Sales Person",
"employee": "_T-Employee-0003",
"is_group": "No",
"is_group": 0,
"parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person 2"
}

View File

@ -20,7 +20,7 @@ cur_frm.cscript.set_root_readonly = function(doc) {
cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
return{
filters:[
['Territory', 'is_group', '=', 'Yes'],
['Territory', 'is_group', '=', 1],
['Territory', 'name', '!=', doc.territory_name]
]
}

View File

@ -3,12 +3,14 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:territory_name",
"beta": 0,
"creation": "2013-01-10 16:34:24",
"custom": 0,
"description": "Classification of Customers by region",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -18,6 +20,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Territory Name",
@ -27,6 +30,7 @@
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -43,6 +47,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Parent Territory",
@ -53,6 +58,7 @@
"options": "Territory",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -66,19 +72,21 @@
"collapsible": 0,
"description": "Only leaf nodes are allowed in transaction",
"fieldname": "is_group",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Has Child Node",
"label": "Is Group",
"length": 0,
"no_copy": 0,
"oldfieldname": "is_group",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@ -94,12 +102,14 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -116,6 +126,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Territory Manager",
@ -126,6 +137,7 @@
"options": "Sales Person",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -141,6 +153,7 @@
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "lft",
@ -150,6 +163,7 @@
"oldfieldtype": "Int",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -165,6 +179,7 @@
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "rgt",
@ -174,6 +189,7 @@
"oldfieldtype": "Int",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -190,6 +206,7 @@
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "old_parent",
@ -200,6 +217,7 @@
"options": "Territory",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
@ -216,6 +234,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Territory Targets",
@ -224,6 +243,7 @@
"oldfieldtype": "Section Break",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -239,6 +259,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Targets",
@ -249,6 +270,7 @@
"options": "Target Detail",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -265,6 +287,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Target Distribution",
@ -275,6 +298,7 @@
"options": "Monthly Distribution",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -287,13 +311,14 @@
"hide_toolbar": 0,
"icon": "icon-map-marker",
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2015-11-16 06:29:59.337250",
"modified": "2016-07-14 12:43:36.619881",
"modified_by": "Administrator",
"module": "Setup",
"name": "Territory",
@ -401,7 +426,10 @@
"write": 0
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "parent_territory,territory_manager"
"search_fields": "parent_territory,territory_manager",
"sort_order": "DESC",
"track_seen": 0
}

View File

@ -1,31 +1,31 @@
[
{
"doctype": "Territory",
"is_group": "No",
"is_group": 0,
"parent_territory": "All Territories",
"territory_name": "_Test Territory"
},
{
"doctype": "Territory",
"is_group": "Yes",
"is_group": 1,
"parent_territory": "All Territories",
"territory_name": "_Test Territory India"
},
{
"doctype": "Territory",
"is_group": "No",
"is_group": 0,
"parent_territory": "_Test Territory India",
"territory_name": "_Test Territory Maharashtra"
},
{
"doctype": "Territory",
"is_group": "No",
"is_group": 0,
"parent_territory": "All Territories",
"territory_name": "_Test Territory Rest Of The World"
},
{
"doctype": "Territory",
"is_group": "No",
"is_group": 0,
"parent_territory": "All Territories",
"territory_name": "_Test Territory United States"
}

View File

@ -15,17 +15,17 @@ def install(country=None):
# item group
{'doctype': 'Item Group', 'item_group_name': _('All Item Groups'),
'is_group': 'Yes', 'parent_item_group': ''},
'is_group': 1, 'parent_item_group': ''},
{'doctype': 'Item Group', 'item_group_name': _('Products'),
'is_group': 'No', 'parent_item_group': _('All Item Groups'), "show_in_website": 1 },
'is_group': 0, 'parent_item_group': _('All Item Groups'), "show_in_website": 1 },
{'doctype': 'Item Group', 'item_group_name': _('Raw Material'),
'is_group': 'No', 'parent_item_group': _('All Item Groups') },
'is_group': 0, 'parent_item_group': _('All Item Groups') },
{'doctype': 'Item Group', 'item_group_name': _('Services'),
'is_group': 'No', 'parent_item_group': _('All Item Groups') },
'is_group': 0, 'parent_item_group': _('All Item Groups') },
{'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'),
'is_group': 'No', 'parent_item_group': _('All Item Groups') },
'is_group': 0, 'parent_item_group': _('All Item Groups') },
{'doctype': 'Item Group', 'item_group_name': _('Consumable'),
'is_group': 'No', 'parent_item_group': _('All Item Groups') },
'is_group': 0, 'parent_item_group': _('All Item Groups') },
# deduction type
{'doctype': 'Deduction Type', 'name': _('Income Tax'), 'description': _('Income Tax'), 'deduction_name': _('Income Tax')},
@ -95,14 +95,14 @@ def install(country=None):
{'doctype': 'Designation', 'designation_name': _('Researcher')},
# territory
{'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 'Yes', 'name': _('All Territories'), 'parent_territory': ''},
{'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 1, 'name': _('All Territories'), 'parent_territory': ''},
# customer group
{'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 'Yes', 'name': _('All Customer Groups'), 'parent_customer_group': ''},
{'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 1, 'name': _('All Customer Groups'), 'parent_customer_group': ''},
{'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
# supplier type
{'doctype': 'Supplier Type', 'supplier_type': _('Services')},
@ -114,7 +114,7 @@ def install(country=None):
{'doctype': 'Supplier Type', 'supplier_type': _('Distributor')},
# Sales Person
{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': "Yes", "parent_sales_person": ""},
{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""},
# UOM
{'uom_name': _('Unit'), 'doctype': 'UOM', 'name': _('Unit'), "must_be_whole_number": 1},

View File

@ -4,7 +4,7 @@ install_docs = [
{"doctype":"Role", "role_name":"Item Manager", "name":"Item Manager"},
{"doctype":"Role", "role_name":"Stock User", "name":"Stock User"},
{"doctype":"Role", "role_name":"Quality Manager", "name":"Quality Manager"},
{"doctype":"Item Group", "item_group_name":"All Item Groups", "is_group":"Yes"},
{"doctype":"Item Group", "item_group_name":"All Item Groups", "is_group": 1},
{"doctype":"Item Group", "item_group_name":"Default",
"parent_item_group":"All Item Groups", "is_group":"No"},
"parent_item_group":"All Item Groups", "is_group": 0},
]

View File

@ -5,6 +5,15 @@
frappe.provide("erpnext.stock");
frappe.provide("erpnext.stock.delivery_note");
frappe.ui.form.on('Delivery Note', 'onload', function(frm) {
frm.set_indicator_formatter('item_code',
function(doc) {
return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
})
})
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
this._super();
@ -28,7 +37,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Sales Order'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note",
source_doctype: "Sales Order",
get_query_filters: {

View File

@ -6,7 +6,7 @@ import frappe
from frappe.model.document import Document
from frappe import _
from erpnext.controllers.item_variant import InvalidItemAttributeValueError
from erpnext.controllers.item_variant import validate_item_variant_attributes, InvalidItemAttributeValueError
class ItemAttributeIncrementError(frappe.ValidationError): pass
@ -24,9 +24,9 @@ class ItemAttribute(Document):
def validate_exising_items(self):
'''Validate that if there are existing items with attributes, they are valid'''
for item in frappe.db.sql('''select i.name from `tabItem Variant Attribute` iva, `tabItem` i
for item in frappe.db.sql('''select distinct i.name from `tabItem Variant Attribute` iva, `tabItem` i
where iva.attribute = %s and iva.parent = i.name and i.has_variants = 0''', self.name):
frappe.get_doc('Item', item[0]).validate_variant_attributes()
validate_item_variant_attributes(frappe.get_doc('Item', item[0]))
def validate_numeric(self):
if self.numeric_values:

View File

@ -87,7 +87,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Sales Order'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request",
source_doctype: "Sales Order",
get_query_filters: {

View File

@ -52,7 +52,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
if(this.frm.doc.docstatus==0) {
cur_frm.add_custom_button(__('Purchase Order'),
function() {
frappe.model.map_current_doc({
erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
source_doctype: "Purchase Order",
get_query_filters: {

View File

@ -4,7 +4,7 @@
"docstatus": 0,
"doctype": "Page",
"idx": 0,
"modified": "2016-04-21 05:04:30.228526",
"modified": "2016-07-14 06:39:09.096256",
"modified_by": "Administrator",
"module": "Stock",
"name": "stock-balance",
@ -18,5 +18,5 @@
"script": null,
"standard": "Yes",
"style": null,
"title": "Stock Balance"
"title": "Stock Summary"
}

View File

@ -8,7 +8,7 @@ from frappe.utils import flt, getdate
def execute(filters=None):
if not filters: filters = {}
validate_filters(filters)
columns = get_columns()
@ -83,7 +83,7 @@ def get_stock_ledger_entries(filters):
company, voucher_type, qty_after_transaction, stock_value_difference
from `tabStock Ledger Entry` sle force index (posting_sort_index)
where docstatus < 2 %s order by posting_date, posting_time, name""" %
conditions, as_dict=1, debug=1)
conditions, as_dict=1)
def get_item_warehouse_map(filters):
iwb_map = {}
@ -147,4 +147,3 @@ def validate_filters(filters):
sle_count = flt(frappe.db.sql("""select count(name) from `tabStock Ledger Entry`""")[0][0])
if sle_count > 500000:
frappe.throw(_("Please set filter based on Item or Warehouse"))