def test_duplicate_entry_for_payroll_period(self):
		declaration = dataent.get_doc({
			"doctype": "Employee Tax Exemption Declaration",
			"employee": dataent.get_value("Employee", {"user_id":"*****@*****.**"}, "name"),
			"company":  epaas.get_default_company(),
			"payroll_period": "_Test Payroll Period",
			"declarations": [
				dict(exemption_sub_category = "_Test Sub Category",
					exemption_category = "_Test Category",
					amount = 100000),
				dict(exemption_sub_category = "_Test1 Sub Category",
					exemption_category = "_Test Category",
					amount = 50000),
			]
		}).insert()

		duplicate_declaration = dataent.get_doc({
			"doctype": "Employee Tax Exemption Declaration",
			"employee": dataent.get_value("Employee", {"user_id":"*****@*****.**"}, "name"),
			"company":  epaas.get_default_company(),
			"payroll_period": "_Test Payroll Period",
			"declarations": [
				dict(exemption_sub_category = "_Test Sub Category",
					exemption_category = "_Test Category",
					amount = 100000)
			]
		})
		self.assertRaises(DuplicateDeclarationError, duplicate_declaration.insert)
		duplicate_declaration.employee = dataent.get_value("Employee", {"user_id":"*****@*****.**"}, "name")
		self.assertTrue(duplicate_declaration.insert)
示例#2
0
def make_quotation(domain):
    # get open opportunites
    opportunity = get_random("Opportunity", {
        "status": "Open",
        "with_items": 1
    })

    if opportunity:
        from epaas.crm.doctype.opportunity.opportunity import make_quotation
        qtn = dataent.get_doc(make_quotation(opportunity))
        qtn.insert()
        dataent.db.commit()
        qtn.submit()
        dataent.db.commit()
    else:
        # make new directly

        # get customer, currency and exchange_rate
        customer = get_random("Customer")

        company_currency = dataent.get_cached_value(
            'Company', epaas.get_default_company(), "default_currency")
        party_account_currency = get_party_account_currency(
            "Customer", customer, epaas.get_default_company())
        if company_currency == party_account_currency:
            exchange_rate = 1
        else:
            exchange_rate = get_exchange_rate(party_account_currency,
                                              company_currency,
                                              args="for_selling")

        qtn = dataent.get_doc({
            "creation": dataent.flags.current_date,
            "doctype": "Quotation",
            "quotation_to": "Customer",
            "party_name": customer,
            "currency": party_account_currency or company_currency,
            "conversion_rate": exchange_rate,
            "order_type": "Sales",
            "transaction_date": dataent.flags.current_date,
        })

        add_random_children(qtn,
                            "items",
                            rows=3,
                            randomize={
                                "qty": (1, 5),
                                "item_code": ("Item", {
                                    "has_variants": "0",
                                    "is_fixed_asset": 0,
                                    "domain": domain
                                })
                            },
                            unique="item_code")

        qtn.insert()
        dataent.db.commit()
        qtn.submit()
        dataent.db.commit()
示例#3
0
def setup_mode_of_payment():
	company_abbr = dataent.get_cached_value('Company',  epaas.get_default_company(),  "abbr")
	account_dict = {'Cash': 'Cash - '+ company_abbr , 'Bank': 'National Bank - '+ company_abbr}
	for payment_mode in dataent.get_all('Mode of Payment', fields = ["name", "type"]):
		if payment_mode.type:
			mop = dataent.get_doc('Mode of Payment', payment_mode.name)
			mop.append('accounts', {
				'company': epaas.get_default_company(),
				'default_account': account_dict.get(payment_mode.type)
			})
			mop.save(ignore_permissions=True)
示例#4
0
def create_loan(applicant, loan_type, loan_amount, repayment_method,
                repayment_periods):
    create_loan_type(loan_type, 500000, 8.4)
    if not dataent.db.get_value("Loan", {"applicant": applicant}):
        loan = dataent.new_doc("Loan")
        loan.update({
            "applicant":
            applicant,
            "loan_type":
            loan_type,
            "loan_amount":
            loan_amount,
            "repayment_method":
            repayment_method,
            "repayment_periods":
            repayment_periods,
            "disbursement_date":
            nowdate(),
            "repayment_start_date":
            nowdate(),
            "status":
            "Disbursed",
            "mode_of_payment":
            dataent.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name'),
            "payment_account":
            dataent.db.get_value(
                'Account', {
                    'account_type': 'Cash',
                    'company': epaas.get_default_company(),
                    'is_group': 0
                }, "name"),
            "loan_account":
            dataent.db.get_value(
                'Account', {
                    'account_type': 'Cash',
                    'company': epaas.get_default_company(),
                    'is_group': 0
                }, "name"),
            "interest_income_account":
            dataent.db.get_value(
                'Account', {
                    'account_type': 'Cash',
                    'company': epaas.get_default_company(),
                    'is_group': 0
                }, "name")
        })
        loan.insert()
        return loan
    else:
        return dataent.get_doc("Loan", {"applicant": applicant})
