Merge branch 'develop' of https://github.com/frappe/erpnext into update-items-permission-fix

This commit is contained in:
Saqib Ansari
2020-05-29 22:37:13 +05:30
155 changed files with 1463 additions and 2049 deletions

View File

@@ -60,9 +60,9 @@ def get_charts():
"report_name": "Profit and Loss Statement", "report_name": "Profit and Loss Statement",
"filters_json": json.dumps({ "filters_json": json.dumps({
"company": company.name, "company": company.name,
"filter_based_on": "Date Range", "filter_based_on": "Fiscal Year",
"period_start_date": get_date_str(fiscal_year[1]), "from_fiscal_year": fiscal_year[0],
"period_end_date": get_date_str(fiscal_year[2]), "to_fiscal_year": fiscal_year[0],
"periodicity": "Monthly", "periodicity": "Monthly",
"include_default_book_entries": 1 "include_default_book_entries": 1
}), }),

View File

@@ -199,10 +199,13 @@ def book_deferred_income_or_expense(doc, deferred_process, posting_date=None):
if item.get(enable_check): if item.get(enable_check):
_book_deferred_revenue_or_expense(item) _book_deferred_revenue_or_expense(item)
def process_deferred_accounting(posting_date=today()): def process_deferred_accounting(posting_date=None):
''' Converts deferred income/expense into income/expense ''' Converts deferred income/expense into income/expense
Executed via background jobs on every month end ''' Executed via background jobs on every month end '''
if not posting_date:
posting_date = today()
if not cint(frappe.db.get_singles_value('Accounts Settings', 'automatically_process_deferred_accounting_entry')): if not cint(frappe.db.get_singles_value('Accounts Settings', 'automatically_process_deferred_accounting_entry')):
return return

View File

