Test case fixes (#14219)

* Test case fixes

* fetch_from fixes
This commit is contained in:
Nabin Hait 2018-05-26 09:09:02 +05:30 committed by GitHub
parent d09a6c9ccb
commit 33df0b4fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 63 additions and 50 deletions

View File

@ -116,6 +116,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
"fetch_from": "payment_term.invoice_portion",
"fieldname": "invoice_portion",
"fieldtype": "Percent",
"hidden": 0,
@ -128,7 +129,7 @@
"label": "Invoice Portion",
"length": 0,
"no_copy": 0,
"options": "payment_term.invoice_portion",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 1,
@ -217,7 +218,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-05-16 22:43:31.890251",
"modified": "2018-05-25 22:43:31.890251",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Schedule",

View File

@ -460,6 +460,7 @@
"collapsible": 0,
"columns": 0,
"description": "The minimum length between each plant in the field for optimum growth",
"fetch_from": "crop.crop_spacing",
"fieldname": "crop_spacing",
"fieldtype": "Float",
"hidden": 0,
@ -472,7 +473,7 @@
"label": "Crop Spacing",
"length": 0,
"no_copy": 0,
"options": "crop.crop_spacing",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -555,6 +556,7 @@
"collapsible": 0,
"columns": 0,
"description": "The minimum distance between rows of plants for optimum growth",
"fetch_from": "crop.row_spacing",
"fieldname": "row_spacing",
"fieldtype": "Float",
"hidden": 0,
@ -567,7 +569,7 @@
"label": "Row Spacing",
"length": 0,
"no_copy": 0,
"options": "crop.row_spacing",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -817,7 +819,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-16 22:43:33.462001",
"modified": "2018-05-25 22:43:33.462001",
"modified_by": "Administrator",
"module": "Agriculture",
"name": "Crop Cycle",

View File

@ -403,6 +403,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.next_due_date",
"fieldname": "due_date",
"fieldtype": "Date",
"hidden": 0,
@ -415,7 +416,7 @@
"label": "Due Date",
"length": 0,
"no_copy": 0,
"options": "task.next_due_date",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -528,6 +529,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "task.has_certificate",
"fieldname": "has_certificate",
"fieldtype": "Check",
"hidden": 0,
@ -540,7 +542,7 @@
"label": "Has Certificate ",
"length": 0,
"no_copy": 0,
"options": "task.has_certificate",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -753,7 +755,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-16 22:43:39.866477",
"modified": "2018-05-25 22:43:39.866477",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Maintenance Log",

View File

@ -74,7 +74,8 @@ class BuyingController(StockController):
def set_supplier_from_item_default(self):
if self.meta.get_field("supplier") and not self.supplier:
for d in self.get("items"):
supplier = frappe.db.get_value("Item", d.item_code, "default_supplier")
supplier = frappe.db.get_value("Item Default",
{"parent": d.item_code, "company": self.company}, "default_supplier")
if supplier:
self.supplier = supplier
break

View File

@ -64,6 +64,7 @@ def make_opportunity(**args):
opp_doc = frappe.get_doc({
"doctype": "Opportunity",
"company": args.company or "_Test Company",
"enquiry_from": args.enquiry_from or "Customer",
"opportunity_type": "Sales",
"with_items": args.with_items or 0,

View File

@ -61,5 +61,6 @@ def create_appointment(patient, physician, appointment_date, department):
appointment.physician = physician
appointment.department = department
appointment.appointment_date = appointment_date
appointment.company = "_Test Company"
appointment.save(ignore_permissions=True)
return appointment

View File

@ -84,6 +84,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "test_template.test_rate",
"fieldname": "test_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -96,7 +97,7 @@
"label": "Rate",
"length": 0,
"no_copy": 0,
"options": "test_template.test_rate",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 1,
@ -281,7 +282,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-05-16 22:43:38.667043",
"modified": "2018-05-25 22:43:38.667043",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Test Groups",

View File

@ -51,6 +51,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "earning_component.is_pro_rata_applicable",
"fieldname": "is_pro_rata_applicable",
"fieldtype": "Check",
"hidden": 0,
@ -63,7 +64,7 @@
"label": "Is Pro-rata Applicable",
"length": 0,
"no_copy": 0,
"options": "earning_component.is_pro_rata_applicable",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -119,7 +120,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-05-15 12:03:25.545041",
"modified": "2018-05-25 12:03:25.545041",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Benefit Application Detail",

View File

@ -210,6 +210,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "earning_component.max_benefit_amount",
"fieldname": "max_amount_eligible",
"fieldtype": "Currency",
"hidden": 0,
@ -222,7 +223,7 @@
"label": "Max Amount Eligible",
"length": 0,
"no_copy": 0,
"options": "earning_component.max_benefit_amount",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -242,6 +243,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "earning_component.is_pro_rata_applicable",
"fieldname": "is_pro_rata_applicable",
"fieldtype": "Check",
"hidden": 1,
@ -254,7 +256,7 @@
"label": "Is Pro-Rata Applicable",
"length": 0,
"no_copy": 0,
"options": "earning_component.is_pro_rata_applicable",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -434,7 +436,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-17 12:43:21.082282",
"modified": "2018-05-25 12:43:21.082282",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Benefit Claim",

View File

@ -400,7 +400,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"default": "",
"fetch_from": "loan_type.rate_of_interest",
"fieldname": "rate_of_interest",
"fieldtype": "Percent",
"hidden": 0,
@ -413,7 +414,7 @@
"label": "Rate of Interest (%) / Year",
"length": 0,
"no_copy": 0,
"options": "loan_type.rate_of_interest",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -1072,7 +1073,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-04-08 15:32:58.948412",
"modified": "2018-05-25 15:32:58.948412",
"modified_by": "Administrator",
"module": "HR",
"name": "Loan",

View File

@ -491,6 +491,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "loan_type.rate_of_interest",
"fieldname": "rate_of_interest",
"fieldtype": "Percent",
"hidden": 0,
@ -503,7 +504,7 @@
"label": "Rate of Interest",
"length": 0,
"no_copy": 0,
"options": "loan_type.rate_of_interest",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -718,7 +719,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-02-26 08:35:57.606555",
"modified": "2018-05-25 08:35:57.606555",
"modified_by": "Administrator",
"module": "HR",
"name": "Loan Application",

View File

@ -270,7 +270,7 @@ def make_deduction_salary_component(salary_components):
def make_salary_structure(sal_struct, payroll_frequency, employee):
if not frappe.db.exists('Salary Structure', sal_struct):
frappe.get_doc({
salary_structure = frappe.get_doc({
"doctype": "Salary Structure",
"name": sal_struct,
"company": "_Test Company",
@ -280,12 +280,10 @@ def make_salary_structure(sal_struct, payroll_frequency, employee):
"payment_account": get_random("Account")
}).insert()
create_salary_structure_assignment(employee, sal_struct)
create_salary_structure_assignment(employee, salary_structure)
elif not frappe.db.get_value("Salary Structure Assignment",{'salary_structure':sal_struct, 'employee':employee},'name'):
sal_struct = frappe.get_doc("Salary Structure", sal_struct)
create_salary_structure_assignment(employee, sal_struct)
sal_struct = sal_struct.name
return sal_struct
def create_salary_structure_assignment(employee, salary_structure):

View File

@ -461,6 +461,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "employee.date_of_birth",
"fieldname": "date_of_birth",
"fieldtype": "Date",
"hidden": 0,
@ -473,7 +474,7 @@
"label": "Date of Birth",
"length": 0,
"no_copy": 0,
"options": "employee.date_of_birth",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -875,7 +876,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-16 22:43:34.438949",
"modified": "2018-05-25 22:43:34.438949",
"modified_by": "Administrator",
"module": "HR",
"name": "Travel Request",

View File

@ -343,6 +343,7 @@ def make_sales_invoice(source_name, item_code=None, customer=None):
billing_amount = flt(timesheet.total_billable_amount) - flt(timesheet.total_billed_amount)
billing_rate = billing_amount / hours
target.company = timesheet.company
if customer:
target.customer = customer

View File

@ -4,7 +4,6 @@
"doctype": "Item",
"has_batch_no": 0,
"has_serial_no": 0,
"inspection_required": 0,
"is_stock_item": 1,
"is_sub_contracted_item": 0,
@ -20,7 +19,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}],
"reorder_levels": [
{
@ -64,9 +63,8 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
}],
"income_account": "Sales - _TC"
}]
},
{
"description": "_Test Item Home Desktop 100 3",
@ -86,9 +84,8 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}],
"taxes": [
{
"doctype": "Item Tax",
@ -116,7 +113,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -137,7 +134,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -158,7 +155,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -192,7 +189,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -214,7 +211,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -235,7 +232,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -256,7 +253,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}]
},
{
@ -278,7 +275,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}],
"attributes": [
{
@ -313,7 +310,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC",
"income_account": "Sales - _TC"
}],
"reorder_levels": [
{

View File

@ -632,6 +632,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "item_code.retain_sample",
"fieldname": "retain_sample",
"fieldtype": "Check",
"hidden": 0,
@ -644,7 +645,7 @@
"label": "Retain Sample",
"length": 0,
"no_copy": 0,
"options": "item_code.retain_sample",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -665,6 +666,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "retain_sample",
"fetch_from": "item_code.sample_quantity",
"fieldname": "sample_quantity",
"fieldtype": "Int",
"hidden": 0,
@ -677,7 +679,7 @@
"label": "Sample Quantity",
"length": 0,
"no_copy": 0,
"options": "item_code.sample_quantity",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -2492,7 +2494,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-05-07 13:42:05.061386",
"modified": "2018-05-25 13:42:05.061386",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

View File

@ -837,6 +837,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "item_code.retain_sample",
"fieldname": "retain_sample",
"fieldtype": "Check",
"hidden": 0,
@ -849,7 +850,7 @@
"label": "Retain Sample",
"length": 0,
"no_copy": 0,
"options": "item_code.retain_sample",
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -1469,7 +1470,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-03-05 13:09:25.849700",
"modified": "2018-05-25 13:09:25.849700",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@ -289,8 +289,7 @@ def get_basic_details(args, item):
["Account", "expense_account", "default_expense_account"],
["Cost Center", "cost_center", "cost_center"],
["Warehouse", "warehouse", ""]]:
company = frappe.db.get_value(d[0], out.get(d[1]), "company")
if not out[d[1]] or (company and args.company != company):
if not out[d[1]]:
out[d[1]] = frappe.db.get_value("Company", args.company, d[2]) if d[2] else None
for fieldname in ("item_name", "item_group", "barcodes", "brand", "stock_uom"):