示例#5
0
def setup_account_to_expense_type():
	company_abbr = dataent.get_cached_value('Company',  epaas.get_default_company(),  "abbr")
	expense_types = [{'name': _('Calls'), "account": "Sales Expenses - "+ company_abbr},
		{'name': _('Food'), "account": "Entertainment Expenses - "+ company_abbr},
		{'name': _('Medical'), "account": "Utility Expenses - "+ company_abbr},
		{'name': _('Others'), "account": "Miscellaneous Expenses - "+ company_abbr},
		{'name': _('Travel'), "account": "Travel Expenses - "+ company_abbr}]

	for expense_type in expense_types:
		doc = dataent.get_doc("Expense Claim Type", expense_type["name"])
		doc.append("accounts", {
			"company" : epaas.get_default_company(),
			"default_account" : expense_type["account"]
		})
		doc.save(ignore_permissions=True)
示例#6
0
def make_salary_structure(salary_structure, payroll_frequency, employee=None, dont_submit=False, other_details=None, test_tax=False):
	if test_tax:
		dataent.db.sql("""delete from `tabSalary Structure` where name=%s""",(salary_structure))
	if not dataent.db.exists('Salary Structure', salary_structure):
		details = {
			"doctype": "Salary Structure",
			"name": salary_structure,
			"company": epaas.get_default_company(),
			"earnings": make_earning_salary_component(test_tax=test_tax),
			"deductions": make_deduction_salary_component(test_tax=test_tax),
			"payroll_frequency": payroll_frequency,
			"payment_account": get_random("Account")
		}
		if other_details and isinstance(other_details, dict):
			details.update(other_details)
		salary_structure_doc = dataent.get_doc(details).insert()
		if not dont_submit:
			salary_structure_doc.submit()
	else:
		salary_structure_doc = dataent.get_doc("Salary Structure", salary_structure)

	if employee and not dataent.db.get_value("Salary Structure Assignment",
		{'employee':employee, 'docstatus': 1}) and salary_structure_doc.docstatus==1:
			create_salary_structure_assignment(employee, salary_structure)

	return salary_structure_doc
示例#7
0
def create_delivery_trip(contact=None):
    if not contact:
        contact = get_contact_and_address("_Test Customer")

    delivery_trip = dataent.new_doc("Delivery Trip")
    delivery_trip.update({
        "doctype":
        "Delivery Trip",
        "company":
        epaas.get_default_company(),
        "departure_time":
        add_days(now_datetime(), 5),
        "driver":
        dataent.db.get_value('Driver', {"full_name": "Newton Scmander"}),
        "vehicle":
        "JB 007",
        "delivery_stops": [{
            "customer": "_Test Customer",
            "address": contact.shipping_address.parent,
            "contact": contact.contact_person.parent
        }, {
            "customer": "_Test Customer",
            "address": contact.shipping_address.parent,
            "contact": contact.contact_person.parent
        }]
    })
    delivery_trip.insert()

    return delivery_trip
示例#8
0
def complete_setup(domain='Manufacturing'):
	print("Complete Setup...")
	from dataent.desk.page.setup_wizard.setup_wizard import setup_complete

	if not dataent.get_all('Company', limit=1):
		setup_complete({
			"full_name": "Test User",
			"email": "*****@*****.**",
			"company_tagline": 'Awesome Products and Services',
			"password": "******",
			"fy_start_date": "2015-01-01",
			"fy_end_date": "2015-12-31",
			"bank_account": "National Bank",
			"domains": [domain],
			"company_name": data.get(domain).get('company_name'),
			"chart_of_accounts": "Standard",
			"company_abbr": ''.join([d[0] for d in data.get(domain).get('company_name').split()]).upper(),
			"currency": 'USD',
			"timezone": 'America/New_York',
			"country": 'United States',
			"language": "english"
		})

		company = epaas.get_default_company()

		if company:
			company_doc = dataent.get_doc("Company", company)
			company_doc.db_set('default_payroll_payable_account',
				dataent.db.get_value('Account', dict(account_name='Payroll Payable')))