@@ -18,7 +18,7 @@
{ {
"hidden": 0, "hidden": 0,
"label": "Accounts Payable", "label": "Accounts Payable",
"links": "[\n {\n \"description\": \"Bills raised by Suppliers.\",\n \"label\": \"Purchase Invoice\",\n \"name\": \"Purchase Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Supplier database.\",\n \"label\": \"Supplier\",\n \"name\": \"Supplier\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n \"label\": \"Payment Entry\",\n \"name\": \"Payment Entry\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable\",\n \"name\": \"Accounts Payable\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable Summary\",\n \"name\": \"Accounts Payable Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Register\",\n \"name\": \"Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase Register\",\n \"name\": \"Item-wise Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Order Items To Be Billed\",\n \"name\": \"Purchase Order Items To Be Billed\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Received Items To Be Billed\",\n \"name\": \"Received Items To Be Billed\",\n \"type\": \"report\"\n }\n]" "links": "[\n {\n \"description\": \"Bills raised by Suppliers.\",\n \"label\": \"Purchase Invoice\",\n \"name\": \"Purchase Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Supplier database.\",\n \"label\": \"Supplier\",\n \"name\": \"Supplier\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n \"label\": \"Payment Entry\",\n \"name\": \"Payment Entry\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable\",\n \"name\": \"Accounts Payable\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable Summary\",\n \"name\": \"Accounts Payable Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Register\",\n \"name\": \"Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase Register\",\n \"name\": \"Item-wise Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Order\"\n ],\n \"doctype\": \"Purchase Order\",\n \"is_query_report\": true,\n \"label\": \"Purchase Order Analysis\",\n \"name\": \"Purchase Order Analysis\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Received Items To Be Billed\",\n \"name\": \"Received Items To Be Billed\",\n \"type\": \"report\"\n }\n]"
}, },
{ {
"hidden": 0, "hidden": 0,
@@ -94,10 +94,11 @@
"docstatus": 0, "docstatus": 0,
"doctype": "Desk Page", "doctype": "Desk Page",
"extends_another_page": 0, "extends_another_page": 0,
"hide_custom": 0,
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Accounting", "label": "Accounting",
"modified": "2020-05-18 17:27:26.882340", "modified": "2020-05-27 20:34:50.949772",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounting", "name": "Accounting",

View File

@@ -11,21 +11,9 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
}; };
}); });
frm.set_query('cost_center', 'invoices', function(doc, cdt, cdn) { if (frm.doc.company) {
return { frm.trigger('setup_company_filters');
filters: {
'company': doc.company
} }
};
});
frm.set_query('cost_center', function(doc) {
return {
filters: {
'company': doc.company
}
};
});
}, },
refresh: function(frm) { refresh: function(frm) {
@@ -51,7 +39,37 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
}); });
}, },
setup_company_filters: function(frm) {
frm.set_query('cost_center', 'invoices', function(doc, cdt, cdn) {
return {
filters: {
'company': doc.company
}
};
});
frm.set_query('cost_center', function(doc) {
return {
filters: {
'company': doc.company
}
};
});
frm.set_query('temporary_opening_account', 'invoices', function(doc, cdt, cdn) {
return {
filters: {
'company': doc.company
}
}
});
},
company: function(frm) { company: function(frm) {
if (frm.doc.company) {
frm.trigger('setup_company_filters');
frappe.call({ frappe.call({
method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account', method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account',
args: { args: {
@@ -64,6 +82,7 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
} }
} }
}) })
}
}, },
invoice_type: function(frm) { invoice_type: function(frm) {

View File

@@ -386,6 +386,50 @@ class TestPricingRule(unittest.TestCase):
self.assertEqual(so.items[1].is_free_item, 1) self.assertEqual(so.items[1].is_free_item, 1)
self.assertEqual(so.items[1].item_code, "_Test Item 2") self.assertEqual(so.items[1].item_code, "_Test Item 2")
def test_cumulative_pricing_rule(self):
frappe.delete_doc_if_exists('Pricing Rule', '_Test Cumulative Pricing Rule')
test_record = {
"doctype": "Pricing Rule",
"title": "_Test Cumulative Pricing Rule",
"apply_on": "Item Code",
"currency": "USD",
"items": [{
"item_code": "_Test Item",
}],
"is_cumulative": 1,
"selling": 1,
"applicable_for": "Customer",
"customer": "_Test Customer",
"rate_or_discount": "Discount Percentage",
"rate": 0,
"min_amt": 0,
"max_amt": 10000,
"discount_percentage": 17.5,
"price_or_product_discount": "Price",
"company": "_Test Company",
"valid_from": frappe.utils.nowdate(),
"valid_upto": frappe.utils.nowdate()
}
frappe.get_doc(test_record.copy()).insert()
args = frappe._dict({
"item_code": "_Test Item",
"company": "_Test Company",
"price_list": "_Test Price List",
"currency": "_Test Currency",
"doctype": "Sales Invoice",
"conversion_rate": 1,
"price_list_currency": "_Test Currency",
"plc_conversion_rate": 1,
"order_type": "Sales",
"customer": "_Test Customer",
"name": None,
"transaction_date": frappe.utils.nowdate()
})
details = get_item_details(args)
self.assertTrue(details)
def make_pricing_rule(**args): def make_pricing_rule(**args):
args = frappe._dict(args) args = frappe._dict(args)

View File

@@ -366,8 +366,7 @@ def get_qty_amount_data_for_cumulative(pr_doc, doc, items=[]):
sum_qty, sum_amt = [0, 0] sum_qty, sum_amt = [0, 0]
doctype = doc.get('parenttype') or doc.doctype doctype = doc.get('parenttype') or doc.doctype
date_field = ('transaction_date' date_field = 'transaction_date' if frappe.get_meta(doctype).has_field('transaction_date') else 'posting_date'
if doc.get('transaction_date') else 'posting_date')
child_doctype = '{0} Item'.format(doctype) child_doctype = '{0} Item'.format(doctype)
apply_on = frappe.scrub(pr_doc.get('apply_on')) apply_on = frappe.scrub(pr_doc.get('apply_on'))

View File

@@ -1519,14 +1519,22 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
def update_details(source_doc, target_doc, source_parent): def update_details(source_doc, target_doc, source_parent):
target_doc.inter_company_invoice_reference = source_doc.name target_doc.inter_company_invoice_reference = source_doc.name
if target_doc.doctype in ["Purchase Invoice", "Purchase Order"]: if target_doc.doctype in ["Purchase Invoice", "Purchase Order"]:
currency = frappe.db.get_value('Supplier', details.get('party'), 'default_currency')
target_doc.company = details.get("company") target_doc.company = details.get("company")
target_doc.supplier = details.get("party") target_doc.supplier = details.get("party")
target_doc.buying_price_list = source_doc.selling_price_list target_doc.buying_price_list = source_doc.selling_price_list
if currency:
target_doc.currency = currency
else: else:
currency = frappe.db.get_value('Customer', details.get('party'), 'default_currency')
target_doc.company = details.get("company") target_doc.company = details.get("company")
target_doc.customer = details.get("party") target_doc.customer = details.get("party")
target_doc.selling_price_list = source_doc.buying_price_list target_doc.selling_price_list = source_doc.buying_price_list
if currency:
target_doc.currency = currency
doclist = get_mapped_doc(doctype, source_name, { doclist = get_mapped_doc(doctype, source_name, {
doctype: { doctype: {
"doctype": target_doctype, "doctype": target_doctype,

View File

@@ -180,7 +180,7 @@ def get_advance_vouchers(suppliers, fiscal_year=None, company=None, from_date=No
if company: if company:
condition += "and company =%s" % (company) condition += "and company =%s" % (company)
if from_date and to_date: if from_date and to_date:
condition += "and posting_date between %s and %s" % (company, from_date, to_date) condition += "and posting_date between %s and %s" % (from_date, to_date)
## Appending the same supplier again if length of suppliers list is 1 ## Appending the same supplier again if length of suppliers list is 1
## since tuple of single element list contains None, For example ('Test Supplier 1', ) ## since tuple of single element list contains None, For example ('Test Supplier 1', )

View File

@@ -602,10 +602,14 @@ def get_party_shipping_address(doctype, name):
else: else:
return '' return ''
def get_partywise_advanced_payment_amount(party_type, posting_date = None, company=None): def get_partywise_advanced_payment_amount(party_type, posting_date = None, future_payment=0, company=None):
cond = "1=1" cond = "1=1"
if posting_date: if posting_date:
if future_payment:
cond = "posting_date <= '{0}' OR DATE(creation) <= '{0}' """.format(posting_date)
else:
cond = "posting_date <= '{0}'".format(posting_date) cond = "posting_date <= '{0}'".format(posting_date)
if company: if company:
cond += "and company = '{0}'".format(company) cond += "and company = '{0}'".format(company)

View File

@@ -135,12 +135,5 @@ frappe.query_reports["Accounts Payable"] = {
} }
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Accounts Payable', 9);
frappe.query_reports["Accounts Payable"].filters.splice(9, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -104,12 +104,5 @@ frappe.query_reports["Accounts Payable Summary"] = {
} }
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Accounts Payable Summary', 9);
frappe.query_reports["Accounts Payable Summary"].filters.splice(9, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -199,12 +199,5 @@ frappe.query_reports["Accounts Receivable"] = {
} }
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Accounts Receivable', 9);
frappe.query_reports["Accounts Receivable"].filters.splice(9, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -534,7 +534,7 @@ class ReceivablePayableReport(object):
def get_ageing_data(self, entry_date, row): def get_ageing_data(self, entry_date, row):
# [0-30, 30-60, 60-90, 90-120, 120-above] # [0-30, 30-60, 60-90, 90-120, 120-above]
row.range1 = row.range2 = row.range3 = row.range4 = range5 = 0.0 row.range1 = row.range2 = row.range3 = row.range4 = row.range5 = 0.0
if not (self.age_as_on and entry_date): if not (self.age_as_on and entry_date):
return return
@@ -559,6 +559,14 @@ class ReceivablePayableReport(object):
conditions, values = self.prepare_conditions() conditions, values = self.prepare_conditions()
order_by = self.get_order_by_condition() order_by = self.get_order_by_condition()
if self.filters.show_future_payments:
values.insert(2, self.filters.report_date)
date_condition = """AND (posting_date <= %s
OR (against_voucher IS NULL AND DATE(creation) <= %s))"""
else:
date_condition = "AND posting_date <=%s"
if self.filters.get(scrub(self.party_type)): if self.filters.get(scrub(self.party_type)):
select_fields = "debit_in_account_currency as debit, credit_in_account_currency as credit" select_fields = "debit_in_account_currency as debit, credit_in_account_currency as credit"
else: else:
@@ -574,9 +582,8 @@ class ReceivablePayableReport(object):
docstatus < 2 docstatus < 2
and party_type=%s and party_type=%s
and (party is not null and party != '') and (party is not null and party != '')
and posting_date <= %s {1} {2} {3}"""
{1} {2}""" .format(select_fields, date_condition, conditions, order_by), values, as_dict=True)
.format(select_fields, conditions, order_by), values, as_dict=True)
def get_sales_invoices_or_customers_based_on_sales_person(self): def get_sales_invoices_or_customers_based_on_sales_person(self):
if self.filters.get("sales_person"): if self.filters.get("sales_person"):

View File

@@ -111,7 +111,12 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"fieldname":"based_on_payment_terms", "fieldname":"based_on_payment_terms",
"label": __("Based On Payment Terms"), "label": __("Based On Payment Terms"),
"fieldtype": "Check", "fieldtype": "Check",
} },
{
"fieldname":"show_future_payments",
"label": __("Show Future Payments"),
"fieldtype": "Check",
},
], ],
onload: function(report) { onload: function(report) {
@@ -122,11 +127,4 @@ frappe.query_reports["Accounts Receivable Summary"] = {
} }
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Accounts Receivable Summary', 9);
frappe.query_reports["Accounts Receivable Summary"].filters.splice(9, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -33,7 +33,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
self.get_party_total(args) self.get_party_total(args)
party_advance_amount = get_partywise_advanced_payment_amount(self.party_type, party_advance_amount = get_partywise_advanced_payment_amount(self.party_type,
self.filters.report_date, self.filters.company) or {} self.filters.report_date, self.filters.show_future_payments, self.filters.company) or {}
for party, party_dict in iteritems(self.party_total): for party, party_dict in iteritems(self.party_total):
if party_dict.outstanding == 0: if party_dict.outstanding == 0:

View File

@@ -93,7 +93,7 @@ def get_assets(filters):
sum(results.depreciation_eliminated_during_the_period) as depreciation_eliminated_during_the_period, sum(results.depreciation_eliminated_during_the_period) as depreciation_eliminated_during_the_period,
sum(results.depreciation_amount_during_the_period) as depreciation_amount_during_the_period sum(results.depreciation_amount_during_the_period) as depreciation_amount_during_the_period
from (SELECT a.asset_category, from (SELECT a.asset_category,
ifnull(sum(case when ds.schedule_date < %(from_date)s then ifnull(sum(case when ds.schedule_date < %(from_date)s and (ifnull(a.disposal_date, 0) = 0 or a.disposal_date >= %(from_date)s) then
ds.depreciation_amount ds.depreciation_amount
else else
0 0
@@ -111,13 +111,11 @@ def get_assets(filters):
0 0
end), 0) as depreciation_amount_during_the_period end), 0) as depreciation_amount_during_the_period
from `tabAsset` a, `tabDepreciation Schedule` ds from `tabAsset` a, `tabDepreciation Schedule` ds
where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent and ifnull(ds.journal_entry, '') != ''
group by a.asset_category group by a.asset_category
union union
SELECT a.asset_category, SELECT a.asset_category,
ifnull(sum(case when ifnull(a.disposal_date, 0) != 0 ifnull(sum(case when ifnull(a.disposal_date, 0) != 0 and (a.disposal_date < %(from_date)s or a.disposal_date > %(to_date)s) then
and (a.disposal_date < %(from_date)s or a.disposal_date > %(to_date)s)
then
0 0
else else
a.opening_accumulated_depreciation a.opening_accumulated_depreciation

View File

@@ -4,6 +4,8 @@
frappe.require("assets/erpnext/js/financial_statements.js", function() { frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Balance Sheet"] = $.extend({}, erpnext.financial_statements); frappe.query_reports["Balance Sheet"] = $.extend({}, erpnext.financial_statements);
erpnext.utils.add_dimensions('Balance Sheet', 10);
frappe.query_reports["Balance Sheet"]["filters"].push({ frappe.query_reports["Balance Sheet"]["filters"].push({
"fieldname": "accumulated_values", "fieldname": "accumulated_values",
"label": __("Accumulated Values"), "label": __("Accumulated Values"),

View File

@@ -5,6 +5,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Cash Flow"] = $.extend({}, frappe.query_reports["Cash Flow"] = $.extend({},
erpnext.financial_statements); erpnext.financial_statements);
erpnext.utils.add_dimensions('Cash Flow', 10);
// The last item in the array is the definition for Presentation Currency // The last item in the array is the definition for Presentation Currency
// filter. It won't be used in cash flow for now so we pop it. Please take // filter. It won't be used in cash flow for now so we pop it. Please take
// of this if you are working here. // of this if you are working here.

View File

@@ -33,7 +33,6 @@ frappe.query_reports["Consolidated Financial Statement"] = {
"fieldname":"period_start_date", "fieldname":"period_start_date",
"label": __("Start Date"), "label": __("Start Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": frappe.datetime.nowdate(),
"hidden": 1, "hidden": 1,
"reqd": 1 "reqd": 1
}, },
@@ -41,7 +40,6 @@ frappe.query_reports["Consolidated Financial Statement"] = {
"fieldname":"period_end_date", "fieldname":"period_end_date",
"label": __("End Date"), "label": __("End Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": frappe.datetime.add_months(frappe.datetime.nowdate(), 12),
"hidden": 1, "hidden": 1,
"reqd": 1 "reqd": 1
}, },
@@ -106,5 +104,16 @@ frappe.query_reports["Consolidated Financial Statement"] = {
value = $value.wrap("<p></p>").parent().html(); value = $value.wrap("<p></p>").parent().html();
} }
return value; return value;
},
onload: function() {
let fiscal_year = frappe.defaults.get_user_default("fiscal_year")
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
frappe.query_report.set_filter_value({
period_start_date: fy.year_start_date,
period_end_date: fy.year_end_date
});
});
} }
} }

View File

@@ -164,12 +164,5 @@ frappe.query_reports["General Ledger"] = {
] ]
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('General Ledger', 15)
frappe.query_reports["General Ledger"].filters.splice(15, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -4,11 +4,18 @@
frappe.query_reports["Item-wise Purchase Register"] = { frappe.query_reports["Item-wise Purchase Register"] = {
"filters": [ "filters": [
{ {
"fieldname":"date_range", "fieldname":"from_date",
"label": __("Date Range"), "label": __("From Date"),
"fieldtype": "DateRange", "fieldtype": "Date",
"default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()], "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
"reqd": 1 "reqd": 1,
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today(),
"reqd": 1,
}, },
{ {
"fieldname": "item_code", "fieldname": "item_code",

View File

@@ -14,7 +14,6 @@ def execute(filters=None):
def _execute(filters=None, additional_table_columns=None, additional_query_columns=None): def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
if not filters: filters = {} if not filters: filters = {}
filters.update({"from_date": filters.get("date_range")[0], "to_date": filters.get("date_range")[1]})
columns = get_columns(additional_table_columns, filters) columns = get_columns(additional_table_columns, filters)
company_currency = erpnext.get_company_currency(filters.company) company_currency = erpnext.get_company_currency(filters.company)

View File

@@ -4,11 +4,18 @@
frappe.query_reports["Item-wise Sales Register"] = { frappe.query_reports["Item-wise Sales Register"] = {
"filters": [ "filters": [
{ {
"fieldname": "date_range", "fieldname":"from_date",
"label": __("Date Range"), "label": __("From Date"),
"fieldtype": "DateRange", "fieldtype": "Date",
"default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()], "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
"reqd": 1 "reqd": 1,
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today(),
"reqd": 1,
}, },
{ {
"fieldname": "customer", "fieldname": "customer",

View File

@@ -14,7 +14,6 @@ def execute(filters=None):
def _execute(filters=None, additional_table_columns=None, additional_query_columns=None): def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
if not filters: filters = {} if not filters: filters = {}
filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
columns = get_columns(additional_table_columns, filters) columns = get_columns(additional_table_columns, filters)
company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency") company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency")

View File

@@ -6,6 +6,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Profit and Loss Statement"] = $.extend({}, frappe.query_reports["Profit and Loss Statement"] = $.extend({},
erpnext.financial_statements); erpnext.financial_statements);
erpnext.utils.add_dimensions('Profit and Loss Statement', 10);
frappe.query_reports["Profit and Loss Statement"]["filters"].push( frappe.query_reports["Profit and Loss Statement"]["filters"].push(
{ {
"fieldname": "project", "fieldname": "project",

View File

@@ -1,8 +0,0 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Purchase Order Items To Be Billed"] = {
"filters": [
]
}

View File

@@ -1,33 +0,0 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-05-28 15:54:16",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2017-02-24 20:00:24.302988",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Order Items To Be Billed",
"owner": "Administrator",
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc",
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Order Items To Be Billed",
"report_type": "Script Report",
"roles": [
{
"role": "Accounts User"
},
{
"role": "Purchase User"
},
{
"role": "Auditor"
},
{
"role": "Accounts Manager"
}
]
}

View File

@@ -1,26 +0,0 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data
def execute(filters=None):
columns = get_column()
args = get_args()
data = get_ordered_to_be_billed_data(args)
return columns, data
def get_column():
return [
_("Purchase Order") + ":Link/Purchase Order:120", _("Status") + "::120", _("Date") + ":Date:100",
_("Suplier") + ":Link/Supplier:120", _("Suplier Name") + "::120",
_("Project") + ":Link/Project:120", _("Item Code") + ":Link/Item:120",
_("Amount") + ":Currency:100", _("Billed Amount") + ":Currency:100", _("Amount to Bill") + ":Currency:100",
_("Item Name") + "::120", _("Description") + "::120", _("Company") + ":Link/Company:120",
]
def get_args():
return {'doctype': 'Purchase Order', 'party': 'supplier',
'date': 'transaction_date', 'order': 'transaction_date', 'order_by': 'asc'}

View File

@@ -56,11 +56,4 @@ frappe.query_reports["Purchase Register"] = {
] ]
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Purchase Register', 7);
frappe.query_reports["Purchase Register"].filters.splice(7, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -68,12 +68,5 @@ frappe.query_reports["Sales Register"] = {
] ]
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Sales Register', 7);
frappe.query_reports["Sales Register"].filters.splice(7, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});

View File

@@ -102,14 +102,7 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
"initial_depth": 3 "initial_depth": 3
} }
erpnext.dimension_filters.forEach((dimension) => { erpnext.utils.add_dimensions('Trial Balance', 6);
frappe.query_reports["Trial Balance"].filters.splice(6, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});
}); });

View File

@@ -1,559 +1,140 @@
{ {
"allow_copy": 0, "actions": [],
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "field:asset_name", "autoname": "field:asset_name",
"beta": 0,
"creation": "2017-10-19 16:50:22.879545", "creation": "2017-10-19 16:50:22.879545",
"custom": 0,
"docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [
"asset_name",
"asset_category",
"company",
"column_break_3",
"item_code",
"item_name",
"section_break_6",
"maintenance_team",
"column_break_9",
"maintenance_manager",
"maintenance_manager_name",
"section_break_8",
"asset_maintenance_tasks"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "asset_name", "fieldname": "asset_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Asset Name", "label": "Asset Name",
"length": 0,
"no_copy": 0,
"options": "Asset", "options": "Asset",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "unique": 1
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "asset_name.asset_category", "fetch_from": "asset_name.asset_category",
"fieldname": "asset_category", "fieldname": "asset_category",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Asset Category"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Asset Category",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "asset_name.item_code", "fetch_from": "asset_name.item_code",
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Item Code"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "asset_name.item_name", "fetch_from": "asset_name.item_name",
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Item Name"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Company", "label": "Company",
"length": 0,
"no_copy": 0,
"options": "Company", "options": "Company",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "select_serial_no",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Select Serial No",
"length": 0,
"no_copy": 0,
"options": "Serial No",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "serial_no",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial No",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_6", "fieldname": "section_break_6",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "maintenance_team", "fieldname": "maintenance_team",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Maintenance Team", "label": "Maintenance Team",
"length": 0,
"no_copy": 0,
"options": "Asset Maintenance Team", "options": "Asset Maintenance Team",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_9", "fieldname": "column_break_9",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "maintenance_team.maintenance_manager", "fetch_from": "maintenance_team.maintenance_manager",
"fieldname": "maintenance_manager", "fieldname": "maintenance_manager",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintenance Manager", "label": "Maintenance Manager",
"length": 0, "read_only": 1
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "maintenance_team.maintenance_manager_name", "fetch_from": "maintenance_team.maintenance_manager_name",
"fieldname": "maintenance_manager_name", "fieldname": "maintenance_manager_name",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Maintenance Manager Name"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintenance Manager Name",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_8", "fieldname": "section_break_8",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "label": "Tasks"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tasks",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "asset_maintenance_tasks", "fieldname": "asset_maintenance_tasks",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintenance Tasks", "label": "Maintenance Tasks",
"length": 0,
"no_copy": 0,
"options": "Asset Maintenance Task", "options": "Asset Maintenance Task",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "links": [],
"hide_heading": 0, "modified": "2020-05-28 20:28:32.993823",
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-22 17:20:54.711885",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset Maintenance", "name": "Asset Maintenance",
"name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0,
"cancel": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"export": 1, "export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Quality Manager", "role": "Quality Manager",
"set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 0,
"write": 1 "write": 1
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"export": 1, "export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing User", "role": "Manufacturing User",
"set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 0,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"track_changes": 1, "track_changes": 1
"track_seen": 0
} }

View File

@@ -38,7 +38,7 @@ class AssetMaintenance(Document):
@frappe.whitelist() @frappe.whitelist()
def assign_tasks(asset_maintenance_name, assign_to_member, maintenance_task, next_due_date): def assign_tasks(asset_maintenance_name, assign_to_member, maintenance_task, next_due_date):
team_member = frappe.get_doc('User', assign_to_member).email team_member = frappe.db.get_value('User', assign_to_member, "email")
args = { args = {
'doctype' : 'Asset Maintenance', 'doctype' : 'Asset Maintenance',
'assign_to' : team_member, 'assign_to' : team_member,
@@ -77,7 +77,7 @@ def calculate_next_due_date(periodicity, start_date = None, end_date = None, las
def update_maintenance_log(asset_maintenance, item_code, item_name, task): def update_maintenance_log(asset_maintenance, item_code, item_name, task):
asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance, asset_maintenance_log = frappe.get_value("Asset Maintenance Log", {"asset_maintenance": asset_maintenance,
"task": task.maintenance_task, "maintenance_status": ('in',['Planned','Overdue'])}) "task": task.name, "maintenance_status": ('in',['Planned','Overdue'])})
if not asset_maintenance_log: if not asset_maintenance_log:
asset_maintenance_log = frappe.get_doc({ asset_maintenance_log = frappe.get_doc({
@@ -86,7 +86,7 @@ def update_maintenance_log(asset_maintenance, item_code, item_name, task):
"asset_name": asset_maintenance, "asset_name": asset_maintenance,
"item_code": item_code, "item_code": item_code,
"item_name": item_name, "item_name": item_name,
"task": task.maintenance_task, "task": task.name,
"has_certificate": task.certificate_required, "has_certificate": task.certificate_required,
"description": task.description, "description": task.description,
"assign_to_name": task.assign_to_name, "assign_to_name": task.assign_to_name,

View File

@@ -1,789 +1,190 @@
{ {
"allow_copy": 0, "actions": [],
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "naming_series:", "autoname": "naming_series:",
"beta": 0,
"creation": "2017-10-23 16:58:44.424309", "creation": "2017-10-23 16:58:44.424309",
"custom": 0,
"docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Document", "document_type": "Document",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [
"asset_maintenance",
"naming_series",
"asset_name",
"column_break_2",
"item_code",
"item_name",
"section_break_5",
"task",
"task_name",
"maintenance_type",
"periodicity",
"assign_to_name",
"column_break_6",
"due_date",
"completion_date",
"maintenance_status",
"section_break_12",
"has_certificate",
"certificate_attachement",
"section_break_6",
"description",
"column_break_9",
"actions_performed",
"amended_from"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "asset_maintenance", "fieldname": "asset_maintenance",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Asset Maintenance", "label": "Asset Maintenance",
"length": 0, "options": "Asset Maintenance"
"no_copy": 0,
"options": "Asset Maintenance",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Series", "label": "Series",
"length": 0,
"no_copy": 0,
"options": "ACC-AML-.YYYY.-", "options": "ACC-AML-.YYYY.-",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "asset_maintenance.asset_name", "fetch_from": "asset_maintenance.asset_name",
"fieldname": "asset_name", "fieldname": "asset_name",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Asset Name"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Asset Name",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_2", "fieldname": "column_break_2",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "asset_maintenance.item_code", "fetch_from": "asset_maintenance.item_code",
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Item Code"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "asset_maintenance.item_name", "fetch_from": "asset_maintenance.item_name",
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Item Name"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "task", "fieldname": "task",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Task", "label": "Task",
"length": 0, "options": "Asset Maintenance Task"
"no_copy": 0,
"options": "Asset Maintenance Task",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.maintenance_type", "fetch_from": "task.maintenance_type",
"fieldname": "maintenance_type", "fieldname": "maintenance_type",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Maintenance Type"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintenance Type",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.periodicity", "fetch_from": "task.periodicity",
"fieldname": "periodicity", "fieldname": "periodicity",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Periodicity", "label": "Periodicity",
"length": 0, "read_only": 1
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.assign_to_name", "fetch_from": "task.assign_to_name",
"fieldname": "assign_to_name", "fieldname": "assign_to_name",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0, "label": "Assign To"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Assign To",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_6", "fieldname": "column_break_6",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.next_due_date", "fetch_from": "task.next_due_date",
"fieldname": "due_date", "fieldname": "due_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Due Date", "label": "Due Date",
"length": 0, "read_only": 1
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "completion_date", "fieldname": "completion_date",
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0, "label": "Completion Date"
"label": "Completion Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "maintenance_status", "fieldname": "maintenance_status",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Maintenance Status", "label": "Maintenance Status",
"length": 0,
"no_copy": 0,
"options": "Planned\nCompleted\nCancelled\nOverdue", "options": "Planned\nCompleted\nCancelled\nOverdue",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_12", "fieldname": "section_break_12",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0, "default": "0",
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.certificate_required", "fetch_from": "task.certificate_required",
"fieldname": "has_certificate", "fieldname": "has_certificate",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "label": "Has Certificate "
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Certificate ",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.has_certificate", "depends_on": "eval:doc.has_certificate",
"fieldname": "certificate_attachement", "fieldname": "certificate_attachement",
"fieldtype": "Attach", "fieldtype": "Attach",
"hidden": 0, "label": "Certificate"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Certificate",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_6", "fieldname": "section_break_6",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.description", "fetch_from": "task.description",
"fieldname": "description", "fieldname": "description",
"fieldtype": "Read Only", "fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description", "label": "Description",
"length": 0, "read_only": 1
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_9", "fieldname": "column_break_9",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "actions_performed", "fieldname": "actions_performed",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"hidden": 0, "label": "Actions performed"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Actions performed",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amended From", "label": "Amended From",
"length": 0,
"no_copy": 1, "no_copy": 1,
"options": "Asset Maintenance Log", "options": "Asset Maintenance Log",
"permlevel": 0,
"precision": "",
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "read_only": 1
"read_only": 1, },
"remember_last_selected_value": 0, {
"report_hide": 0, "fetch_from": "task.maintenance_task",
"reqd": 0, "fieldname": "task_name",
"search_index": 0, "fieldtype": "Data",
"set_only_once": 0, "in_preview": 1,
"translatable": 0, "label": "Task Name",
"unique": 0 "read_only": 1
} }
], ],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 1, "is_submittable": 1,
"issingle": 0, "links": [],
"istable": 0, "modified": "2020-05-28 20:51:48.238397",
"max_attachments": 0,
"modified": "2018-08-21 14:44:51.457835",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset Maintenance Log", "name": "Asset Maintenance Log",
"name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
@@ -793,27 +194,17 @@
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"export": 1, "export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing User", "role": "Manufacturing User",
"set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 1, "submit": 1,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "",
"track_changes": 1, "track_changes": 1,
"track_seen": 1, "track_seen": 1
"track_views": 0
} }

View File

@@ -7,5 +7,4 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
class AssetMaintenanceTask(Document): class AssetMaintenanceTask(Document):
def autoname(self): pass
self.name = self.maintenance_task

View File

@@ -41,7 +41,7 @@ def get_dashboards():
{ "chart": "Top Suppliers", "width": "Full"} { "chart": "Top Suppliers", "width": "Full"}
], ],
"cards": [ "cards": [
{ "card": "This Year Purchases"}, { "card": "Annual Purchase"},
{ "card": "Purchase Orders to Receive"}, { "card": "Purchase Orders to Receive"},
{ "card": "Purchase Orders to Bill"}, { "card": "Purchase Orders to Bill"},
{ "card": "Active Suppliers"} { "card": "Active Suppliers"}
@@ -142,7 +142,7 @@ def get_charts():
def get_number_cards(): def get_number_cards():
return [ return [
{ {
"name": "This Year Purchases", "name": "Annual Purchase",
"aggregate_function_based_on": "base_net_total", "aggregate_function_based_on": "base_net_total",
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Purchase Order", "document_type": "Purchase Order",
@@ -155,7 +155,7 @@ def get_number_cards():
]), ]),
"function": "Sum", "function": "Sum",
"is_public": 1, "is_public": 1,
"label": _("This Year Purchases"), "label": _("Annual Purchase"),
"owner": "Administrator", "owner": "Administrator",
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Monthly" "stats_time_interval": "Monthly"

View File

@@ -34,9 +34,14 @@
"hidden": 0, "hidden": 0,
"label": "Other Reports", "label": "Other Reports",
"links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Items To Be Requested\",\n \"name\": \"Items To Be Requested\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase History\",\n \"name\": \"Item-wise Purchase History\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Subcontracted Raw Materials To Be Transferred\",\n \"name\": \"Subcontracted Raw Materials To Be Transferred\",\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Subcontracted Item To Be Received\",\n \"name\": \"Subcontracted Item To Be Received\",\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Quoted Item Comparison\",\n \"name\": \"Quoted Item Comparison\",\n \"onboard\": 1,\n \"reference_doctype\": \"Supplier Quotation\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Material Requests for which Supplier Quotations are not created\",\n \"name\": \"Material Requests for which Supplier Quotations are not created\",\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier Addresses And Contacts\",\n \"name\": \"Address And Contacts\",\n \"reference_doctype\": \"Address\",\n \"route_options\": {\n \"party_type\": \"Supplier\"\n },\n \"type\": \"report\"\n }\n]" "links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Items To Be Requested\",\n \"name\": \"Items To Be Requested\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase History\",\n \"name\": \"Item-wise Purchase History\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Subcontracted Raw Materials To Be Transferred\",\n \"name\": \"Subcontracted Raw Materials To Be Transferred\",\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Subcontracted Item To Be Received\",\n \"name\": \"Subcontracted Item To Be Received\",\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Quoted Item Comparison\",\n \"name\": \"Quoted Item Comparison\",\n \"onboard\": 1,\n \"reference_doctype\": \"Supplier Quotation\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Material Requests for which Supplier Quotations are not created\",\n \"name\": \"Material Requests for which Supplier Quotations are not created\",\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier Addresses And Contacts\",\n \"name\": \"Address And Contacts\",\n \"reference_doctype\": \"Address\",\n \"route_options\": {\n \"party_type\": \"Supplier\"\n },\n \"type\": \"report\"\n }\n]"
},
{
"hidden": 0,
"label": "Regional",
"links": "[\n {\n \"description\": \"Import Italian Purchase Invoices\",\n \"label\": \"Import Supplier Invoice\",\n \"name\": \"Import Supplier Invoice\",\n \"type\": \"doctype\"\n } \n]"
} }
], ],
"cards_label": "Masters & Reports ", "cards_label": "",
"category": "Modules", "category": "Modules",
"charts": [ "charts": [
{ {
@@ -44,7 +49,7 @@
"label": "Purchase Order Trends" "label": "Purchase Order Trends"
} }
], ],
"charts_label": "Buying Dashboard", "charts_label": "",
"creation": "2020-01-28 11:50:26.195467", "creation": "2020-01-28 11:50:26.195467",
"developer_mode_only": 0, "developer_mode_only": 0,
"disable_user_customization": 0, "disable_user_customization": 0,
@@ -55,7 +60,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Buying", "label": "Buying",
"modified": "2020-05-19 19:44:36.260982", "modified": "2020-05-28 13:32:49.960574",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Buying", "name": "Buying",
@@ -66,7 +71,7 @@
"shortcuts": [ "shortcuts": [
{ {
"color": "#cef6d1", "color": "#cef6d1",
"format": "{} available", "format": "{} Available",
"label": "Item", "label": "Item",
"link_to": "Item", "link_to": "Item",
"stats_filter": "{\n \"disabled\": 0\n}", "stats_filter": "{\n \"disabled\": 0\n}",
@@ -82,7 +87,7 @@
}, },
{ {
"color": "#ffe8cd", "color": "#ffe8cd",
"format": "{} to Receive", "format": "{} To Receive",
"label": "Purchase Order", "label": "Purchase Order",
"link_to": "Purchase Order", "link_to": "Purchase Order",
"stats_filter": "{\n \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n \"status\":[\"in\", [\"To Receive\", \"To Receive and Bill\"]]\n}", "stats_filter": "{\n \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n \"status\":[\"in\", [\"To Receive\", \"To Receive and Bill\"]]\n}",
@@ -99,10 +104,10 @@
"type": "Report" "type": "Report"
}, },
{ {
"label": "Buying Dashboard", "label": "Dashboard",
"link_to": "Buying", "link_to": "Buying",
"type": "Dashboard" "type": "Dashboard"
} }
], ],
"shortcuts_label": "Quick Access" "shortcuts_label": ""
} }

View File

@@ -11,7 +11,7 @@ frappe.tour['Buying Settings'] = [
{ {
fieldname: "supp_master_name", fieldname: "supp_master_name",
title: "Supplier Naming By", title: "Supplier Naming By",
description: __("By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a set ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/setting-up/settings/naming-series'>Naming Series</a>" + __(" choose the 'Naming Series' option."), description: __("By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a set ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/setting-up/settings/naming-series' target='_blank'>Naming Series</a>" + __(" choose the 'Naming Series' option."),
}, },
{ {
fieldname: "buying_price_list", fieldname: "buying_price_list",

View File

@@ -19,7 +19,7 @@
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/buying", "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/buying",
"idx": 0, "idx": 0,
"is_complete": 0, "is_complete": 0,
"modified": "2020-05-19 20:03:55.776080", "modified": "2020-05-27 17:17:52.075947",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Buying", "name": "Buying",
@@ -49,6 +49,6 @@
], ],
"subtitle": "Products, Purchases, Analysis and more.", "subtitle": "Products, Purchases, Analysis and more.",
"success_message": "The Buying Module is all set up!", "success_message": "The Buying Module is all set up!",
"title": "Let's Setup the Buying Module.", "title": "Let's Set Up the Buying Module.",
"user_can_dismiss": 1 "user_can_dismiss": 1
} }

View File

@@ -1,31 +0,0 @@
{
"add_total_row": 1,
"creation": "2013-05-13 16:10:02",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2019-04-18 19:02:03.099422",
"modified_by": "Administrator",
"module": "Buying",
"name": "Requested Items To Be Ordered",
"owner": "Administrator",
"prepared_report": 0,
"query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.stock_qty, 0)) as \"Qty:Float:100\",\n\tifnull(mr_item.stock_uom, '') as \"UOM:Link/UOM:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.stock_qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.stock_qty, 0))\norder by mr.transaction_date asc",
"ref_doctype": "Purchase Order",
"report_name": "Requested Items To Be Ordered",
"report_type": "Query Report",
"roles": [
{
"role": "Stock User"
},
{
"role": "Purchase Manager"
},
{
"role": "Purchase User"
}
]
}

View File

@@ -45,6 +45,18 @@ frappe.query_reports["Requested Items to Order"] = {
} }
} }
}, },
{
"fieldname": "item_code",
"label": __("Item"),
"fieldtype": "Link",
"width": "80",
"options": "Item",
"get_query": () => {
return {
query: "erpnext.controllers.queries.item_query"
}
}
},
{ {
"fieldname": "group_by_mr", "fieldname": "group_by_mr",
"label": __("Group by Material Request"), "label": __("Group by Material Request"),

View File

@@ -44,6 +44,9 @@ def get_conditions(filters):
if filters.get("material_request"): if filters.get("material_request"):
conditions += " and mr.name = '{0}'".format(filters.get("material_request")) conditions += " and mr.name = '{0}'".format(filters.get("material_request"))
if filters.get("item_code"):
conditions += " and mr_item.item_code = '{0}'".format(filters.get("item_code"))
return conditions return conditions
def get_data(filters, conditions): def get_data(filters, conditions):
@@ -74,11 +77,29 @@ def get_data(filters, conditions):
return data return data
def update_qty_columns(row_to_update, data_row):
fields = ["qty", "ordered_qty", "qty_to_order"]
for field in fields:
row_to_update[field] += flt(data_row[field])
def prepare_data(data, filters): def prepare_data(data, filters):
"""Prepare consolidated Report data and Chart data""" """Prepare consolidated Report data and Chart data"""
material_request_map = {} material_request_map, item_qty_map = {}, {}
for row in data: for row in data:
# item wise map for charts
if not row["item_code"] in item_qty_map:
item_qty_map[row["item_code"]] = {
"qty" : row["qty"],
"ordered_qty" : row["ordered_qty"],
"qty_to_order" : row["qty_to_order"]
}
else:
item_entry = item_qty_map[row["item_code"]]
update_qty_columns(item_entry, row)
if filters.get("group_by_mr"):
# consolidated material request map for group by filter
if not row["material_request"] in material_request_map: if not row["material_request"] in material_request_map:
# create an entry with mr as key # create an entry with mr as key
row_copy = copy.deepcopy(row) row_copy = copy.deepcopy(row)
@@ -87,12 +108,10 @@ def prepare_data(data, filters):
mr_row = material_request_map[row["material_request"]] mr_row = material_request_map[row["material_request"]]
mr_row["required_date"] = min(getdate(mr_row["required_date"]), getdate(row["required_date"])) mr_row["required_date"] = min(getdate(mr_row["required_date"]), getdate(row["required_date"]))
#sum numeric rows #sum numeric columns
fields = ["qty", "ordered_qty", "qty_to_order"] update_qty_columns(mr_row, row)
for field in fields:
mr_row[field] = flt(mr_row[field]) + flt(row[field])
chart_data = prepare_chart_data(material_request_map) chart_data = prepare_chart_data(item_qty_map)
if filters.get("group_by_mr"): if filters.get("group_by_mr"):
data =[] data =[]
@@ -102,12 +121,15 @@ def prepare_data(data, filters):
return data, chart_data return data, chart_data
def prepare_chart_data(data): def prepare_chart_data(item_data):
labels, qty_to_order, ordered_qty = [], [], [] labels, qty_to_order, ordered_qty = [], [], []
for row in data: if len(item_data) > 30:
mr_row = data[row] item_data = dict(list(item_data.items())[:30])
labels.append(mr_row["material_request"])
for row in item_data:
mr_row = item_data[row]
labels.append(row)
qty_to_order.append(mr_row["qty_to_order"]) qty_to_order.append(mr_row["qty_to_order"])
ordered_qty.append(mr_row["ordered_qty"]) ordered_qty.append(mr_row["ordered_qty"])

View File

@@ -1,8 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe import _ from frappe import _
def get_data(): def get_data():
return [ config = [
{ {
"label": _("Purchasing"), "label": _("Purchasing"),
"icon": "fa fa-star", "icon": "fa fa-star",
@@ -243,3 +244,21 @@ def get_data():
}, },
] ]
regional = {
"label": _("Regional"),
"items": [
{
"type": "doctype",
"name": "Import Supplier Invoice",
"description": _("Import Italian Supplier Invoice."),
"onboard": 1,
}
]
}
countries = frappe.get_all("Company", fields="country")
countries = [country["country"] for country in countries]
if "Italy" in countries:
config.append(regional)
return config

View File

@@ -361,7 +361,7 @@ class SellingController(StockController):
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no]))) self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
def set_gross_profit(self): def set_gross_profit(self):
if self.doctype == "Sales Order": if self.doctype in ["Sales Order", "Quotation"]:
for item in self.items: for item in self.items:
item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item)) item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))

