fix: test case for Project Profitability report
This commit is contained in:
parent
e5fb23972a
commit
f0dfea1d47
@ -1,7 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import unittest
|
import unittest
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import getdate, nowdate
|
from frappe.utils import getdate, nowdate, add_days
|
||||||
from erpnext.hr.doctype.employee.test_employee import make_employee
|
from erpnext.hr.doctype.employee.test_employee import make_employee
|
||||||
from erpnext.projects.doctype.timesheet.test_timesheet import make_salary_structure_for_timesheet, make_timesheet
|
from erpnext.projects.doctype.timesheet.test_timesheet import make_salary_structure_for_timesheet, make_timesheet
|
||||||
from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
|
from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
|
||||||
@ -16,17 +16,22 @@ class TestProjectProfitability(unittest.TestCase):
|
|||||||
make_salary_structure_for_timesheet(emp, company='_Test Company')
|
make_salary_structure_for_timesheet(emp, company='_Test Company')
|
||||||
self.timesheet = make_timesheet(emp, simulate = True, is_billable=1)
|
self.timesheet = make_timesheet(emp, simulate = True, is_billable=1)
|
||||||
self.salary_slip = make_salary_slip(self.timesheet.name)
|
self.salary_slip = make_salary_slip(self.timesheet.name)
|
||||||
|
holidays = self.salary_slip.get_holidays_for_employee(nowdate(), nowdate())
|
||||||
|
if holidays:
|
||||||
|
frappe.db.set_value('Payroll Settings', None, 'include_holidays_in_total_working_days', 1)
|
||||||
|
|
||||||
self.salary_slip.submit()
|
self.salary_slip.submit()
|
||||||
self.sales_invoice = make_sales_invoice(self.timesheet.name, '_Test Item', '_Test Customer')
|
self.sales_invoice = make_sales_invoice(self.timesheet.name, '_Test Item', '_Test Customer')
|
||||||
self.sales_invoice.due_date = nowdate()
|
self.sales_invoice.due_date = nowdate()
|
||||||
self.sales_invoice.submit()
|
self.sales_invoice.submit()
|
||||||
|
|
||||||
frappe.db.set_value('HR Settings', None, 'standard_working_hours', 8)
|
frappe.db.set_value('HR Settings', None, 'standard_working_hours', 8)
|
||||||
|
frappe.db.set_value('Payroll Settings', None, 'include_holidays_in_total_working_days', 0)
|
||||||
|
|
||||||
def test_project_profitability(self):
|
def test_project_profitability(self):
|
||||||
filters = {
|
filters = {
|
||||||
'company': '_Test Company',
|
'company': '_Test Company',
|
||||||
'start_date': getdate(),
|
'start_date': add_days(getdate(), -3),
|
||||||
'end_date': getdate()
|
'end_date': getdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,9 +124,9 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
|
|||||||
|
|
||||||
this.toggle_subcontracting_fields();
|
this.toggle_subcontracting_fields();
|
||||||
super.refresh();
|
super.refresh();
|
||||||
},
|
}
|
||||||
|
|
||||||
toggle_subcontracting_fields: function() {
|
toggle_subcontracting_fields() {
|
||||||
if (in_list(['Purchase Receipt', 'Purchase Invoice'], this.frm.doc.doctype)) {
|
if (in_list(['Purchase Receipt', 'Purchase Invoice'], this.frm.doc.doctype)) {
|
||||||
this.frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty',
|
this.frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty',
|
||||||
'read_only', this.frm.doc.__onload && this.frm.doc.__onload.backflush_based_on === 'BOM');
|
'read_only', this.frm.doc.__onload && this.frm.doc.__onload.backflush_based_on === 'BOM');
|
||||||
@ -134,9 +134,9 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
|
|||||||
this.frm.set_df_property('supplied_items', 'cannot_add_rows', 1);
|
this.frm.set_df_property('supplied_items', 'cannot_add_rows', 1);
|
||||||
this.frm.set_df_property('supplied_items', 'cannot_delete_rows', 1);
|
this.frm.set_df_property('supplied_items', 'cannot_delete_rows', 1);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
supplier: function() {
|
supplier() {
|
||||||
var me = this;
|
var me = this;
|
||||||
erpnext.utils.get_party_details(this.frm, null, null, function(){
|
erpnext.utils.get_party_details(this.frm, null, null, function(){
|
||||||
me.apply_price_list();
|
me.apply_price_list();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user