示例#9
0
文件: loan.py 项目: dataent/epaas
    def validate(self):
        check_repayment_method(self.repayment_method, self.loan_amount,
                               self.monthly_repayment_amount,
                               self.repayment_periods)
        if not self.company:
            self.company = epaas.get_default_company()
        if not self.posting_date:
            self.posting_date = nowdate()
        if self.loan_type and not self.rate_of_interest:
            self.rate_of_interest = dataent.db.get_value(
                "Loan Type", self.loan_type, "rate_of_interest")
        if self.repayment_method == "Repay Over Number of Periods":
            self.monthly_repayment_amount = get_monthly_repayment_amount(
                self.repayment_method, self.loan_amount, self.rate_of_interest,
                self.repayment_periods)
        if self.status == "Repaid/Closed":
            self.total_amount_paid = self.total_payment
        if self.status == 'Disbursed' and self.repayment_start_date < self.disbursement_date:
            dataent.throw(
                _("Repayment Start Date cannot be before Disbursement Date."))

        if self.status == "Disbursed":
            self.make_repayment_schedule()
            self.set_repayment_period()
            self.calculate_totals()
示例#10
0
def get_payment_account():
    return dataent.get_value(
        'Account', {
            'account_type': 'Cash',
            'company': epaas.get_default_company(),
            'is_group': 0
        }, "name")
示例#11
0
    def test_payroll_frequency(self):
        fiscal_year = get_fiscal_year(nowdate(),
                                      company=epaas.get_default_company())[0]
        month = "%02d" % getdate(nowdate()).month
        m = get_month_details(fiscal_year, month)

        for payroll_frequency in [
                "Monthly", "Bimonthly", "Fortnightly", "Weekly", "Daily"
        ]:
            make_employee(payroll_frequency + "*****@*****.**")
            ss = make_employee_salary_slip(
                payroll_frequency + "*****@*****.**",
                payroll_frequency)
            if payroll_frequency == "Monthly":
                self.assertEqual(ss.end_date, m['month_end_date'])
            elif payroll_frequency == "Bimonthly":
                if getdate(ss.start_date).day <= 15:
                    self.assertEqual(ss.end_date, m['month_mid_end_date'])
                else:
                    self.assertEqual(ss.end_date, m['month_end_date'])
            elif payroll_frequency == "Fortnightly":
                self.assertEqual(ss.end_date, add_days(nowdate(), 13))
            elif payroll_frequency == "Weekly":
                self.assertEqual(ss.end_date, add_days(nowdate(), 6))
            elif payroll_frequency == "Daily":
                self.assertEqual(ss.end_date, nowdate())
示例#12
0
文件: utils.py 项目: dataent/epaas
def get_appropriate_company(filters):
    if filters.get('company'):
        company = filters['company']
    else:
        company = get_default_company()

    return company