View File

@@ -226,7 +226,7 @@ class StockController(AccountsController):
def check_expense_account(self, item): def check_expense_account(self, item):
if not item.get("expense_account"): if not item.get("expense_account"):
frappe.throw(_("Expense or Difference account is mandatory for Item {0} as it impacts overall stock value").format(item.item_code)) frappe.throw(_("Expense Account not set for Item {0}. Please set an Expense Account for the item in the Items table").format(item.item_code))
else: else:
is_expense_account = frappe.db.get_value("Account", is_expense_account = frappe.db.get_value("Account",

View File

@@ -155,7 +155,7 @@ def has_website_permission(doc, ptype, user, verbose=False):
return frappe.db.exists(doctype, get_customer_filter(doc, customers)) return frappe.db.exists(doctype, get_customer_filter(doc, customers))
elif suppliers: elif suppliers:
fieldname = 'suppliers' if doctype == 'Request for Quotation' else 'supplier' fieldname = 'suppliers' if doctype == 'Request for Quotation' else 'supplier'
return frappe.db.exists(doctype, filters={ return frappe.db.exists(doctype, {
'name': doc.name, 'name': doc.name,
fieldname: ["in", suppliers] fieldname: ["in", suppliers]
}) })

View File

@@ -21,8 +21,8 @@ def get_dashboards():
{ "chart": "Opportunity Trends", "width": "Full"}, { "chart": "Opportunity Trends", "width": "Full"},
{ "chart": "Won Opportunities", "width": "Full" }, { "chart": "Won Opportunities", "width": "Full" },
{ "chart": "Territory Wise Opportunity Count", "width": "Half"}, { "chart": "Territory Wise Opportunity Count", "width": "Half"},
{ "chart": "Territory Wise Sales", "width": "Half"},
{ "chart": "Opportunities via Campaigns", "width": "Half" }, { "chart": "Opportunities via Campaigns", "width": "Half" },
{ "chart": "Territory Wise Sales", "width": "Full"},
{ "chart": "Lead Source", "width": "Half"} { "chart": "Lead Source", "width": "Half"}
], ],
"cards": [ "cards": [
@@ -59,7 +59,7 @@ def get_charts():
'is_public': 1, 'is_public': 1,
'timeseries': 1, 'timeseries': 1,
"owner": "Administrator", "owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False]]), "filters_json": json.dumps([]),
"type": "Bar" "type": "Bar"
}, },
{ {
@@ -90,7 +90,11 @@ def get_charts():
'timeseries': 1, 'timeseries': 1,
"owner": "Administrator", "owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False]]), "filters_json": json.dumps([["Opportunity", "company", "=", company, False]]),
"type": "Pie" "type": "Pie",
"custom_options": json.dumps({
"truncateLegends": 1,
"maxSlices": 8
})
}, },
{ {
"name": "Won Opportunities", "name": "Won Opportunities",
@@ -123,7 +127,11 @@ def get_charts():
["Opportunity", "company", "=", company, False] ["Opportunity", "company", "=", company, False]
]), ]),
"owner": "Administrator", "owner": "Administrator",
"type": "Donut" "type": "Donut",
"custom_options": json.dumps({
"truncateLegends": 1,
"maxSlices": 8
})
}, },
{ {
"name": "Territory Wise Sales", "name": "Territory Wise Sales",
@@ -140,7 +148,7 @@ def get_charts():
["Opportunity", "company", "=", company, False], ["Opportunity", "company", "=", company, False],
["Opportunity", "status", "=", "Converted", False] ["Opportunity", "status", "=", "Converted", False]
]), ]),
"type": "Donut" "type": "Bar"
}, },
{ {
"name": "Lead Source", "name": "Lead Source",
@@ -152,7 +160,11 @@ def get_charts():
"document_type": "Lead", "document_type": "Lead",
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Pie" "type": "Pie",
"custom_options": json.dumps({
"truncateLegends": 1,
"maxSlices": 8
})
}] }]
def get_number_cards(): def get_number_cards():

