Merge pull request #5683 from rohitwaghchaure/v7_pos_issue_and_enhancement
[Fix] Access is pos from sales invoice form.
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index f39c983..0796cec 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -29,8 +29,6 @@
cur_frm.msgbox.hide();
}
- cur_frm.dashboard.reset();
-
this.frm.toggle_reqd("due_date", !this.frm.doc.is_return);
this.show_general_ledger();
@@ -68,11 +66,11 @@
if(doc.outstanding_amount!=0 && !cint(doc.is_return)) {
cur_frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
}
-
+
if(doc.outstanding_amount>0 && !cint(doc.is_return)) {
cur_frm.add_custom_button(__('Payment Request'), this.make_payment_request, __("Make"));
}
-
+
}
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index f5d4e2e..107fbc0 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -17,7 +17,6 @@
refresh: function(doc, cdt, cdn) {
var me = this;
this._super();
- // this.frm.dashboard.reset();
var allow_receipt = false;
var is_drop_ship = false;
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index c99481e..923a3ed 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -120,7 +120,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "depends_on": "eval:doc.supplier && doc.docstatus===0 && !(doc.items && doc.items.length)",
+ "depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))",
"fieldname": "get_items_from_open_material_requests",
"fieldtype": "Button",
"hidden": 0,
@@ -2689,13 +2689,14 @@
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 105,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-05-23 15:20:59.954292",
+ "modified": "2016-07-07 11:32:05.248626",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
index e526034..9a81467 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -39,7 +39,6 @@
refresh: function(frm, cdt, cdn) {
if (frm.doc.docstatus === 1) {
- frm.dashboard.show_dashboard();
frm.add_custom_button(__("Make"),
function(){ frm.trigger("make_suppplier_quotation") }, __("Supplier Quotation"));
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_links.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
similarity index 62%
rename from erpnext/buying/doctype/request_for_quotation/request_for_quotation_links.py
rename to erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
index 279d157..395e357 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_links.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
@@ -1,10 +1,8 @@
from frappe import _
-links = {
+data = {
+ 'docstatus': 1,
'fieldname': 'request_for_quotation',
- # 'non_standard_fieldnames': {
- # 'Purchase Order': 'prevdoc_detail_docname',
- # },
'transactions': [
{
'label': _('Related Documents'),
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index f23885a..1df1eec 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -6,10 +6,6 @@
frappe.setup_language_field(frm);
},
refresh: function(frm) {
- frm.dashboard.show_heatmap = true;
- frm.dashboard.heatmap_message = __('This is based on transactions against this Supplier. See timeline below for details');
- frm.dashboard.show_dashboard();
-
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false);
} else {
diff --git a/erpnext/buying/doctype/supplier/supplier_links.py b/erpnext/buying/doctype/supplier/supplier_dashboard.py
similarity index 66%
rename from erpnext/buying/doctype/supplier/supplier_links.py
rename to erpnext/buying/doctype/supplier/supplier_dashboard.py
index 10cf3fa..ab123e2 100644
--- a/erpnext/buying/doctype/supplier/supplier_links.py
+++ b/erpnext/buying/doctype/supplier/supplier_dashboard.py
@@ -1,6 +1,8 @@
from frappe import _
-links = {
+data = {
+ 'heatmap': True,
+ 'heatmap_message': _('This is based on transactions against this Supplier. See timeline below for details'),
'fieldname': 'supplier',
'transactions': [
{
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 2b67ceb..432d09a 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -173,6 +173,7 @@
ret = get_item_details(args)
+
for fieldname, value in ret.items():
if item.meta.get_field(fieldname) and value is not None:
if (item.get(fieldname) is None or fieldname in force_item_fields):
@@ -279,7 +280,7 @@
def set_advances(self):
"""Returns list of advances against Account, Party, Reference"""
-
+
res = self.get_advance_entries()
self.set("advances", [])
@@ -293,7 +294,7 @@
"advance_amount": flt(d.amount),
"allocated_amount": flt(d.amount) if d.against_order else 0
})
-
+
def get_advance_entries(self, include_unallocated=True):
if self.doctype == "Sales Invoice":
party_account = self.debit_to
@@ -309,36 +310,36 @@
amount_field = "debit_in_account_currency"
order_field = "purchase_order"
order_doctype = "Purchase Order"
-
- order_list = list(set([d.get(order_field)
+
+ order_list = list(set([d.get(order_field)
for d in self.get("items") if d.get(order_field)]))
-
- journal_entries = get_advance_journal_entries(party_type, party, party_account,
+
+ journal_entries = get_advance_journal_entries(party_type, party, party_account,
amount_field, order_doctype, order_list, include_unallocated)
-
- payment_entries = get_advance_payment_entries(party_type, party, party_account,
+
+ payment_entries = get_advance_payment_entries(party_type, party, party_account,
order_doctype, order_list, include_unallocated)
-
+
res = journal_entries + payment_entries
-
+
return res
def validate_advance_entries(self):
order_field = "sales_order" if self.doctype == "Sales Invoice" else "purchase_order"
- order_list = list(set([d.get(order_field)
+ order_list = list(set([d.get(order_field)
for d in self.get("items") if d.get(order_field)]))
-
+
if not order_list: return
-
+
advance_entries = self.get_advance_entries(include_unallocated=False)
-
+
if advance_entries:
advance_entries_against_si = [d.reference_name for d in self.get("advances")]
for d in advance_entries:
if not advance_entries_against_si or d.reference_name not in advance_entries_against_si:
frappe.msgprint(_("Payment Entry {0} is linked against Order {1}, check if it should be pulled as advance in this invoice.")
.format(d.reference_name, d.against_order))
-
+
def update_against_document_in_jv(self):
"""
Links invoice and advance voucher:
@@ -346,7 +347,7 @@
2. split into multiple rows if partially adjusted, assign against voucher
3. submit advance voucher
"""
-
+
if self.doctype == "Sales Invoice":
party_type = "Customer"
party = self.customer
@@ -374,14 +375,14 @@
'dr_or_cr' : dr_or_cr,
'unadjusted_amount' : flt(d.advance_amount),
'allocated_amount' : flt(d.allocated_amount),
- 'exchange_rate': (self.conversion_rate
+ 'exchange_rate': (self.conversion_rate
if self.party_account_currency != self.company_currency else 1),
- 'grand_total': (self.base_grand_total
+ 'grand_total': (self.base_grand_total
if self.party_account_currency==self.company_currency else self.grand_total),
'outstanding_amount': self.outstanding_amount
})
lst.append(args)
-
+
if lst:
from erpnext.accounts.utils import reconcile_against_document
reconcile_against_document(lst)
@@ -467,7 +468,7 @@
if self.currency == self.company_currency and advance_paid > order_total:
frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater than the Grand Total ({2})")
.format(formatted_advance_paid, self.name, formatted_order_total))
-
+
frappe.db.set_value(self.doctype, self.name, "advance_paid", advance_paid)
@property
@@ -646,11 +647,11 @@
else flt(gl_dict.credit / conversion_rate, 2)
-def get_advance_journal_entries(party_type, party, party_account, amount_field,
+def get_advance_journal_entries(party_type, party, party_account, amount_field,
order_doctype, order_list, include_unallocated=True):
-
+
dr_or_cr = "credit_in_account_currency" if party_type=="Customer" else "debit_in_account_currency"
-
+
conditions = []
if include_unallocated:
conditions.append("ifnull(t2.reference_name, '')=''")
@@ -659,12 +660,12 @@
order_condition = ', '.join(['%s'] * len(order_list))
conditions.append(" (t2.reference_type = '{0}' and ifnull(t2.reference_name, '') in ({1}))"\
.format(order_doctype, order_condition))
-
+
reference_condition = " and (" + " or ".join(conditions) + ")" if conditions else ""
-
+
journal_entries = frappe.db.sql("""
select
- "Journal Entry" as reference_type, t1.name as reference_name,
+ "Journal Entry" as reference_type, t1.name as reference_name,
t1.remark as remarks, t2.{0} as amount, t2.name as reference_row,
t2.reference_name as against_order
from
@@ -677,10 +678,10 @@
and (ifnull(t2.reference_name, '')='' {2})
order by t1.posting_date""".format(amount_field, dr_or_cr, reference_condition),
[party_account, party_type, party] + order_list, as_dict=1)
-
+
return list(journal_entries)
-
-def get_advance_payment_entries(party_type, party, party_account,
+
+def get_advance_payment_entries(party_type, party, party_account,
order_doctype, order_list=None, include_unallocated=True, against_all_orders=False):
party_account_field = "paid_from" if party_type == "Customer" else "paid_to"
payment_type = "Receive" if party_type == "Customer" else "Pay"
@@ -693,28 +694,28 @@
else:
reference_condition = ""
order_list = []
-
+
payment_entries_against_order = frappe.db.sql("""
select
"Payment Entry" as reference_type, t1.name as reference_name,
t1.remarks, t2.allocated_amount as amount, t2.name as reference_row,
t2.reference_name as against_order, t1.posting_date
- from `tabPayment Entry` t1, `tabPayment Entry Reference` t2
+ from `tabPayment Entry` t1, `tabPayment Entry Reference` t2
where
t1.name = t2.parent and t1.{0} = %s and t1.payment_type = %s
and t1.party_type = %s and t1.party = %s and t1.docstatus = 1
and t2.reference_doctype = %s {1}
- """.format(party_account_field, reference_condition),
+ """.format(party_account_field, reference_condition),
[party_account, payment_type, party_type, party, order_doctype] + order_list, as_dict=1)
-
+
if include_unallocated:
unallocated_payment_entries = frappe.db.sql("""
- select "Payment Entry" as reference_type, name as reference_name,
+ select "Payment Entry" as reference_type, name as reference_name,
remarks, unallocated_amount as amount
from `tabPayment Entry`
where
{0} = %s and party_type = %s and party = %s and payment_type = %s
and docstatus = 1 and unallocated_amount > 0
""".format(party_account_field), (party_account, party_type, party, payment_type), as_dict=1)
-
+
return list(payment_entries_against_order) + list(unallocated_payment_entries)
\ No newline at end of file
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index f0f2312..88acfb7 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -28,7 +28,7 @@
super(BuyingController, self).validate()
if getattr(self, "supplier", None) and not self.supplier_name:
self.supplier_name = frappe.db.get_value("Supplier", self.supplier, "supplier_name")
- self.is_item_table_empty()
+
self.set_qty_as_per_stock_uom()
self.validate_stock_or_nonstock_items()
self.validate_warehouse()
@@ -129,7 +129,7 @@
valuation_amount_adjustment -= item.item_tax_amount
self.round_floats_in(item)
- if flt(item.conversion_factor)==0:
+ if flt(item.conversion_factor)==0.0:
item.conversion_factor = get_conversion_factor(item.item_code, item.uom).get("conversion_factor") or 1.0
qty_in_stock_uom = flt(item.qty * item.conversion_factor)
@@ -276,10 +276,6 @@
return self._sub_contracted_items
- def is_item_table_empty(self):
- if not len(self.get("items")):
- frappe.throw(_("Item table can not be blank"))
-
def set_qty_as_per_stock_uom(self):
for d in self.get("items"):
if d.meta.get_field("stock_qty"):
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 254d9a6..6ae5bbe 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, comma_or
-from frappe import msgprint, _, throw
+from frappe import _
from frappe.model.document import Document
def validate_status(status, options):
@@ -135,15 +135,12 @@
item['idx'] = d.idx
item['target_ref_field'] = args['target_ref_field'].replace('_', ' ')
- if not item[args['target_ref_field']]:
- msgprint(_("Note: System will not check over-delivery and over-booking for Item {0} as quantity or amount is 0").format(item.item_code))
- elif args.get('no_tolerance'):
+ # if not item[args['target_ref_field']]:
+ # msgprint(_("Note: System will not check over-delivery and over-booking for Item {0} as quantity or amount is 0").format(item.item_code))
+ if args.get('no_tolerance'):
item['reduce_by'] = item[args['target_field']] - item[args['target_ref_field']]
if item['reduce_by'] > .01:
- msgprint(_("Allowance for over-{0} crossed for Item {1}")
- .format(args["overflow_type"], item.item_code))
- throw(_("{0} must be reduced by {1} or you should increase overflow tolerance")
- .format(_(item.target_ref_field.title()), item["reduce_by"]))
+ self.limits_crossed_error(args, item)
else:
self.check_overflow_with_tolerance(item, args)
@@ -162,10 +159,20 @@
item['max_allowed'] = flt(item[args['target_ref_field']] * (100+tolerance)/100)
item['reduce_by'] = item[args['target_field']] - item['max_allowed']
- msgprint(_("Allowance for over-{0} crossed for Item {1}.")
- .format(args["overflow_type"], item["item_code"]))
- throw(_("{0} must be reduced by {1} or you should increase overflow tolerance")
- .format(_(item["target_ref_field"].title()), item["reduce_by"]))
+ self.limits_crossed_error(args, item)
+
+ def limits_crossed_error(self, args, item):
+ '''Raise exception for limits crossed'''
+ frappe.throw(_('This document is over limit by {0} {1} for item {4}. Are you making another {3} against the same {2}?')
+ .format(
+ frappe.bold(_(item["target_ref_field"].title())),
+ frappe.bold(item["reduce_by"]),
+ frappe.bold(_(args.get('target_dt'))),
+ frappe.bold(_(self.doctype)),
+ frappe.bold(item.get('item_code'))
+ ) + '<br><br>' +
+ _('To allow over-billing or over-ordering, update "Allowance" in Stock Settings or the Item.'),
+ title = _('Limit Crossed'))
def update_qty(self, update_modified=True):
"""Updates qty or amount at row level
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index ad8eea6..69a04c6 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -50,19 +50,17 @@
if sender_name == self.contact_email:
sender_name = None
- account = _('Unknown')
-
- if self.contact_email.index('@'):
+ if not sender_name and self.contact_email.index('@'):
email_name = self.contact_email[0:self.contact_email.index('@')]
email_split = email_name.split('.')
for s in email_split:
- account = account + s.capitalize() + ' '
+ sender_name += s.capitalize() + ' '
lead = frappe.get_doc({
"doctype": "Lead",
"email_id": self.contact_email,
- "lead_name": sender_name or account
+ "lead_name": sender_name
})
lead.insert(ignore_permissions=True)
lead_name = lead.name
@@ -191,16 +189,18 @@
def make_quotation(source_name, target_doc=None):
def set_missing_values(source, target):
quotation = frappe.get_doc(target)
-
+
company_currency = frappe.db.get_value("Company", quotation.company, "default_currency")
- party_account_currency = get_party_account_currency("Customer", quotation.customer, quotation.company)
+ party_account_currency = get_party_account_currency("Customer", quotation.customer,
+ quotation.company) if quotation.customer else company_currency
+
+ quotation.currency = party_account_currency or company_currency
- if company_currency == party_account_currency:
+ if company_currency == quotation.currency:
exchange_rate = 1
else:
- exchange_rate = get_exchange_rate(party_account_currency, company_currency)
+ exchange_rate = get_exchange_rate(quotation.currency, company_currency)
- quotation.currency = party_account_currency or company_currency
quotation.conversion_rate = exchange_rate
quotation.run_method("set_missing_values")
diff --git a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
new file mode 100644
index 0000000..6442d35
--- /dev/null
+++ b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
@@ -0,0 +1,11 @@
+from frappe import _
+
+data = {
+ 'fieldname': 'prevdoc_docname',
+ 'transactions': [
+ {
+ 'label': _('Related Documents'),
+ 'items': ['Quotation']
+ },
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/demo/data/item.json b/erpnext/demo/data/item.json
index 30436d1..d8d4584 100644
--- a/erpnext/demo/data/item.json
+++ b/erpnext/demo/data/item.json
@@ -92,7 +92,8 @@
"image": null,
"item_code": "Base Plate",
"item_group": "Raw Material",
- "item_name": "Base Plate"
+ "item_name": "Base Plate",
+ "is_sub_contracted_item": 1
},
{
"default_supplier": "Scott Ties",
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index 3ca8eb9..ff0f184 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -4,7 +4,7 @@
import erpnext
import frappe.utils
from erpnext.demo.setup_data import setup_data
-from erpnext.demo.user import hr, sales
+from erpnext.demo.user import hr, sales, purchase
def make(domain='Manufacturing'):
frappe.flags.domain = domain
@@ -42,7 +42,7 @@
hr.work()
sales.work()
- # run_purchase()
+ purchase.work()
# run_manufacturing()
# run_stock()
# run_accounts()
diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py
index bfaee47..6492152 100644
--- a/erpnext/demo/setup_data.py
+++ b/erpnext/demo/setup_data.py
@@ -300,3 +300,8 @@
user = frappe.get_doc('User', 'GabrielleLoftus@example.com')
user.add_roles('Sales User', 'Sales Manager', 'Accounts User')
frappe.db.set_global('demo_sales_user_2', user.name)
+
+ if not frappe.db.get_global('demo_purchase_user'):
+ user = frappe.get_doc('User', 'MichalSobczak@example.com')
+ user.add_roles('Purchase User', 'Purchase Manager', 'Accounts User')
+ frappe.db.set_global('demo_purchase_user', user.name)
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index cf27358..58da9d3 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe, random
-from frappe.utils.make_random import how_many, can_make, get_random
+from frappe.utils.make_random import how_many, get_random
from frappe.desk import query_report
from erpnext.setup.utils import get_exchange_rate
from erpnext.accounts.party import get_party_account_currency
@@ -13,30 +13,40 @@
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import \
make_supplier_quotation as make_quotation_from_rfq
-def run_purchase(current_date):
+def work():
+ frappe.set_user(frappe.db.get_global('demo_purchase_user'))
+
if random.random() < 0.3:
report = "Items To Be Requested"
- for row in query_report.run(report)["result"][:how_many("Material Request")]:
+ for row in query_report.run(report)["result"][:random.randint(1, 5)]:
item_code, qty = row[0], abs(row[-1])
mr = make_material_request(item_code, qty)
if random.random() < 0.3:
- for mr in frappe.get_all('Material Request', filters={'material_request_type': 'Purchase', 'status': 'Open'}):
- rfq = make_request_for_quotation(mr.name)
- rfq.transaction_date = frappe.flags.current_date
- add_suppliers(rfq)
- rfq.save()
- rfq.submit()
+ for mr in frappe.get_all('Material Request',
+ filters={'material_request_type': 'Purchase', 'status': 'Open'},
+ limit=random.randint(1,6)):
+ if not frappe.get_all('Request for Quotation',
+ filters={'material_request': mr.name}, limit=1):
+ rfq = make_request_for_quotation(mr.name)
+ rfq.transaction_date = frappe.flags.current_date
+ add_suppliers(rfq)
+ rfq.save()
+ rfq.submit()
- # Make suppier quotation from RFQ against each supplier.
+ # Make suppier quotation from RFQ against each supplier.
if random.random() < 0.3:
- for supplier_quotation in frappe.get_all('Request for Quotation', {'status': 'Open'}):
- rfq = frappe.get_doc('Request for Quotation', rfq.name)
- for supplier in rfq.suppliers:
- supplier_quotation = make_quotation_from_rfq(rfq.name, supplier.supplier)
- supplier_quotation.save()
- supplier_quotation.submit()
+ for rfq in frappe.get_all('Request for Quotation',
+ filters={'status': 'Open'}, limit=random.randint(1, 6)):
+ if not frappe.get_all('Supplier Quotation',
+ filters={'request_for_quotation': rfq.name}, limit=1):
+ rfq = frappe.get_doc('Request for Quotation', rfq.name)
+
+ for supplier in rfq.suppliers:
+ supplier_quotation = make_quotation_from_rfq(rfq.name, supplier.supplier)
+ supplier_quotation.save()
+ supplier_quotation.submit()
# get supplier details
supplier = get_random("Supplier")
@@ -49,14 +59,14 @@
exchange_rate = get_exchange_rate(party_account_currency, company_currency)
# make supplier quotations
- if can_make("Supplier Quotation"):
+ if random.random() < 0.3:
from erpnext.stock.doctype.material_request.material_request import make_supplier_quotation
report = "Material Requests for which Supplier Quotations are not created"
for row in query_report.run(report)["result"][:how_many("Supplier Quotation")]:
if row[0] != "'Total'":
sq = frappe.get_doc(make_supplier_quotation(row[0]))
- sq.transaction_date = current_date
+ sq.transaction_date = frappe.flags.current_date
sq.supplier = supplier
sq.currency = party_account_currency or company_currency
sq.conversion_rate = exchange_rate
@@ -65,7 +75,7 @@
frappe.db.commit()
# make purchase orders
- if can_make("Purchase Order"):
+ if random.random() < 0.3:
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
report = "Requested Items To Be Ordered"
for row in query_report.run(report)["result"][:how_many("Purchase Order")]:
@@ -74,13 +84,13 @@
po.supplier = supplier
po.currency = party_account_currency or company_currency
po.conversion_rate = exchange_rate
- po.transaction_date = current_date
+ po.transaction_date = frappe.flags.current_date
po.insert()
po.submit()
frappe.db.commit()
- if can_make("Subcontract"):
- make_subcontract(current_date)
+ if random.random() < 0.3:
+ make_subcontract()
def make_material_request(item_code, qty):
mr = frappe.new_doc("Material Request")
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index 8857bad..bb9edf9 100755
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -24,9 +24,6 @@
refresh: function() {
var me = this;
erpnext.toggle_naming_series();
- this.frm.dashboard.show_heatmap = true;
- this.frm.dashboard.heatmap_message = __('This is based on the attendance of this Employee');
- this.frm.dashboard.show_dashboard();
},
date_of_birth: function() {
diff --git a/erpnext/hr/doctype/employee/employee_links.py b/erpnext/hr/doctype/employee/employee_dashboard.py
similarity index 79%
rename from erpnext/hr/doctype/employee/employee_links.py
rename to erpnext/hr/doctype/employee/employee_dashboard.py
index 027567e..420c1df 100644
--- a/erpnext/hr/doctype/employee/employee_links.py
+++ b/erpnext/hr/doctype/employee/employee_dashboard.py
@@ -1,6 +1,8 @@
from frappe import _
-links = {
+data = {
+ 'heatmap': True,
+ 'heatmap_message': _('This is based on the attendance of this Employee'),
'fieldname': 'employee',
'transactions': [
{
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index 5cef75c..a0f52dd 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -66,10 +66,6 @@
});
},
show_dashboard: function(frm) {
- frm.dashboard.show_heatmap = true;
- frm.dashboard.heatmap_message = __('This is based on the Time Sheet created against this project');
- frm.dashboard.show_dashboard();
-
if(frm.doc.__onload.activity_summary.length) {
var hours = $.map(frm.doc.__onload.activity_summary, function(d) { return d.total_hours });
var max_count = Math.max.apply(null, hours);
diff --git a/erpnext/projects/doctype/project/project_links.py b/erpnext/projects/doctype/project/project_dashboard.py
similarity index 79%
rename from erpnext/projects/doctype/project/project_links.py
rename to erpnext/projects/doctype/project/project_dashboard.py
index 0af1e1a..b36df88 100644
--- a/erpnext/projects/doctype/project/project_links.py
+++ b/erpnext/projects/doctype/project/project_dashboard.py
@@ -1,6 +1,8 @@
from frappe import _
-links = {
+data = {
+ 'heatmap': True,
+ 'heatmap_message': _('This is based on the Time Sheets created against this project'),
'fieldname': 'project',
'transactions': [
{
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index 80c384e..59af587 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -617,5 +617,5 @@
"read_only": 0,
"read_only_onload": 0,
"sort_order": "ASC",
- "track_seen": 0
+ "track_seen": 1
}
\ No newline at end of file
diff --git a/erpnext/projects/web_form/tasks/tasks.py b/erpnext/projects/web_form/tasks/tasks.py
index 2334f8b..6f387fe 100644
--- a/erpnext/projects/web_form/tasks/tasks.py
+++ b/erpnext/projects/web_form/tasks/tasks.py
@@ -3,5 +3,8 @@
import frappe
def get_context(context):
- # do your magic here
- pass
+ if frappe.form_dict.project:
+ context.parents = [{'title': frappe.form_dict.project, 'route': '/projects?project='+ frappe.form_dict.project}]
+
+ elif context.doc and context.doc.get('project'):
+ context.parents = [{'title': context.doc.project, 'route': '/projects?project='+ context.doc.project}]
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 1379048..c39048d 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -432,7 +432,8 @@
var company_currency = this.get_company_currency();
// Added `ignore_pricing_rule` to determine if document is loading after mapping from another doc
- if(this.frm.doc.currency !== company_currency && !this.frm.doc.ignore_pricing_rule) {
+ if(this.frm.doc.currency && this.frm.doc.currency !== company_currency
+ && !this.frm.doc.ignore_pricing_rule) {
this.get_exchange_rate(this.frm.doc.currency, company_currency,
function(exchange_rate) {
me.frm.set_value("conversion_rate", exchange_rate);
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 3556be7..b5234f1 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -6,10 +6,6 @@
frappe.setup_language_field(frm);
},
refresh: function(frm) {
- frm.dashboard.show_heatmap = true;
- frm.dashboard.heatmap_message = __('This is based on transactions against this Customer. See timeline below for details');
- frm.dashboard.show_dashboard();
-
if(frappe.defaults.get_default("cust_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false);
} else {
diff --git a/erpnext/selling/doctype/customer/customer_links.py b/erpnext/selling/doctype/customer/customer_dashboard.py
similarity index 72%
rename from erpnext/selling/doctype/customer/customer_links.py
rename to erpnext/selling/doctype/customer/customer_dashboard.py
index 32bedde..b65c199 100644
--- a/erpnext/selling/doctype/customer/customer_links.py
+++ b/erpnext/selling/doctype/customer/customer_dashboard.py
@@ -1,6 +1,8 @@
from frappe import _
-links = {
+data = {
+ 'heatmap': True,
+ 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'),
'fieldname': 'customer',
'transactions': [
{
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 037f1e8..f07bc8e 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -6,6 +6,7 @@
"beta": 0,
"creation": "2013-05-24 19:29:08",
"custom": 0,
+ "default_print_format": "test123",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
@@ -2125,6 +2126,7 @@
"hide_toolbar": 0,
"icon": "icon-shopping-cart",
"idx": 82,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
@@ -2132,7 +2134,7 @@
"istable": 0,
"max_attachments": 1,
"menu_index": 0,
- "modified": "2016-05-10 12:16:13.978635",
+ "modified": "2016-07-05 16:44:01.301063",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 5f1a5c7..d8ed591 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -18,10 +18,9 @@
erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
this._super();
- this.frm.dashboard.reset();
var allow_purchase = false;
var allow_delivery = false;
-
+
if(doc.docstatus==1) {
if(doc.status != 'Closed') {
@@ -80,7 +79,7 @@
}
// maintenance
- if(flt(doc.per_delivered, 2) < 100 &&
+ if(flt(doc.per_delivered, 2) < 100 &&
["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) {
cur_frm.add_custom_button(__('Maintenance Visit'), this.make_maintenance_visit, __("Make"));
cur_frm.add_custom_button(__('Maintenance Schedule'), this.make_maintenance_schedule, __("Make"));
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index 8c0d1cb..eda2042 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -65,6 +65,9 @@
@frappe.whitelist()
def get_exchange_rate(from_currency, to_currency):
+ if not (from_currency and to_currency):
+ return
+
if from_currency == to_currency:
return 1
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index d3d4bcc..8ee3d03 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -172,19 +172,19 @@
frm.fields_dict.supplier_items.grid.get_field("supplier").get_query = function(doc, cdt, cdn) {
return { query: "erpnext.controllers.queries.supplier_query" }
}
-
+
frm.fields_dict['default_warehouse'].get_query = function(doc) {
return {
filters: { "is_group": 0 }
}
}
-
+
frm.fields_dict.reorder_levels.grid.get_field("warehouse_group").get_query = function(doc, cdt, cdn) {
return {
filters: { "is_group": 1 }
}
}
-
+
frm.fields_dict.reorder_levels.grid.get_field("warehouse").get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
@@ -198,15 +198,9 @@
},
make_dashboard: function(frm) {
- frm.dashboard.reset();
if(frm.doc.__islocal)
return;
- frm.dashboard.show_heatmap = frm.doc.is_stock_item;
- frm.dashboard.heatmap_message = __('This is based on stock movement. See {0} for details',
- ['<a href="#query-report/Stock Ledger">' + __('Stock Ledger') + '</a>']);
- frm.dashboard.show_dashboard();
-
frappe.require('assets/js/item-dashboard.min.js', function() {
var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;"><a href="#stock-balance">Stock Levels</a></h5>');
erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
diff --git a/erpnext/stock/doctype/item/item_links.py b/erpnext/stock/doctype/item/item_dashboard.py
similarity index 81%
rename from erpnext/stock/doctype/item/item_links.py
rename to erpnext/stock/doctype/item/item_dashboard.py
index 68280dc..e0f1c21 100644
--- a/erpnext/stock/doctype/item/item_links.py
+++ b/erpnext/stock/doctype/item/item_dashboard.py
@@ -1,6 +1,9 @@
from frappe import _
-links = {
+data = {
+ 'heatmap': True,
+ 'heatmap_message': _('This is based on stock movement. See {0} for details')\
+ .format('<a href="#query-report/Stock Ledger">' + _('Stock Ledger') + '</a>'),
'fieldname': 'item_code',
'non_standard_fieldnames': {
'Production Order': 'production_item',
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index f6a7c66..0a07582 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -49,9 +49,6 @@
}
if(doc.docstatus == 1 && doc.status != 'Stopped') {
-
- // this.frm.dashboard.show_dashboard();
-
if(flt(doc.per_ordered, 2) < 100) {
// make
if(doc.material_request_type === "Material Transfer" && doc.status === "Submitted")
diff --git a/erpnext/stock/doctype/material_request/material_request_links.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py
similarity index 69%
rename from erpnext/stock/doctype/material_request/material_request_links.py
rename to erpnext/stock/doctype/material_request/material_request_dashboard.py
index abd27dc..7ed1040 100644
--- a/erpnext/stock/doctype/material_request/material_request_links.py
+++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py
@@ -1,10 +1,8 @@
from frappe import _
-links = {
+data = {
+ 'docstatus': 1,
'fieldname': 'material_request',
- 'non_standard_fieldnames': {
- 'Purchase Order': 'prevdoc_detail_docname',
- },
'transactions': [
{
'label': _('Related Documents'),
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index 8dc433a..da21748 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -12,4 +12,3 @@
{%- endif %}
</div>
{% endmacro %}
-
diff --git a/erpnext/templates/includes/projects.css b/erpnext/templates/includes/projects.css
index 1f758e3..5a717fc 100644
--- a/erpnext/templates/includes/projects.css
+++ b/erpnext/templates/includes/projects.css
@@ -21,6 +21,7 @@
.item-timestamp
{
font-size: 10px;
+ margin-left: 15px;
}
.page-container .project-item {
padding-top: 5px;
diff --git a/erpnext/templates/includes/projects/macros.html b/erpnext/templates/includes/projects/macros.html
deleted file mode 100644
index 5b22583..0000000
--- a/erpnext/templates/includes/projects/macros.html
+++ /dev/null
@@ -1,2 +0,0 @@
-{% macro back_link(doc) %}&back-to=/projects?project={{ doc.name }}&back-to-title={{ doc.project_name }}{% endmacro %}
-
diff --git a/erpnext/templates/includes/projects/project_tasks.html b/erpnext/templates/includes/projects/project_tasks.html
index b4e5cec..e978a7d 100644
--- a/erpnext/templates/includes/projects/project_tasks.html
+++ b/erpnext/templates/includes/projects/project_tasks.html
@@ -1,27 +1,32 @@
-{%- from "templates/includes/projects/macros.html" import back_link -%}
-
{% for task in doc.tasks %}
<div class='task'>
+ <a class="no-decoration task-link {{ task.css_seen }}" href="/tasks?name={{ task.name }}">
<div class='row project-item'>
- <div class='col-xs-1 gravatar-top'>
- {% if task.todo %}
- <span class="avatar avatar-small" title="{{ task.todo.owner }}">
- <img src="{{ task.todo.user_image }}">
- </span>
- {% else %}
- <span class="avatar avatar-small avatar-empty"></span>
- {% endif %}
+ <div class='col-xs-9'>
+ <span class="indicator {{ "red" if task.status=="Open" else "green" if task.status=="Closed" else "darkgrey" }}" title="{{ task.status }}" > {{ task.subject }}</span>
+ <div class="small text-muted item-timestamp"
+ title="{{ frappe.utils.pretty_date(task.modified) }}">
+ modified {{ frappe.utils.pretty_date(task.modified) }}
+ </div>
</div>
- <div class='col-xs-11'>
- <a class="no-decoration task-link {{ task.css_seen }}" href="/tasks?name={{ task.name }}{{ back_link(doc) }}">
- <div class="task-subject">{{ task.subject }}</div>
- <span class="item-timestamp">modified {{ frappe.utils.pretty_date(task.modified) }}</span>
- </a>
+ <div class='col-xs-1'>{% if task.todo %}
+ {% if task.todo.user_image %}
+ <span class="avatar avatar-small" title="{{ task.todo.owner }}">
+ <img src="{{ task.todo.user_image }}">
+ </span>
+ {% else %}
+ <span class="avatar avatar-small standard-image" title="Assigned to {{ task.todo.owner }}">
+
+ </span>
+ {% endif %}
+ {% endif %} </div>
+ <div class='col-xs-2'>
<span class="pull-right list-comment-count small {{ "text-extra-muted" if task.comment_count==0 else "text-muted" }}">
<i class="octicon octicon-comment-discussion"></i>
{{ task.comment_count }}
</span>
</div>
</div>
+ </a>
</div>
{% endfor %}
diff --git a/erpnext/templates/includes/projects/project_timelogs.html b/erpnext/templates/includes/projects/project_timelogs.html
deleted file mode 100644
index c9a40b3..0000000
--- a/erpnext/templates/includes/projects/project_timelogs.html
+++ /dev/null
@@ -1,21 +0,0 @@
-{%- from "templates/includes/projects/macros.html" import back_link -%}
-
-{% for timelog in doc.timelogs %}
-<div class='timelog'>
- <div class='row project-item'>
- <div class='col-xs-1 gravatar-top'>
- <span class="avatar avatar-small" title="{{ timelog.modified_by }}"> <img src="{{ timelog.user_image }}"></span>
- </div>
- <div class='col-xs-11'>
- <a class="no-decoration timelog-link {{ timelog.css_seen }}" href="/time-log?name={{ timelog.name}}{{ back_link(doc) }}">
- <div class="timelog-subject">{{ timelog.title }}</div>
- <span class="item-timestamp">From {{ frappe.format_date(timelog.from_time) }} to {{ frappe.format_date(timelog.to_time) }}</span>
- </a>
- <span class="pull-right list-comment-count small {{ "text-extra-muted" if timelog.comment_count==0 else "text-muted" }}">
- <i class="octicon octicon-comment-discussion"></i>
- {{ timelog.comment_count }}
- </span>
- </div>
- </div>
-</div>
-{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/project_timesheets.html b/erpnext/templates/includes/projects/project_timesheets.html
new file mode 100644
index 0000000..fb44017
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_timesheets.html
@@ -0,0 +1,23 @@
+{% for timesheet in doc.timesheets %}
+<div class='timesheet'>
+ <a class="no-decoration timesheet-link {{ timesheet.css_seen }}" href="/timesheet/{{ timesheet.info.name}}">
+ <div class='row project-item'>
+ <div class='col-xs-9'>
+ <span class="indicator {{ "blue" if timesheet.info.status=="Submitted" else "red" if timesheet.info.status=="Draft" else "darkgrey" }}" title="{{ timesheet.info.status }}" > {{ timesheet.info.name }} </span>
+ <div class="small text-muted item-timestamp">
+ From {{ frappe.format_date(timesheet.from_time) }} to {{ frappe.format_date(timesheet.to_time) }}
+ </div>
+ </div>
+ <div class='col-xs-1 gravatar-top'>
+ <span class="avatar avatar-small" title="{{ timesheet.info.modified_by }}"> <img src="{{ timesheet.info.user_image }}"></span>
+ </div>
+ <div class='col-xs-2'>
+ <span class="pull-right list-comment-count small {{ "text-extra-muted" if timesheet.comment_count==0 else "text-muted" }}">
+ <i class="octicon octicon-comment-discussion"></i>
+ {{ timesheet.info.comment_count }}
+ </span>
+ </div>
+ </div>
+ </a>
+</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html
index f50d455..aeee602 100644
--- a/erpnext/templates/pages/projects.html
+++ b/erpnext/templates/pages/projects.html
@@ -2,7 +2,6 @@
{% block title %}{{ doc.project_name }}{% endblock %}
-{%- from "templates/includes/projects/macros.html" import back_link -%}
{% block header %}
<h1>{{ doc.project_name }}</h1>
{% endblock %}
@@ -25,11 +24,11 @@
<div class="clearfix">
<h4 style="float: left;">{{ _("Tasks") }}</h4>
- <a class="btn btn-secondary btn-default btn-sm" style="float: right; position: relative; top: 10px;" href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
+ <a class="btn btn-secondary btn-default btn-sm" style="float: right; position: relative; top: 10px;" href='/tasks?new=1&project={{ doc.project_name }}'>New task</a>
</div>
<p>
-<a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
+<!-- <a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a> -->
</p>
{% if doc.tasks %}
@@ -46,17 +45,17 @@
<div class='padding'></div>
-<h4>{{ _("Time Logs") }}</h4>
+<h4>{{ _("Timesheets") }}</h4>
-{% if doc.timelogs %}
+{% if doc.timesheets %}
<div class='project-timelogs'>
- {% include "erpnext/templates/includes/projects/project_timelogs.html" %}
+ {% include "erpnext/templates/includes/projects/project_timesheets.html" %}
</div>
- {% if doc.timelogs|length > 9 %}
+ {% if doc.timesheets|length > 9 %}
<p><a class='more-timelogs small underline'>{{ _("More") }}</a><p>
{% endif %}
{% else %}
- <p class="text-muted">No time logs</p>
+ <p class="text-muted">No time sheets</p>
{% endif %}
</div>
diff --git a/erpnext/templates/pages/projects.py b/erpnext/templates/pages/projects.py
index 25b3a67..d68770d 100644
--- a/erpnext/templates/pages/projects.py
+++ b/erpnext/templates/pages/projects.py
@@ -11,7 +11,6 @@
raise frappe.PermissionError
context.no_cache = 1
- context.show_search = True
context.show_sidebar = True
project = frappe.get_doc('Project', frappe.form_dict.project)
@@ -20,9 +19,8 @@
project.tasks = get_tasks(project.name, start=0, item_status='open',
search=frappe.form_dict.get("search"))
- project.timelogs = []
- # project.timelogs = get_timelogs(project.name, start=0,
- # search=frappe.form_dict.get("search"))
+ project.timesheets = get_timesheets(project.name, start=0,
+ search=frappe.form_dict.get("search"))
context.doc = project
@@ -32,8 +30,8 @@
filters = {"project": project}
if search:
filters["subject"] = ("like", "%{0}%".format(search))
- if item_status:
- filters["status"] = item_status
+ # if item_status:
+# filters["status"] = item_status
tasks = frappe.get_all("Task", filters=filters,
fields=["name", "subject", "status", "_seen", "_comments", "modified", "description"],
limit_start=start, limit_page_length=10)
@@ -65,27 +63,32 @@
"tasks": get_tasks(project, start, item_status=item_status)}
}, is_path=True)
-def get_timelogs(project, start=0, search=None):
+def get_timesheets(project, start=0, search=None):
filters = {"project": project}
if search:
- filters["title"] = ("like", "%{0}%".format(search))
+ filters["activity_type"] = ("like", "%{0}%".format(search))
- timelogs = frappe.get_all('Time Log', filters=filters,
- fields=['name','title','task','activity_type','from_time','to_time','_comments','_seen','status','modified','modified_by'],
+ timesheets = frappe.get_all('Timesheet Detail', filters=filters,
+ fields=['project','activity_type','from_time','to_time','parent'],
limit_start=start, limit_page_length=10)
- for timelog in timelogs:
- timelog.user_image = frappe.db.get_value('User', timelog.modified_by, 'user_image')
-
- timelog.comment_count = len(json.loads(timelog._comments or "[]"))
+ for timesheet in timesheets:
+ timesheet.infos = frappe.get_all('Timesheet', filters={"name": timesheet.parent},
+ fields=['name','_comments','_seen','status','modified','modified_by'],
+ limit_start=start, limit_page_length=10)
- timelog.css_seen = ''
- if timelog._seen:
- if frappe.session.user in json.loads(timelog._seen):
- timelog.css_seen = 'seen'
- return timelogs
+ for timesheet.info in timesheet.infos:
+ timesheet.info.user_image = frappe.db.get_value('User', timesheet.info.modified_by, 'user_image')
+
+ timesheet.info.comment_count = len(json.loads(timesheet.info._comments or "[]"))
+
+ timesheet.info.css_seen = ''
+ if timesheet.info._seen:
+ if frappe.session.user in json.loads(timesheet.info._seen):
+ timesheet.info.css_seen = 'seen'
+ return timesheets
@frappe.whitelist()
-def get_timelog_html(project, start=0):
- return frappe.render_template("erpnext/templates/includes/projects/project_timelogs.html",
- {"doc": {"timelogs": get_timelogs(project, start)}}, is_path=True)
+def get_timesheet_html(project, start=0):
+ return frappe.render_template("erpnext/templates/includes/projects/project_timesheets.html",
+ {"doc": {"timesheets": get_timesheets(project, start)}}, is_path=True)