示例#13
0
	def setUp(self):
		for dt in ["Salary Slip", "Salary Structure", "Salary Structure Assignment"]:
			dataent.db.sql("delete from `tab%s`" % dt)

		self.make_holiday_list()
		dataent.db.set_value("Company", epaas.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List")
		make_employee("*****@*****.**")
		make_employee("*****@*****.**")
示例#14
0
def get_valuation_rate(item_code,
                       warehouse,
                       voucher_type,
                       voucher_no,
                       allow_zero_rate=False,
                       currency=None,
                       company=None,
                       raise_error_if_no_rate=True):
    # Get valuation rate from last sle for the same item and warehouse
    if not company:
        company = epaas.get_default_company()

    last_valuation_rate = dataent.db.sql(
        """select valuation_rate
		from `tabStock Ledger Entry`
		where item_code = %s and warehouse = %s
		and valuation_rate >= 0
		order by posting_date desc, posting_time desc, name desc limit 1""",
        (item_code, warehouse))

    if not last_valuation_rate:
        # Get valuation rate from last sle for the item against any warehouse
        last_valuation_rate = dataent.db.sql(
            """select valuation_rate
			from `tabStock Ledger Entry`
			where item_code = %s and valuation_rate > 0
			order by posting_date desc, posting_time desc, name desc limit 1""",
            item_code)

    if last_valuation_rate:
        return flt(
            last_valuation_rate[0]
            [0])  # as there is previous records, it might come with zero rate

    # If negative stock allowed, and item delivered without any incoming entry,
    # system does not found any SLE, then take valuation rate from Item
    valuation_rate = dataent.db.get_value("Item", item_code, "valuation_rate")

    if not valuation_rate:
        # try Item Standard rate
        valuation_rate = dataent.db.get_value("Item", item_code,
                                              "standard_rate")

        if not valuation_rate:
            # try in price list
            valuation_rate = dataent.db.get_value(
                'Item Price',
                dict(item_code=item_code, buying=1, currency=currency),
                'price_list_rate')

    if not allow_zero_rate and not valuation_rate and raise_error_if_no_rate \
      and cint(epaas.is_perpetual_inventory_enabled(company)):
        dataent.local.message_log = []
        dataent.throw(
            _("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a zero valuation rate item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry"
              ).format(item_code, voucher_type, voucher_no))

    return valuation_rate
示例#15
0
def create_leave_period(from_date, to_date):
    leave_period = dataent.get_doc({
        "doctype": "Leave Period",
        "company": epaas.get_default_company(),
        "from_date": from_date,
        "to_date": to_date,
        "is_active": 1
    }).insert()
    return leave_period
示例#16
0
def get_salary_component_account(sal_comp):
    company = epaas.get_default_company()
    sal_comp = dataent.get_doc("Salary Component", sal_comp)
    if not sal_comp.get("accounts"):
        sal_comp.append("accounts", {
            "company": company,
            "default_account": create_account(company)
        })
        sal_comp.save()
示例#17
0
    def test_loan(self):

        branch = "Test Employee Branch"
        applicant = make_employee("*****@*****.**")
        company = epaas.get_default_company()
        holiday_list = make_holiday("test holiday for loan")

        company_doc = dataent.get_doc('Company', company)
        if not company_doc.default_payroll_payable_account:
            company_doc.default_payroll_payable_account = dataent.db.get_value(
                'Account', {
                    'company': company,
                    'root_type': 'Liability',
                    'account_type': ''
                }, 'name')
            company_doc.save()

        if not dataent.db.exists('Branch', branch):
            dataent.get_doc({'doctype': 'Branch', 'branch': branch}).insert()

        employee_doc = dataent.get_doc('Employee', applicant)
        employee_doc.branch = branch
        employee_doc.holiday_list = holiday_list
        employee_doc.save()

        loan = create_loan(applicant, "Personal Loan", 280000,
                           "Repay Over Number of Periods", 20)
        loan.repay_from_salary = 1
        loan.submit()
        salary_structure = "Test Salary Structure for Loan"
        make_salary_structure(salary_structure, "Monthly", employee_doc.name)

        dates = get_start_end_dates('Monthly', nowdate())
        make_payroll_entry(start_date=dates.start_date,
                           end_date=dates.end_date,
                           branch=branch)

        name = dataent.db.get_value('Salary Slip', {
            'posting_date': nowdate(),
            'employee': applicant
        }, 'name')

        salary_slip = dataent.get_doc('Salary Slip', name)
        for row in salary_slip.loans:
            if row.loan == loan.name:
                interest_amount = (280000 * 8.4) / (12 * 100)
                principal_amount = loan.monthly_repayment_amount - interest_amount
                self.assertEqual(row.interest_amount, interest_amount)
                self.assertEqual(row.principal_amount, principal_amount)
                self.assertEqual(row.total_payment,
                                 interest_amount + principal_amount)

        if salary_slip.docstatus == 0:
            dataent.delete_doc('Salary Slip', name)
示例#18
0
def execute(filters=None):
    columns, data, chart = [], [], []
    if filters.get('fiscal_year'):
        company = epaas.get_default_company()
        period_list = get_period_list(filters.get('fiscal_year'),
                                      filters.get('fiscal_year'), "Monthly",
                                      company)
        columns = get_columns()
        data = get_log_data(filters)
        chart = get_chart_data(data, period_list)
    return columns, data, None, chart
示例#19
0
def create_additional_salary(employee, payroll_period, amount):
    salary_date = add_months(payroll_period.start_date, random.randint(0, 11))
    dataent.get_doc({
        "doctype": "Additional Salary",
        "employee": employee,
        "company": epaas.get_default_company(),
        "salary_component": "Performance Bonus",
        "payroll_date": salary_date,
        "amount": amount,
        "type": "Earning"
    }).submit()
    return salary_date
示例#20
0
文件: demo.py 项目: dataent/epaas
def simulate(domain='Manufacturing', days=100):
    runs_for = dataent.flags.runs_for or days
    dataent.flags.company = epaas.get_default_company()
    dataent.flags.mute_emails = True

    if not dataent.flags.start_date:
        # start date = 100 days back
        dataent.flags.start_date = dataent.utils.add_days(
            dataent.utils.nowdate(), -1 * runs_for)

    current_date = dataent.utils.getdate(dataent.flags.start_date)

    # continue?
    demo_last_date = dataent.db.get_global('demo_last_date')
    if demo_last_date:
        current_date = dataent.utils.add_days(
            dataent.utils.getdate(demo_last_date), 1)

    # run till today
    if not runs_for:
        runs_for = dataent.utils.date_diff(dataent.utils.nowdate(),
                                           current_date)
        # runs_for = 100

    fixed_asset.work()
    for i in range(runs_for):
        sys.stdout.write("\rSimulating {0}: Day {1}".format(
            current_date.strftime("%Y-%m-%d"), i))
        sys.stdout.flush()
        dataent.flags.current_date = current_date
        if current_date.weekday() in (5, 6):
            current_date = dataent.utils.add_days(current_date, 1)
            continue
        try:
            hr.work()
            purchase.work()
            stock.work()
            accounts.work()
            projects.run_projects(current_date)
            sales.work(domain)
            # run_messages()

            if domain == 'Manufacturing':
                manufacturing.work()
            elif domain == 'Education':
                edu.work()

        except:
            dataent.db.set_global('demo_last_date', current_date)
            raise
        finally:
            current_date = dataent.utils.add_days(current_date, 1)
            dataent.db.commit()
def create_payroll_period():
	if not dataent.db.exists("Payroll Period", "_Test Payroll Period"):
		from datetime import date
		payroll_period = dataent.get_doc(dict(
			doctype = 'Payroll Period',
			name = "_Test Payroll Period",
			company =  epaas.get_default_company(),
			start_date = date(date.today().year, 1, 1),
			end_date = date(date.today().year, 12, 31)
		)).insert()
		return payroll_period
	else:
		return dataent.get_doc("Payroll Period", "_Test Payroll Period")
示例#22
0
def create_salary_structure_assignment(employee, salary_structure, from_date=None):
	if dataent.db.exists("Salary Structure Assignment", {"employee": employee}):
		dataent.db.sql("""delete from `tabSalary Structure Assignment` where employee=%s""",(employee))
	salary_structure_assignment = dataent.new_doc("Salary Structure Assignment")
	salary_structure_assignment.employee = employee
	salary_structure_assignment.base = 50000
	salary_structure_assignment.variable = 5000
	salary_structure_assignment.from_date = from_date or add_months(nowdate(), -1)
	salary_structure_assignment.salary_structure = salary_structure
	salary_structure_assignment.company = epaas.get_default_company()
	salary_structure_assignment.save(ignore_permissions=True)
	salary_structure_assignment.submit()
	return salary_structure_assignment
示例#23
0
 def make_holiday_list(self):
     fiscal_year = get_fiscal_year(nowdate(),
                                   company=epaas.get_default_company())
     if not dataent.db.get_value("Holiday List",
                                 "Salary Slip Test Holiday List"):
         holiday_list = dataent.get_doc({
             "doctype": "Holiday List",
             "holiday_list_name": "Salary Slip Test Holiday List",
             "from_date": fiscal_year[1],
             "to_date": fiscal_year[2],
             "weekly_off": "Sunday"
         }).insert()
         holiday_list.get_weekly_off_dates()
         holiday_list.save()
示例#24
0
    def setUp(self):
        make_earning_salary_component(setup=True)
        make_deduction_salary_component(setup=True)

        for dt in ["Leave Application", "Leave Allocation", "Salary Slip"]:
            dataent.db.sql("delete from `tab%s`" % dt)

        self.make_holiday_list()

        dataent.db.set_value("Company", epaas.get_default_company(),
                             "default_holiday_list",
                             "Salary Slip Test Holiday List")
        dataent.db.set_value("HR Settings", None,
                             "email_salary_slip_to_employee", 0)
示例#25
0
def setup_employee():
	dataent.db.set_value("HR Settings", None, "emp_created_by", "Naming Series")
	dataent.db.commit()

	for d in dataent.get_all('Salary Component'):
		salary_component = dataent.get_doc('Salary Component', d.name)
		salary_component.append('accounts', dict(
			company=epaas.get_default_company(),
			default_account=dataent.get_value('Account', dict(account_name=('like', 'Salary%')))
		))
		salary_component.save()

	import_json('Employee')
	holiday_list = dataent.db.get_value("Holiday List", {"holiday_list_name": str(now_datetime().year)}, 'name')
	dataent.db.sql('''update tabEmployee set holiday_list={0}'''.format(holiday_list))
示例#26
0
def create_exemption_declaration(employee, payroll_period):
    create_exemption_category()
    declaration = dataent.get_doc({
        "doctype": "Employee Tax Exemption Declaration",
        "employee": employee,
        "payroll_period": payroll_period,
        "company": epaas.get_default_company()
    })
    declaration.append(
        "declarations", {
            "exemption_sub_category": "_Test Sub Category",
            "exemption_category": "_Test Category",
            "amount": 100000
        })
    declaration.submit()
	def test_duplicate_category_in_declaration(self):
		declaration = dataent.get_doc({
			"doctype": "Employee Tax Exemption Declaration",
			"employee": dataent.get_value("Employee", {"user_id":"*****@*****.**"}, "name"),
			"company": epaas.get_default_company(),
			"payroll_period": "_Test Payroll Period",
			"declarations": [
				dict(exemption_sub_category = "_Test Sub Category",
					exemption_category = "_Test Category",
					amount = 100000),
				dict(exemption_sub_category = "_Test Sub Category",
					exemption_category = "_Test Category",
					amount = 50000)
			]
		})
		self.assertRaises(dataent.ValidationError, declaration.save)
示例#28
0
def make_employee(user):
    if not dataent.db.get_value("User", user):
        dataent.get_doc({
            "doctype": "User",
            "email": user,
            "first_name": user,
            "new_password": "******",
            "roles": [{
                "doctype": "Has Role",
                "role": "Employee"
            }]
        }).insert()

    if not dataent.db.get_value("Employee", {"user_id": user}):
        employee = dataent.get_doc({
            "doctype":
            "Employee",
            "naming_series":
            "EMP-",
            "first_name":
            user,
            "company":
            epaas.get_default_company(),
            "user_id":
            user,
            "date_of_birth":
            "1990-05-08",
            "date_of_joining":
            "2013-01-01",
            "department":
            dataent.get_all("Department", fields="name")[0].name,
            "gender":
            "Female",
            "company_email":
            user,
            "prefered_contact_email":
            "Company Email",
            "prefered_email":
            user,
            "status":
            "Active",
            "employment_type":
            "Intern"
        }).insert()
        return employee.name
    else:
        return dataent.get_value("Employee", {"employee_name": user}, "name")
	def test_exemption_amount(self):
		declaration = dataent.get_doc({
			"doctype": "Employee Tax Exemption Declaration",
			"employee": dataent.get_value("Employee", {"user_id":"*****@*****.**"}, "name"),
			"company":  epaas.get_default_company(),
			"payroll_period": "_Test Payroll Period",
			"declarations": [
				dict(exemption_sub_category = "_Test Sub Category",
					exemption_category = "_Test Category",
					amount = 80000),
				dict(exemption_sub_category = "_Test1 Sub Category",
					exemption_category = "_Test Category",
					amount = 60000),
			]
		}).insert()

		self.assertEqual(declaration.total_exemption_amount, 100000)
示例#30
0
文件: projects.py 项目: dataent/epaas
def make_timesheet_for_projects(current_date):
    for data in dataent.get_all("Task", ["name", "project"], {
            "status": "Open",
            "exp_end_date": ("<", current_date)
    }):
        employee = get_random("Employee")
        ts = make_timesheet(employee,
                            simulate=True,
                            billable=1,
                            company=epaas.get_default_company(),
                            activity_type=get_random("Activity Type"),
                            project=data.project,
                            task=data.name)

        if flt(ts.total_billable_amount) > 0.0:
            make_sales_invoice_for_timesheet(ts.name)
            dataent.db.commit()