View File

@@ -42,7 +42,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "CRM", "label": "CRM",
"modified": "2020-05-20 12:11:36.250491", "modified": "2020-05-28 13:33:52.906750",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "CRM", "name": "CRM",
@@ -52,6 +52,7 @@
"pin_to_top": 0, "pin_to_top": 0,
"shortcuts": [ "shortcuts": [
{ {
"color": "#ffe8cd",
"format": "{} Open", "format": "{} Open",
"label": "Lead", "label": "Lead",
"link_to": "Lead", "link_to": "Lead",
@@ -59,6 +60,7 @@
"type": "DocType" "type": "DocType"
}, },
{ {
"color": "#cef6d1",
"format": "{} Assigned", "format": "{} Assigned",
"label": "Opportunity", "label": "Opportunity",
"link_to": "Opportunity", "link_to": "Opportunity",
@@ -76,7 +78,7 @@
"type": "Report" "type": "Report"
}, },
{ {
"label": "CRM Dashboard", "label": "Dashboard",
"link_to": "CRM", "link_to": "CRM",
"type": "Dashboard" "type": "Dashboard"
} }

View File

@@ -16,7 +16,7 @@
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/CRM", "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/CRM",
"idx": 0, "idx": 0,
"is_complete": 0, "is_complete": 0,
"modified": "2020-05-20 12:53:47.029412", "modified": "2020-05-28 21:07:41.278784",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "CRM", "name": "CRM",
@@ -35,8 +35,8 @@
"step": "Create and Send Quotation" "step": "Create and Send Quotation"
} }
], ],
"subtitle": "Lead, Opportunity, Customer and more", "subtitle": "Lead, Opportunity, Customer and more.",
"success_message": "CRM Module is all setup!", "success_message": "CRM Module is all Set Up!",
"title": "Let's Setup Your CRM", "title": "Let's Set Up Your CRM.",
"user_can_dismiss": 1 "user_can_dismiss": 1
} }

View File

@@ -8,12 +8,12 @@
"is_mandatory": 0, "is_mandatory": 0,
"is_single": 0, "is_single": 0,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-14 17:30:07.887411", "modified": "2020-05-28 21:07:11.461172",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Create and Send Quotation", "name": "Create and Send Quotation",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Quotation", "reference_document": "Quotation",
"show_full_form": 0, "show_full_form": 1,
"title": "Create and Send Quotation", "title": "Create and Send Quotation",
"validate_action": 0 "validate_action": 1
} }

View File

@@ -8,12 +8,12 @@
"is_mandatory": 0, "is_mandatory": 0,
"is_single": 0, "is_single": 0,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-14 17:28:36.441387", "modified": "2020-05-28 21:07:01.373403",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Create Lead", "name": "Create Lead",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Lead", "reference_document": "Lead",
"show_full_form": 0, "show_full_form": 1,
"title": "Create Lead", "title": "Create Lead",
"validate_action": 0 "validate_action": 1
} }

View File

@@ -15,5 +15,5 @@
"reference_document": "Opportunity", "reference_document": "Opportunity",
"show_full_form": 0, "show_full_form": 0,
"title": "Create Opportunity", "title": "Create Opportunity",
"validate_action": 0 "validate_action": 1
} }

View File

@@ -14,6 +14,6 @@
"owner": "Administrator", "owner": "Administrator",
"show_full_form": 0, "show_full_form": 0,
"title": "Introduction to CRM", "title": "Introduction to CRM",
"validate_action": 0, "validate_action": 1,
"video_url": "https://www.youtube.com/watch?v=o9XCSZHJfpA" "video_url": "https://www.youtube.com/watch?v=o9XCSZHJfpA"
} }

View File

@@ -64,6 +64,11 @@
"hidden": 0, "hidden": 0,
"label": "Assessment Reports", "label": "Assessment Reports",
"links": "[\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Course wise Assessment Report\",\n \"name\": \"Course wise Assessment Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Final Assessment Grades\",\n \"name\": \"Final Assessment Grades\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Plan\"\n ],\n \"doctype\": \"Assessment Plan\",\n \"is_query_report\": true,\n \"label\": \"Assessment Plan Status\",\n \"name\": \"Assessment Plan Status\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Student Report Generation Tool\",\n \"name\": \"Student Report Generation Tool\",\n \"type\": \"doctype\"\n }\n]" "links": "[\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Course wise Assessment Report\",\n \"name\": \"Course wise Assessment Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Final Assessment Grades\",\n \"name\": \"Final Assessment Grades\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Plan\"\n ],\n \"doctype\": \"Assessment Plan\",\n \"is_query_report\": true,\n \"label\": \"Assessment Plan Status\",\n \"name\": \"Assessment Plan Status\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Student Report Generation Tool\",\n \"name\": \"Student Report Generation Tool\",\n \"type\": \"doctype\"\n }\n]"
},
{
"hidden": 0,
"label": "Reports",
"links": "[\n {\n \"dependencies\": [\n \"Fees\"\n ],\n \"doctype\": \"Fees\",\n \"is_query_report\": true,\n \"label\": \"Student Fee Collection\",\n \"name\": \"Student Fee Collection\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Student Monthly Attendance Sheet\",\n \"name\": \"Student Monthly Attendance Sheet\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Absent Student Report\",\n \"name\": \"Absent Student Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Program Enrollment\"\n ],\n \"doctype\": \"Program Enrollment\",\n \"is_query_report\": true,\n \"label\": \"Student and Guardian Contact Details\",\n \"name\": \"Student and Guardian Contact Details\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Student Batch-Wise Attendance\",\n \"name\": \"Student Batch-Wise Attendance\",\n \"type\": \"report\"\n }\n]"
} }
], ],
"category": "Domains", "category": "Domains",
@@ -77,7 +82,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Education", "label": "Education",
"modified": "2020-04-01 11:28:51.011309", "modified": "2020-05-22 01:09:13.058482",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Education", "module": "Education",
"name": "Education", "name": "Education",

View File

@@ -0,0 +1,17 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'assessment_plan',
'non_standard_fieldnames': {
},
'transactions': [
{
'label': _('Assessment'),
'items': ['Assessment Result']
}
]
}

View File

@@ -0,0 +1,25 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'course',
'non_standard_fieldnames': {
},
'transactions': [
{
'label': _('Course'),
'items': ['Course Enrollment', 'Course Schedule']
},
{
'label': _('Student'),
'items': ['Student Group']
},
{
'label': _('Assessment'),
'items': ['Assessment Plan']
},
]
}

View File

@@ -1,4 +1,5 @@
{ {
"actions": [],
"allow_import": 1, "allow_import": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2017-07-18 15:21:21.527136", "creation": "2017-07-18 15:21:21.527136",
@@ -7,6 +8,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"fee_structure", "fee_structure",
"posting_date",
"due_date", "due_date",
"naming_series", "naming_series",
"fee_creation_status", "fee_creation_status",
@@ -259,10 +261,18 @@
{ {
"fieldname": "dimension_col_break", "fieldname": "dimension_col_break",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date",
"reqd": 1
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"modified": "2019-05-26 09:10:34.522409", "links": [],
"modified": "2020-05-15 08:39:20.682837",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Education", "module": "Education",
"name": "Fee Schedule", "name": "Fee Schedule",

View File

@@ -87,6 +87,7 @@ def generate_fee(fee_schedule):
} }
} }
}) })
fees_doc.posting_date = doc.posting_date
fees_doc.student = student.student fees_doc.student = student.student
fees_doc.student_name = student.student_name fees_doc.student_name = student.student_name
fees_doc.program = student.program fees_doc.program = student.program

View File

@@ -95,10 +95,10 @@ def create_sales_order(shopify_order, shopify_settings, company=None):
items = get_order_items(shopify_order.get("line_items"), shopify_settings) items = get_order_items(shopify_order.get("line_items"), shopify_settings)
if not items: if not items:
message = 'Following items are exists in order but relevant record not found in Product master' message = 'Following items exists in the shopify order but relevant records were not found in the shopify Product master'
message += "\n" + ", ".join(product_not_exists) message += "\n" + ", ".join(product_not_exists)
make_shopify_log(status="Error", exception=e, rollback=True) make_shopify_log(status="Error", exception=message, rollback=True)
return '' return ''

View File

@@ -182,7 +182,8 @@ def set_items_in_sales_order(new_sales_order, woocommerce_settings, order, sys_l
company_abbr = frappe.db.get_value('Company', woocommerce_settings.company, 'abbr') company_abbr = frappe.db.get_value('Company', woocommerce_settings.company, 'abbr')
default_warehouse = _("Stores - {0}", sys_lang).format(company_abbr) default_warehouse = _("Stores - {0}", sys_lang).format(company_abbr)
if not frappe.db.exists("Warehouse", default_warehouse): if not frappe.db.exists("Warehouse", default_warehouse) \
and not woocommerce_settings.warehouse:
frappe.throw(_("Please set Warehouse in Woocommerce Settings")) frappe.throw(_("Please set Warehouse in Woocommerce Settings"))
for item in order.get("line_items"): for item in order.get("line_items"):

View File

@@ -124,10 +124,11 @@ def add_account_subtype(account_subtype):
@frappe.whitelist() @frappe.whitelist()
def sync_transactions(bank, bank_account): def sync_transactions(bank, bank_account):
'''Sync transactions based on the last integration date as the start date, after the sync is completed
last_sync_date = frappe.db.get_value("Bank Account", bank_account, "last_integration_date") add the transaction date of the oldest transaction as the last integration date'''
if last_sync_date: last_transaction_date = frappe.db.get_value("Bank Account", bank_account, "last_integration_date")
start_date = formatdate(last_sync_date, "YYYY-MM-dd") if last_transaction_date:
start_date = formatdate(last_transaction_date, "YYYY-MM-dd")
else: else:
start_date = formatdate(add_months(today(), -12), "YYYY-MM-dd") start_date = formatdate(add_months(today(), -12), "YYYY-MM-dd")
end_date = formatdate(today(), "YYYY-MM-dd") end_date = formatdate(today(), "YYYY-MM-dd")
@@ -139,12 +140,14 @@ def sync_transactions(bank, bank_account):
for transaction in reversed(transactions): for transaction in reversed(transactions):
result += new_bank_transaction(transaction) result += new_bank_transaction(transaction)
if result:
last_transaction_date = frappe.db.get_value('Bank Transaction', result.pop(), 'date')
frappe.logger().info("Plaid added {} new Bank Transactions from '{}' between {} and {}".format( frappe.logger().info("Plaid added {} new Bank Transactions from '{}' between {} and {}".format(
len(result), bank_account, start_date, end_date)) len(result), bank_account, start_date, end_date))
frappe.db.set_value("Bank Account", bank_account, "last_integration_date", getdate(end_date)) frappe.db.set_value("Bank Account", bank_account, "last_integration_date", last_transaction_date)
return result
except Exception: except Exception:
frappe.log_error(frappe.get_traceback(), _("Plaid transactions sync error")) frappe.log_error(frappe.get_traceback(), _("Plaid transactions sync error"))

View File

@@ -133,7 +133,7 @@
"label": "Customer Settings" "label": "Customer Settings"
}, },
{ {
"description": "If Shopify not contains a customer in Order, then while syncing Orders, the system will consider default customer for order", "description": "If Shopify does not have a customer in the order, then while syncing the orders, the system will consider the default customer for the order",
"fieldname": "default_customer", "fieldname": "default_customer",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Customer", "label": "Default Customer",
@@ -258,7 +258,7 @@
} }
], ],
"issingle": 1, "issingle": 1,
"modified": "2019-09-13 12:32:11.384757", "modified": "2020-05-28 12:32:11.384757",
"modified_by": "umair@erpnext.com", "modified_by": "umair@erpnext.com",
"module": "ERPNext Integrations", "module": "ERPNext Integrations",
"name": "Shopify Settings", "name": "Shopify Settings",

View File

@@ -19,7 +19,7 @@ def get_company():
else: else:
company = frappe.get_list("Company", limit=1) company = frappe.get_list("Company", limit=1)
if company: if company:
return company.name return company[0].name
return None return None
def get_dashboards(): def get_dashboards():
@@ -71,7 +71,7 @@ def get_charts():
"chart_name": _("Department wise Patient Appointments"), "chart_name": _("Department wise Patient Appointments"),
"chart_type": "Custom", "chart_type": "Custom",
"source": "Department wise Patient Appointments", "source": "Department wise Patient Appointments",
"filters_json": json.dumps({}), "filters_json": json.dumps([]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Bar", "type": "Bar",
@@ -159,7 +159,7 @@ def get_charts():
"document_type": "Patient Encounter Symptom", "document_type": "Patient Encounter Symptom",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "complaint", "group_by_based_on": "complaint",
"filters_json": json.dumps({}), "filters_json": json.dumps([]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Percentage", "type": "Percentage",
@@ -173,7 +173,7 @@ def get_charts():
"document_type": "Patient Encounter Diagnosis", "document_type": "Patient Encounter Diagnosis",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "diagnosis", "group_by_based_on": "diagnosis",
"filters_json": json.dumps({}), "filters_json": json.dumps([]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Percentage", "type": "Percentage",
@@ -229,7 +229,7 @@ def get_number_cards():
}, },
{ {
"name": "Appointments to Bill", "name": "Appointments to Bill",
"label": _("Appointments to Bill"), "label": _("Appointments To Bill"),
"function": "Count", "function": "Count",
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Patient Appointment", "document_type": "Patient Appointment",

View File

@@ -64,7 +64,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Healthcare", "label": "Healthcare",
"modified": "2020-05-19 20:57:22.797267", "modified": "2020-05-28 19:02:28.824995",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Healthcare", "name": "Healthcare",
@@ -109,7 +109,7 @@
"type": "Page" "type": "Page"
}, },
{ {
"label": "Healthcare Dashboard", "label": "Dashboard",
"link_to": "Healthcare", "link_to": "Healthcare",
"type": "Dashboard" "type": "Dashboard"
} }

View File

@@ -57,19 +57,19 @@ frappe.tour['Healthcare Settings'] = [
description: __('Checking this will automatically create a Sales Invoice whenever an appointment is booked for a Patient.') description: __('Checking this will automatically create a Sales Invoice whenever an appointment is booked for a Patient.')
}, },
{ {
fieldname: 'healthcare_service_items', fieldname: 'inpatient_visit_charge_item',
title: __('Healthcare Service Items'), title: __('Healthcare Service Items'),
description: __('Set up the Healthcare Service Items for billing. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#2-default-healthcare-service-items' target='_blank'>here</a>" + __(' to know more') description: __('You can create a service item for Inpatient Visit Charge and set it here. Similarly, you can set up other Healthcare Service Items for billing in this section. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#2-default-healthcare-service-items' target='_blank'>here</a>" + __(' to know more')
}, },
{ {
fieldname: 'sb_in_ac', fieldname: 'income_account',
title: __('Set up default Accounts for the Healthcare Facility'), title: __('Set up default Accounts for the Healthcare Facility'),
description: __('If you wish to override default accounts settings and configure the Income and Receivable accounts for Healthcare, you can do so here.') description: __('If you wish to override default accounts settings and configure the Income and Receivable accounts for Healthcare, you can do so here.')
}, },
{ {
fieldname: 'out_patient_sms_alerts', fieldname: 'send_registration_msg',
title: __('Out Patient SMS alerts'), title: __('Out Patient SMS alerts'),
description: __('You can set up Out Patient SMS alerts here. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#4-out-patient-sms-alerts' target='_blank'>here</a>" + __(' to know more') description: __('If you want to send SMS alert on Patient Registration, you can enable this option. Similary, you can set up Out Patient SMS alerts for other functionalities in this section. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#4-out-patient-sms-alerts' target='_blank'>here</a>" + __(' to know more')
} }
]; ];

View File

@@ -11,6 +11,7 @@
"patient", "patient",
"assessment_template", "assessment_template",
"column_break_4", "column_break_4",
"company",
"healthcare_practitioner", "healthcare_practitioner",
"assessment_datetime", "assessment_datetime",
"assessment_description", "assessment_description",
@@ -127,11 +128,18 @@
"fieldname": "assessment_description", "fieldname": "assessment_description",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Assessment Description" "label": "Assessment Description"
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Company",
"options": "Company"
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-04-21 13:23:09.815007", "modified": "2020-05-25 14:38:38.302399",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Patient Assessment", "name": "Patient Assessment",

View File

@@ -85,11 +85,9 @@
{ {
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "in_standard_filter": 1,
"label": "Company", "label": "Company",
"options": "Company", "options": "Company"
"print_hide": 1,
"report_hide": 1
}, },
{ {
"fieldname": "section_break_6", "fieldname": "section_break_6",
@@ -167,7 +165,7 @@
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-04-04 19:17:02.707203", "modified": "2020-05-25 14:36:46.990469",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Sample Collection", "name": "Sample Collection",

View File

@@ -10,6 +10,7 @@
"patient", "patient",
"patient_name", "patient_name",
"column_break_4", "column_break_4",
"company",
"status", "status",
"start_date", "start_date",
"section_break_3", "section_break_3",
@@ -98,10 +99,17 @@
"label": "Status", "label": "Status",
"options": "Not Started\nIn Progress\nCompleted\nCancelled", "options": "Not Started\nIn Progress\nCompleted\nCancelled",
"read_only": 1 "read_only": 1
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Company",
"options": "Company"
} }
], ],
"links": [], "links": [],
"modified": "2020-04-21 13:13:43.956014", "modified": "2020-05-25 14:38:53.649315",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Therapy Plan", "name": "Therapy Plan",

View File

@@ -10,7 +10,7 @@
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/healthcare", "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/healthcare",
"idx": 0, "idx": 0,
"is_complete": 0, "is_complete": 0,
"modified": "2020-05-19 12:52:09.757729", "modified": "2020-05-26 23:16:37.603361",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Healthcare", "name": "Healthcare",
@@ -19,14 +19,14 @@
{ {
"step": "Create Patient" "step": "Create Patient"
}, },
{
"step": "Create Practitioner"
},
{ {
"step": "Create Practitioner Schedule" "step": "Create Practitioner Schedule"
}, },
{ {
"step": "Setup Schedule and Employee for Healthcare Practitioner" "step": "Introduction to Healthcare Practitioner"
},
{
"step": "Create Healthcare Practitioner"
}, },
{ {
"step": "Explore Healthcare Settings" "step": "Explore Healthcare Settings"

View File

@@ -1,6 +1,6 @@
{ {
"action": "Create Entry", "action": "Create Entry",
"creation": "2020-05-19 10:39:55.728057", "creation": "2020-05-19 10:39:55.728058",
"docstatus": 0, "docstatus": 0,
"doctype": "Onboarding Step", "doctype": "Onboarding Step",
"idx": 0, "idx": 0,
@@ -8,12 +8,12 @@
"is_mandatory": 1, "is_mandatory": 1,
"is_single": 0, "is_single": 0,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-19 12:27:39.851375", "modified": "2020-05-26 23:16:31.965521",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Create Practitioner", "name": "Create Healthcare Practitioner",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Healthcare Practitioner", "reference_document": "Healthcare Practitioner",
"show_full_form": 1, "show_full_form": 1,
"title": "Create Practitioner", "title": "Create Healthcare Practitioner",
"validate_action": 1 "validate_action": 1
} }

View File

@@ -8,7 +8,7 @@
"is_mandatory": 0, "is_mandatory": 0,
"is_single": 0, "is_single": 0,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-19 11:46:35.085270", "modified": "2020-05-26 23:10:24.504030",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Explore Clinical Procedure Templates", "name": "Explore Clinical Procedure Templates",
"owner": "Administrator", "owner": "Administrator",

View File

@@ -8,7 +8,7 @@
"is_mandatory": 1, "is_mandatory": 1,
"is_single": 1, "is_single": 1,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-19 12:26:48.682673", "modified": "2020-05-26 23:10:24.507648",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Explore Healthcare Settings", "name": "Explore Healthcare Settings",
"owner": "Administrator", "owner": "Administrator",

View File

@@ -9,12 +9,12 @@
"is_mandatory": 1, "is_mandatory": 1,
"is_single": 0, "is_single": 0,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-19 12:26:42.492734", "modified": "2020-05-26 22:07:07.482530",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Setup Schedule and Employee for Healthcare Practitioner", "name": "Introduction to Healthcare Practitioner",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Healthcare Practitioner", "reference_document": "Healthcare Practitioner",
"show_full_form": 0, "show_full_form": 0,
"title": "Setup Schedule and Employee for Healthcare Practitioner", "title": "Introduction to Healthcare Practitioner",
"validate_action": 0 "validate_action": 0
} }

View File

@@ -198,7 +198,18 @@ def add_healthcare_service_unit_tree_root():
{ {
"doctype": "Healthcare Service Unit", "doctype": "Healthcare Service Unit",
"healthcare_service_unit_name": "All Healthcare Service Units", "healthcare_service_unit_name": "All Healthcare Service Units",
"is_group": 1 "is_group": 1,
"company": get_company()
} }
] ]
insert_record(record) insert_record(record)
def get_company():
company = frappe.defaults.get_defaults().company
if company:
return company
else:
company = frappe.get_list("Company", limit=1)
if company:
return company[0].name
return None

View File

@@ -512,10 +512,10 @@ def get_children(doctype, parent, company, is_root=False):
def get_patient_vitals(patient, from_date=None, to_date=None): def get_patient_vitals(patient, from_date=None, to_date=None):
if not patient: return if not patient: return
vitals = frappe.db.get_all('Vital Signs', { vitals = frappe.db.get_all('Vital Signs', filters={
'docstatus': 1, 'docstatus': 1,
'patient': patient 'patient': patient
}, order_by='signs_date, signs_time') }, order_by='signs_date, signs_time', fields=['*'])
if len(vitals): if len(vitals):
return vitals return vitals

View File

@@ -143,7 +143,7 @@ def get_number_cards():
number_cards.append( number_cards.append(
get_number_cards_doc("Employee", "Employees Left (Last year)", filters_json = json.dumps([ get_number_cards_doc("Employee", "Employees Left (Last year)", filters_json = json.dumps([
["Employee", "modified", "Previous", "1 year"], ["Employee", "relieving_date", "Previous", "1 year"],
["Employee", "status", "=", "Left"] ["Employee", "status", "=", "Left"]
]) ])
) )

View File

@@ -93,7 +93,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "HR", "label": "HR",
"modified": "2020-05-20 11:20:54.255557", "modified": "2020-05-28 13:36:07.710600",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "HR", "name": "HR",
@@ -103,37 +103,40 @@
"pin_to_top": 0, "pin_to_top": 0,
"shortcuts": [ "shortcuts": [
{ {
"color": "#cef6d1",
"format": "{} Active", "format": "{} Active",
"label": "Employee", "label": "Employee",
"link_to": "Employee", "link_to": "Employee",
"stats_filter": "{\"status\":\"Active\"}", "stats_filter": "{\"status\":\"Active\"}",
"type": "DocType" "type": "DocType"
}, },
{
"color": "#ffe8cd",
"format": "{} Open",
"label": "Leave Application",
"link_to": "Leave Application",
"stats_filter": "{\"status\":\"Open\"}",
"type": "DocType"
},
{ {
"label": "Attendance", "label": "Attendance",
"link_to": "Attendance", "link_to": "Attendance",
"stats_filter": "", "stats_filter": "",
"type": "DocType" "type": "DocType"
}, },
{
"label": "Leave Application",
"link_to": "Leave Application",
"stats_filter": "{\"status\":\"Open\"}",
"type": "DocType"
},
{ {
"label": "Salary Structure", "label": "Salary Structure",
"link_to": "Payroll Entry", "link_to": "Payroll Entry",
"type": "DocType" "type": "DocType"
}, },
{ {
"label": "Salary Register", "label": "Monthly Attendance Sheet",
"link_to": "Monthly Attendance Sheet", "link_to": "Monthly Attendance Sheet",
"type": "Report" "type": "Report"
}, },
{ {
"format": "{} Open", "format": "{} Open",
"label": "HR Dashboard", "label": "Dashboard",
"link_to": "Human Resource", "link_to": "Human Resource",
"stats_filter": "{\n \"status\": \"Open\"\n}", "stats_filter": "{\n \"status\": \"Open\"\n}",
"type": "Dashboard" "type": "Dashboard"

View File

@@ -37,7 +37,7 @@ class AdditionalSalary(Document):
frappe.throw(_("Payroll date can not be less than employee's joining date.")) frappe.throw(_("Payroll date can not be less than employee's joining date."))
elif getdate(self.from_date) < getdate(date_of_joining): elif getdate(self.from_date) < getdate(date_of_joining):
frappe.throw(_("From date can not be less than employee's joining date.")) frappe.throw(_("From date can not be less than employee's joining date."))
elif getdate(self.to_date) > getdate(relieving_date): elif relieving_date and getdate(self.to_date) > getdate(relieving_date):
frappe.throw(_("To date can not be greater than employee's relieving date.")) frappe.throw(_("To date can not be greater than employee's relieving date."))
def get_amount(self, sal_start_date, sal_end_date): def get_amount(self, sal_start_date, sal_end_date):

View File

@@ -438,14 +438,23 @@ def get_leave_details(employee, date):
leave_allocation = {} leave_allocation = {}
for d in allocation_records: for d in allocation_records:
allocation = allocation_records.get(d, frappe._dict()) allocation = allocation_records.get(d, frappe._dict())
total_allocated_leaves = frappe.db.get_value('Leave Allocation', {
'from_date': ('<=', date),
'to_date': ('>=', date),
'leave_type': allocation.leave_type,
}, 'SUM(total_leaves_allocated)') or 0
remaining_leaves = get_leave_balance_on(employee, d, date, to_date = allocation.to_date, remaining_leaves = get_leave_balance_on(employee, d, date, to_date = allocation.to_date,
consider_all_leaves_in_the_allocation_period=True) consider_all_leaves_in_the_allocation_period=True)
end_date = allocation.to_date end_date = allocation.to_date
leaves_taken = get_leaves_for_period(employee, d, allocation.from_date, end_date) * -1 leaves_taken = get_leaves_for_period(employee, d, allocation.from_date, end_date) * -1
leaves_pending = get_pending_leaves_for_period(employee, d, allocation.from_date, end_date) leaves_pending = get_pending_leaves_for_period(employee, d, allocation.from_date, end_date)
leave_allocation[d] = { leave_allocation[d] = {
"total_leaves": allocation.total_leaves_allocated, "total_leaves": total_allocated_leaves,
"expired_leaves": total_allocated_leaves - (remaining_leaves + leaves_taken),
"leaves_taken": leaves_taken, "leaves_taken": leaves_taken,
"pending_leaves": leaves_pending, "pending_leaves": leaves_pending,
"remaining_leaves": remaining_leaves} "remaining_leaves": remaining_leaves}

View File

@@ -4,11 +4,12 @@
<table class="table table-bordered small"> <table class="table table-bordered small">
<thead> <thead>
<tr> <tr>
<th style="width: 20%">{{ __("Leave Type") }}</th> <th style="width: 16%">{{ __("Leave Type") }}</th>
<th style="width: 20%" class="text-right">{{ __("Total Allocated Leaves") }}</th> <th style="width: 16%" class="text-right">{{ __("Total Allocated Leaves") }}</th>
<th style="width: 20%" class="text-right">{{ __("Used Leaves") }}</th> <th style="width: 16%" class="text-right">{{ __("Expired Leaves") }}</th>
<th style="width: 20%" class="text-right">{{ __("Pending Leaves") }}</th> <th style="width: 16%" class="text-right">{{ __("Used Leaves") }}</th>
<th style="width: 20%" class="text-right">{{ __("Available Leaves") }}</th> <th style="width: 16%" class="text-right">{{ __("Pending Leaves") }}</th>
<th style="width: 16%" class="text-right">{{ __("Available Leaves") }}</th>
</tr> </tr>
</thead> </thead>
@@ -17,6 +18,7 @@
<tr> <tr>
<td> {%= key %} </td> <td> {%= key %} </td>
<td class="text-right"> {%= value["total_leaves"] %} </td> <td class="text-right"> {%= value["total_leaves"] %} </td>
<td class="text-right"> {%= value["expired_leaves"] %} </td>
<td class="text-right"> {%= value["leaves_taken"] %} </td> <td class="text-right"> {%= value["leaves_taken"] %} </td>
<td class="text-right"> {%= value["pending_leaves"] %} </td> <td class="text-right"> {%= value["pending_leaves"] %} </td>
<td class="text-right"> {%= value["remaining_leaves"] %} </td> <td class="text-right"> {%= value["remaining_leaves"] %} </td>

View File

@@ -22,6 +22,9 @@ def get_template():
args = frappe.local.form_dict args = frappe.local.form_dict
if getdate(args.from_date) > getdate(args.to_date):
frappe.throw(_("To Date should be greater than From Date"))
w = UnicodeWriter() w = UnicodeWriter()
w = add_header(w) w = add_header(w)

View File

@@ -1,6 +1,6 @@
{ {
"action": "Create Entry", "action": "Create Entry",
"creation": "2020-05-14 11:47:34.700174", "creation": "2020-05-28 11:47:34.700174",
"docstatus": 0, "docstatus": 0,
"doctype": "Onboarding Step", "doctype": "Onboarding Step",
"idx": 0, "idx": 0,
@@ -13,7 +13,7 @@
"name": "Create Holiday list", "name": "Create Holiday list",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Holiday List", "reference_document": "Holiday List",
"show_full_form": 0, "show_full_form": 1,
"title": "Create Holiday list", "title": "Create Holiday List",
"validate_action": 0 "validate_action": 0
} }

View File

@@ -1,6 +1,6 @@
{ {
"action": "Create Entry", "action": "Create Entry",
"creation": "2020-05-20 11:17:31.119312", "creation": "2020-05-27 11:17:31.119312",
"docstatus": 0, "docstatus": 0,
"doctype": "Onboarding Step", "doctype": "Onboarding Step",
"idx": 0, "idx": 0,
@@ -13,7 +13,7 @@
"name": "Create Leave Type", "name": "Create Leave Type",
"owner": "Administrator", "owner": "Administrator",
"reference_document": "Leave Type", "reference_document": "Leave Type",
"show_full_form": 0, "show_full_form": 1,
"title": "Create Leave Type", "title": "Create Leave Type",
"validate_action": 0 "validate_action": 0
} }

View File

@@ -1,6 +1,6 @@
{ {
"action": "Update Settings", "action": "Update Settings",
"creation": "2020-05-14 13:13:52.427711", "creation": "2020-05-28 13:13:52.427711",
"docstatus": 0, "docstatus": 0,
"doctype": "Onboarding Step", "doctype": "Onboarding Step",
"idx": 0, "idx": 0,
@@ -14,6 +14,6 @@
"owner": "Administrator", "owner": "Administrator",
"reference_document": "HR Settings", "reference_document": "HR Settings",
"show_full_form": 0, "show_full_form": 0,
"title": "HR settings", "title": "HR Settings",
"validate_action": 0 "validate_action": 0
} }

View File

@@ -26,7 +26,7 @@ def get_columns():
return [ return [
_("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", _("Date of Birth")+ ":Date:100", _("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", _("Date of Birth")+ ":Date:100",
_("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120", _("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120",
_("Designation") + ":Link/Designation:120", _("Gender") + "::60", _("Company") + ":Link/Company:120" _("Designation") + ":Link/Designation:120", _("Gender") + "::100", _("Company") + ":Link/Company:120"
] ]
def get_conditions(filters): def get_conditions(filters):
@@ -43,7 +43,12 @@ def get_employees(filters):
gender, company from `tabEmployee` where status = 'Active' %s""" % conditions, as_list=1) gender, company from `tabEmployee` where status = 'Active' %s""" % conditions, as_list=1)
def get_parameters(filters): def get_parameters(filters):
return frappe.db.sql("""select name from `tab"""+filters.get("parameter")+"""` """, as_list=1) if filters.get("parameter") == "Grade":
parameter = "Employee Grade"
else:
parameter = filters.get("parameter")
return frappe.db.sql("""select name from `tab"""+ parameter +"""` """, as_list=1)
def get_chart_data(parameters,employees, filters): def get_chart_data(parameters,employees, filters):
if not parameters: if not parameters:

View File

@@ -3,13 +3,13 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import flt from frappe.utils import flt, add_days
from frappe import _ from frappe import _
from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on, get_leave_allocation_records from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on
def execute(filters=None): def execute(filters=None):
if filters.to_date <= filters.from_date: if filters.to_date <= filters.from_date:
frappe.throw(_('From date can not be greater than than To date')) frappe.throw(_('"From date" can not be greater than or equal to "To date"'))
columns = get_columns() columns = get_columns()
data = get_data(filters) data = get_data(filters)
@@ -104,14 +104,17 @@ def get_data(filters):
new_allocation, expired_leaves = get_allocated_and_expired_leaves(filters.from_date, filters.to_date, employee.name, leave_type) new_allocation, expired_leaves = get_allocated_and_expired_leaves(filters.from_date, filters.to_date, employee.name, leave_type)
opening = get_leave_balance_on(employee.name, leave_type, filters.from_date) opening = get_leave_balance_on(employee.name, leave_type, add_days(filters.from_date, -1)) #allocation boundary condition
closing = get_leave_balance_on(employee.name, leave_type, filters.to_date)
row.leaves_allocated = new_allocation row.leaves_allocated = new_allocation
row.leaves_expired = expired_leaves - leaves_taken if expired_leaves - leaves_taken > 0 else 0 row.leaves_expired = expired_leaves - leaves_taken if expired_leaves - leaves_taken > 0 else 0
row.opening_balance = opening row.opening_balance = opening
row.leaves_taken = leaves_taken row.leaves_taken = leaves_taken
row.closing_balance = closing
# not be shown on the basis of days left it create in user mind for carry_forward leave
row.closing_balance = (new_allocation + opening - (row.leaves_expired + leaves_taken))
row.indent = 1 row.indent = 1
data.append(row) data.append(row)
new_leaves_allocated = 0 new_leaves_allocated = 0
@@ -177,7 +180,7 @@ def get_allocated_and_expired_leaves(from_date, to_date, employee, leave_type):
}, as_dict=1) }, as_dict=1)
for record in records: for record in records:
if record.to_date <= getdate(to_date): if record.to_date < getdate(to_date):
expired_leaves += record.leaves expired_leaves += record.leaves
if record.from_date >= getdate(from_date): if record.from_date >= getdate(from_date):

View File

@@ -6,7 +6,7 @@ import frappe
from frappe import _ from frappe import _
from frappe.utils import flt from frappe.utils import flt
from erpnext.hr.doctype.leave_application.leave_application \ from erpnext.hr.doctype.leave_application.leave_application \
import get_leave_balance_on, get_leaves_for_period import get_leave_details
from erpnext.hr.report.employee_leave_balance.employee_leave_balance \ from erpnext.hr.report.employee_leave_balance.employee_leave_balance \
import get_department_leave_approver_map import get_department_leave_approver_map
@@ -61,14 +61,14 @@ def get_data(filters, leave_types):
if (len(leave_approvers) and user in leave_approvers) or (user in ["Administrator", employee.user_id]) or ("HR Manager" in frappe.get_roles(user)): if (len(leave_approvers) and user in leave_approvers) or (user in ["Administrator", employee.user_id]) or ("HR Manager" in frappe.get_roles(user)):
row = [employee.name, employee.employee_name, employee.department] row = [employee.name, employee.employee_name, employee.department]
available_leave = get_leave_details(employee.name, filters.date)
for leave_type in leave_types: for leave_type in leave_types:
remaining = 0
if leave_type in available_leave["leave_allocation"]:
# opening balance # opening balance
opening = get_leave_balance_on(employee.name, leave_type, filters.date) remaining = available_leave["leave_allocation"][leave_type]['remaining_leaves']
row += [remaining]
row += [opening]
data.append(row) data.append(row)

View File

@@ -135,7 +135,7 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
row += [emp, emp_det.employee_name] row += [emp, emp_det.employee_name]
total_p = total_a = total_l = total_h = total_um= 0.0 total_p = total_a = total_l = total_h = total_um= 0.0
ggg = [] emp_status_map = []
for day in range(filters["total_days_in_month"]): for day in range(filters["total_days_in_month"]):
status = None status = None
status = att_map.get(emp).get(day + 1) status = att_map.get(emp).get(day + 1)
@@ -152,11 +152,10 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
status = "Holiday" status = "Holiday"
total_h += 1 total_h += 1
ggg.append(status_map.get(status, "")) abbr = status_map.get(status, "")
emp_status_map.append(abbr)
if not filters.summarized_view: if filters.summarized_view:
row += ggg
else:
if status == "Present" or status == "Work From Home": if status == "Present" or status == "Work From Home":
total_p += 1 total_p += 1
elif status == "Absent": elif status == "Absent":
@@ -170,6 +169,9 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
elif not status: elif not status:
total_um += 1 total_um += 1
if not filters.summarized_view:
row += emp_status_map
if filters.summarized_view: if filters.summarized_view:
row += [total_p, total_l, total_a, total_h, total_um] row += [total_p, total_l, total_a, total_h, total_um]
@@ -203,7 +205,7 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
row.append("0.0") row.append("0.0")
row.extend([time_default_counts[0][0],time_default_counts[0][1]]) row.extend([time_default_counts[0][0],time_default_counts[0][1]])
emp_att_map[emp] = ggg emp_att_map[emp] = emp_status_map
record.append(row) record.append(row)
return record, emp_att_map return record, emp_att_map
@@ -216,7 +218,7 @@ def get_columns(filters):
columns = [_(filters.group_by)+ ":Link/Branch:120"] columns = [_(filters.group_by)+ ":Link/Branch:120"]
columns += [ columns += [
_("Employee") + ":Link/Employee:120", _("Employee Name") + ":Link/Employee:120" _("Employee") + ":Link/Employee:120", _("Employee Name") + ":Data/:120"
] ]
days = [] days = []
for day in range(filters["total_days_in_month"]): for day in range(filters["total_days_in_month"]):

View File

@@ -34,20 +34,24 @@
"docstatus": 0, "docstatus": 0,
"doctype": "Desk Page", "doctype": "Desk Page",
"extends_another_page": 0, "extends_another_page": 0,
"hide_custom": 0,
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Loan Management", "label": "Loan",
"modified": "2020-04-02 11:28:51.380509", "modified": "2020-05-28 13:37:42.017709",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Loan Management", "module": "Loan Management",
"name": "Loan Management", "name": "Loan",
"owner": "Administrator", "owner": "Administrator",
"pin_to_bottom": 0, "pin_to_bottom": 0,
"pin_to_top": 0, "pin_to_top": 0,
"shortcuts": [ "shortcuts": [
{ {
"color": "#ffe8cd",
"format": "{} Open",
"label": "Loan Application", "label": "Loan Application",
"link_to": "Loan Application", "link_to": "Loan Application",
"stats_filter": "{ \"status\": \"Open\" }",
"type": "DocType" "type": "DocType"
}, },
{ {

View File

@@ -3,7 +3,7 @@
import frappe, erpnext, json import frappe, erpnext, json
from frappe import _ from frappe import _
from frappe.utils import nowdate, get_date_str from frappe.utils import nowdate, get_first_day, get_last_day, add_months
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
def get_data(): def get_data():
@@ -28,10 +28,10 @@ def get_dashboards():
{ "chart": "Job Card Analysis", "width": "Full" } { "chart": "Job Card Analysis", "width": "Full" }
], ],
"cards": [ "cards": [
{ "card": "Total Work Order" }, { "card": "Monthly Total Work Order" },
{ "card": "Completed Work Order" }, { "card": "Monthly Completed Work Order" },
{ "card": "Ongoing Job Card" }, { "card": "Ongoing Job Card" },
{ "card": "Total Quality Inspection"} { "card": "Monthly Quality Inspection"}
] ]
}] }]
@@ -180,38 +180,37 @@ def get_charts():
}] }]
def get_number_cards(): def get_number_cards():
fiscal_year = get_fiscal_year(date=nowdate()) start_date = add_months(nowdate(), -1)
year_start_date = get_date_str(fiscal_year[1]) end_date = nowdate()
year_end_date = get_date_str(fiscal_year[2])
return [{ return [{
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Work Order", "document_type": "Work Order",
"name": "Total Work Order", "name": "Monthly Total Work Order",
"filters_json": json.dumps([ "filters_json": json.dumps([
['Work Order', 'docstatus', '=', 1], ['Work Order', 'docstatus', '=', 1],
['Work Order', 'creation', 'between', [year_start_date, year_end_date]] ['Work Order', 'creation', 'between', [start_date, end_date]]
]), ]),
"function": "Count", "function": "Count",
"is_public": 1, "is_public": 1,
"label": _("Total Work Order"), "label": _("Monthly Total Work Order"),
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Monthly" "stats_time_interval": "Weekly"
}, },
{ {
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Work Order", "document_type": "Work Order",
"name": "Completed Work Order", "name": "Monthly Completed Work Order",
"filters_json": json.dumps([ "filters_json": json.dumps([
['Work Order', 'status', '=', 'Completed'], ['Work Order', 'status', '=', 'Completed'],
['Work Order', 'docstatus', '=', 1], ['Work Order', 'docstatus', '=', 1],
['Work Order', 'creation', 'between', [year_start_date, year_end_date]] ['Work Order', 'creation', 'between', [start_date, end_date]]
]), ]),
"function": "Count", "function": "Count",
"is_public": 1, "is_public": 1,
"label": _("Completed Work Order"), "label": _("Monthly Completed Work Order"),
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Monthly" "stats_time_interval": "Weekly"
}, },
{ {
"doctype": "Number Card", "doctype": "Number Card",
@@ -225,16 +224,19 @@ def get_number_cards():
"is_public": 1, "is_public": 1,
"label": _("Ongoing Job Card"), "label": _("Ongoing Job Card"),
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Monthly" "stats_time_interval": "Weekly"
}, },
{ {
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Quality Inspection", "document_type": "Quality Inspection",
"name": "Total Quality Inspection", "name": "Monthly Quality Inspection",
"filters_json": json.dumps([['Quality Inspection', 'docstatus', '=', 1]]), "filters_json": json.dumps([
['Quality Inspection', 'docstatus', '=', 1],
['Quality Inspection', 'creation', 'between', [start_date, end_date]]
]),
"function": "Count", "function": "Count",
"is_public": 1, "is_public": 1,
"label": _("Total Quality Inspection"), "label": _("Monthly Quality Inspection"),
"show_percentage_stats": 1, "show_percentage_stats": 1,
"stats_time_interval": "Monthly" "stats_time_interval": "Weekly"
}] }]

View File

@@ -47,7 +47,7 @@
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "Manufacturing", "label": "Manufacturing",
"modified": "2020-05-20 11:50:20.029056", "modified": "2020-05-28 13:54:02.048419",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Manufacturing", "name": "Manufacturing",
@@ -58,6 +58,7 @@
"restrict_to_domain": "Manufacturing", "restrict_to_domain": "Manufacturing",
"shortcuts": [ "shortcuts": [
{ {
"color": "#cef6d1",
"format": "{} Active", "format": "{} Active",
"label": "Item", "label": "Item",
"link_to": "Item", "link_to": "Item",
@@ -66,6 +67,7 @@
"type": "DocType" "type": "DocType"
}, },
{ {
"color": "#cef6d1",
"format": "{} Active", "format": "{} Active",
"label": "BOM", "label": "BOM",
"link_to": "BOM", "link_to": "BOM",
@@ -74,6 +76,7 @@
"type": "DocType" "type": "DocType"
}, },
{ {
"color": "#ffe8cd",
"format": "{} Open", "format": "{} Open",
"label": "Work Order", "label": "Work Order",
"link_to": "Work Order", "link_to": "Work Order",
@@ -82,6 +85,7 @@
"type": "DocType" "type": "DocType"
}, },
{ {
"color": "#ffe8cd",
"format": "{} Open", "format": "{} Open",
"label": "Production Plan", "label": "Production Plan",
"link_to": "Production Plan", "link_to": "Production Plan",

View File

@@ -113,7 +113,13 @@ class BOM(WebsiteGenerator):
self.set("operations", []) self.set("operations", [])
for d in frappe.get_all("BOM Operation", fields = ["*"], for d in frappe.get_all("BOM Operation", fields = ["*"],
filters = {'parenttype': 'Routing', 'parent': self.routing}): filters = {'parenttype': 'Routing', 'parent': self.routing}):
child = self.append('operations', d) child = self.append('operations', {
"operation": d.operation,
"workstation": d.workstation,
"description": d.description,
"time_in_mins": d.time_in_mins,
"batch_size": d.batch_size
})
child.hour_rate = flt(d.hour_rate / self.conversion_rate, 2) child.hour_rate = flt(d.hour_rate / self.conversion_rate, 2)
def set_bom_material_details(self): def set_bom_material_details(self):

View File

@@ -1,11 +1,13 @@
{ {
"actions": [], "actions": [],
"allow_import": 1, "allow_import": 1,
"autoname": "naming_series:",
"creation": "2020-04-18 04:50:46.187638", "creation": "2020-04-18 04:50:46.187638",
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"naming_series",
"workstation", "workstation",
"operator", "operator",
"column_break_4", "column_break_4",
@@ -78,10 +80,17 @@
"fieldname": "remarks", "fieldname": "remarks",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Remarks" "label": "Remarks"
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Naming Series",
"options": "DT-",
"reqd": 1
} }
], ],
"links": [], "links": [],
"modified": "2020-05-19 12:59:37.358483", "modified": "2020-05-26 22:14:54.479831",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Downtime Entry", "name": "Downtime Entry",

View File

@@ -102,8 +102,11 @@ class JobCard(Document):
workstation_doc = frappe.get_cached_doc("Workstation", self.workstation) workstation_doc = frappe.get_cached_doc("Workstation", self.workstation)
if (not workstation_doc.working_hours or if (not workstation_doc.working_hours or
cint(frappe.db.get_single_value("Manufacturing Settings", "allow_overtime"))): cint(frappe.db.get_single_value("Manufacturing Settings", "allow_overtime"))):
row.remaining_time_in_mins -= time_diff_in_minutes(row.planned_end_time, if get_datetime(row.planned_end_time) < get_datetime(row.planned_start_time):
row.planned_start_time) row.planned_end_time = add_to_date(row.planned_start_time, minutes=row.time_in_mins)
row.remaining_time_in_mins = 0.0
else:
row.remaining_time_in_mins -= time_diff_in_minutes(row.planned_end_time, row.planned_start_time)
self.update_time_logs(row) self.update_time_logs(row)
return return

View File

@@ -3,3 +3,31 @@
frappe.ui.form.on('Manufacturing Settings', { frappe.ui.form.on('Manufacturing Settings', {
}); });
frappe.tour["Manufacturing Settings"] = [
{
fieldname: "material_consumption",
title: __("Allow Multiple Material Consumption"),
description: __("If ticked, multiple materials can be used for a single Work Order. This is useful if one or more time consuming products are being manufactured.")
},
{
fieldname: "backflush_raw_materials_based_on",
title: __("Backflush Raw Materials"),
description: __("The Stock Entry of type 'Manufacture' is known as backflush. Raw materials being consumed to manufacture finished goods is known as backflushing. <br><br> When creating Manufacture Entry, raw-material items are backflushed based on BOM of production item. If you want raw-material items to be backflushed based on Material Transfer entry made against that Work Order instead, then you can set it under this field.")
},
{
fieldname: "default_wip_warehouse",
title: __("Work In Progress Warehouse"),
description: __("This Warehouse will be auto-updated in the Work In Progress Warehouse field of Work Orders.")
},
{
fieldname: "default_fg_warehouse",
title: __("Finished Goods Warehouse"),
description: __("This Warehouse will be auto-updated in the Target Warehouse field of Work Order.")
},
{
fieldname: "update_bom_costs_automatically",
title: __("Update BOM Cost Automatically"),
description: __("If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials.")
}
];

View File

@@ -201,9 +201,9 @@ frappe.ui.form.on('Production Plan', {
title: title, title: title,
fields: [ fields: [
{ {
"fieldtype": "Table MultiSelect", "label": __("Source Warehouses"), "fieldtype": "Table MultiSelect", "label": __("Source Warehouses (Optional)"),
"fieldname": "warehouses", "options": "Production Plan Material Request Warehouse", "fieldname": "warehouses", "options": "Production Plan Material Request Warehouse",
"description": "System will pickup the materials from the selected warehouses", "description": __("System will pickup the materials from the selected warehouses. If not specified, system will create material request for purchase."),
get_query: function () { get_query: function () {
return { return {
filters: { filters: {

View File

@@ -1,5 +1,5 @@
{ {
"action": "Update Settings", "action": "Show Form Tour",
"creation": "2020-05-19 11:55:11.378374", "creation": "2020-05-19 11:55:11.378374",
"docstatus": 0, "docstatus": 0,
"doctype": "Onboarding Step", "doctype": "Onboarding Step",
@@ -8,7 +8,7 @@
"is_mandatory": 0, "is_mandatory": 0,
"is_single": 1, "is_single": 1,
"is_skipped": 0, "is_skipped": 0,
"modified": "2020-05-19 12:12:28.145366", "modified": "2020-05-26 20:28:03.558199",
"modified_by": "Administrator", "modified_by": "Administrator",
"name": "Explore Manufacturing Settings", "name": "Explore Manufacturing Settings",
"owner": "Administrator", "owner": "Administrator",

View File

@@ -103,7 +103,7 @@ def get_columns(filters):
"fieldtype": "Int", "fieldtype": "Int",
"width": 140 "width": 140
}, { }, {
"label": _("Subassembly BOM Count"), "label": _("Sub-assembly BOM Count"),
"fieldname": "used_as_subassembly_items", "fieldname": "used_as_subassembly_items",
"fieldtype": "Int", "fieldtype": "Int",
"width": 180 "width": 180

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