mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 00:25:01 +00:00
Merge pull request #51441 from mihir-kandoi/semgrep-autofixes
This commit is contained in:
@@ -450,14 +450,12 @@ def process_deferred_accounting(posting_date=None):
|
||||
for company in companies:
|
||||
for record_type in ("Income", "Expense"):
|
||||
doc = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
company=company.name,
|
||||
posting_date=posting_date,
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
type=record_type,
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
company=company.name,
|
||||
posting_date=posting_date,
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
type=record_type,
|
||||
)
|
||||
|
||||
doc.insert()
|
||||
|
||||
@@ -415,15 +415,13 @@ def create_account(**kwargs):
|
||||
return account.name
|
||||
else:
|
||||
account = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Account",
|
||||
is_group=kwargs.get("is_group", 0),
|
||||
account_name=kwargs.get("account_name"),
|
||||
account_type=kwargs.get("account_type"),
|
||||
parent_account=kwargs.get("parent_account"),
|
||||
company=kwargs.get("company"),
|
||||
account_currency=kwargs.get("account_currency"),
|
||||
)
|
||||
doctype="Account",
|
||||
is_group=kwargs.get("is_group", 0),
|
||||
account_name=kwargs.get("account_name"),
|
||||
account_type=kwargs.get("account_type"),
|
||||
parent_account=kwargs.get("parent_account"),
|
||||
company=kwargs.get("company"),
|
||||
account_currency=kwargs.get("account_currency"),
|
||||
)
|
||||
|
||||
account.save()
|
||||
|
||||
@@ -182,7 +182,7 @@ frappe.ui.form.on("Payment Entry", {
|
||||
"Dunning",
|
||||
];
|
||||
|
||||
if (in_list(party_type_doctypes, child.reference_doctype)) {
|
||||
if (party_type_doctypes.includes(child.reference_doctype)) {
|
||||
filters[doc.party_type.toLowerCase()] = doc.party;
|
||||
}
|
||||
|
||||
@@ -1041,7 +1041,7 @@ frappe.ui.form.on("Payment Entry", {
|
||||
c.allocated_amount = d.allocated_amount;
|
||||
c.account = d.account;
|
||||
|
||||
if (!in_list(frm.events.get_order_doctypes(frm), d.voucher_type)) {
|
||||
if (!frm.events.get_order_doctypes(frm).includes(d.voucher_type)) {
|
||||
if (flt(d.outstanding_amount) > 0)
|
||||
total_positive_outstanding += flt(d.outstanding_amount);
|
||||
else total_negative_outstanding += Math.abs(flt(d.outstanding_amount));
|
||||
@@ -1057,7 +1057,7 @@ frappe.ui.form.on("Payment Entry", {
|
||||
} else {
|
||||
c.exchange_rate = 1;
|
||||
}
|
||||
if (in_list(frm.events.get_invoice_doctypes(frm), d.reference_doctype)) {
|
||||
if (frm.events.get_invoice_doctypes(frm).includes(d.reference_doctype)) {
|
||||
c.due_date = d.due_date;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,12 +50,10 @@ class TestPaymentOrder(IntegrationTestCase):
|
||||
|
||||
def create_payment_order_against_payment_entry(ref_doc, order_type, bank_account):
|
||||
payment_order = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Payment Order",
|
||||
company="_Test Company",
|
||||
payment_order_type=order_type,
|
||||
company_bank_account=bank_account,
|
||||
)
|
||||
doctype="Payment Order",
|
||||
company="_Test Company",
|
||||
payment_order_type=order_type,
|
||||
company_bank_account=bank_account,
|
||||
)
|
||||
doc = make_payment_order(ref_doc.name, payment_order)
|
||||
doc.save()
|
||||
|
||||
@@ -171,7 +171,7 @@ frappe.ui.form.on("Pricing Rule", {
|
||||
|
||||
set_field_options("applicable_for", options.join("\n"));
|
||||
|
||||
if (!in_list(options, applicable_for)) applicable_for = null;
|
||||
if (!options.includes(applicable_for)) applicable_for = null;
|
||||
frm.set_value("applicable_for", applicable_for);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -48,13 +48,11 @@ class TestProcessDeferredAccounting(IntegrationTestCase):
|
||||
check_gl_entries(self, si.name, original_gle, "2023-07-01")
|
||||
|
||||
process_deferred_accounting = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date="2023-07-01",
|
||||
start_date="2023-05-01",
|
||||
end_date="2023-06-30",
|
||||
type="Income",
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date="2023-07-01",
|
||||
start_date="2023-05-01",
|
||||
end_date="2023-06-30",
|
||||
type="Income",
|
||||
)
|
||||
|
||||
process_deferred_accounting.insert()
|
||||
@@ -80,13 +78,11 @@ class TestProcessDeferredAccounting(IntegrationTestCase):
|
||||
|
||||
def test_pda_submission_and_cancellation(self):
|
||||
pda = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date="2019-01-01",
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-01-31",
|
||||
type="Income",
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date="2019-01-01",
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-01-31",
|
||||
type="Income",
|
||||
)
|
||||
pda.submit()
|
||||
pda.cancel()
|
||||
|
||||
@@ -46,7 +46,7 @@ frappe.ui.form.on("Promotional Scheme", {
|
||||
|
||||
set_field_options("applicable_for", options.join("\n"));
|
||||
|
||||
if (!in_list(options, applicable_for)) applicable_for = null;
|
||||
if (!options.includes(applicable_for)) applicable_for = null;
|
||||
frm.set_value("applicable_for", applicable_for);
|
||||
},
|
||||
|
||||
|
||||
@@ -1249,14 +1249,12 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
|
||||
pi.submit()
|
||||
|
||||
pda1 = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Expense",
|
||||
company="_Test Company",
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Expense",
|
||||
company="_Test Company",
|
||||
)
|
||||
|
||||
pda1.insert()
|
||||
|
||||
@@ -2510,14 +2510,12 @@ class TestSalesInvoice(ERPNextTestSuite):
|
||||
si.submit()
|
||||
|
||||
pda1 = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Income",
|
||||
company="_Test Company",
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Income",
|
||||
company="_Test Company",
|
||||
)
|
||||
|
||||
pda1.insert()
|
||||
@@ -2568,14 +2566,12 @@ class TestSalesInvoice(ERPNextTestSuite):
|
||||
si.submit()
|
||||
|
||||
pda1 = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date="2019-03-31",
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Income",
|
||||
company="_Test Company",
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date="2019-03-31",
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Income",
|
||||
company="_Test Company",
|
||||
)
|
||||
|
||||
pda1.insert()
|
||||
@@ -3478,14 +3474,12 @@ class TestSalesInvoice(ERPNextTestSuite):
|
||||
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", getdate("2019-01-31"))
|
||||
|
||||
pda1 = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Income",
|
||||
company="_Test Company",
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2019-01-01",
|
||||
end_date="2019-03-31",
|
||||
type="Income",
|
||||
company="_Test Company",
|
||||
)
|
||||
|
||||
pda1.insert()
|
||||
|
||||
@@ -101,14 +101,12 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
||||
si.submit()
|
||||
|
||||
pda = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2021-05-01",
|
||||
end_date="2021-08-01",
|
||||
type="Income",
|
||||
company=self.company,
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2021-05-01",
|
||||
end_date="2021-08-01",
|
||||
type="Income",
|
||||
company=self.company,
|
||||
)
|
||||
pda.insert()
|
||||
pda.submit()
|
||||
@@ -173,14 +171,12 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
||||
pi.submit()
|
||||
|
||||
pda = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2021-05-01",
|
||||
end_date="2021-08-01",
|
||||
type="Expense",
|
||||
company=self.company,
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2021-05-01",
|
||||
end_date="2021-08-01",
|
||||
type="Expense",
|
||||
company=self.company,
|
||||
)
|
||||
pda.insert()
|
||||
pda.submit()
|
||||
@@ -240,14 +236,12 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
||||
si.submit()
|
||||
|
||||
pda = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2021-05-01",
|
||||
end_date="2021-08-01",
|
||||
type="Income",
|
||||
company=self.company,
|
||||
)
|
||||
doctype="Process Deferred Accounting",
|
||||
posting_date=nowdate(),
|
||||
start_date="2021-05-01",
|
||||
end_date="2021-08-01",
|
||||
type="Income",
|
||||
company=self.company,
|
||||
)
|
||||
pda.insert()
|
||||
pda.submit()
|
||||
|
||||
@@ -131,16 +131,14 @@ class TestSupplier(IntegrationTestCase):
|
||||
self.assertEqual(details.tax_category, "_Test Tax Category 1")
|
||||
|
||||
address = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Address",
|
||||
address_title="_Test Address With Tax Category",
|
||||
tax_category="_Test Tax Category 2",
|
||||
address_type="Billing",
|
||||
address_line1="Station Road",
|
||||
city="_Test City",
|
||||
country="India",
|
||||
links=[dict(link_doctype="Supplier", link_name="_Test Supplier With Tax Category")],
|
||||
)
|
||||
doctype="Address",
|
||||
address_title="_Test Address With Tax Category",
|
||||
tax_category="_Test Tax Category 2",
|
||||
address_type="Billing",
|
||||
address_line1="Station Road",
|
||||
city="_Test City",
|
||||
country="India",
|
||||
links=[dict(link_doctype="Supplier", link_name="_Test Supplier With Tax Category")],
|
||||
).insert()
|
||||
|
||||
# Tax Category with Address
|
||||
|
||||
@@ -97,7 +97,7 @@ frappe.query_reports["Purchase Order Analysis"] = {
|
||||
value = default_formatter(value, row, column, data);
|
||||
let format_fields = ["received_qty", "billed_amount"];
|
||||
|
||||
if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) {
|
||||
if (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) {
|
||||
value = "<span style='color:green'>" + value + "</span>";
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -30,4 +30,4 @@ def execute():
|
||||
|
||||
def insert_sales_partner_type(s):
|
||||
if not frappe.db.exists("Sales Partner Type", s):
|
||||
frappe.get_doc(dict(doctype="Sales Partner Type", sales_partner_type=s)).insert()
|
||||
frappe.get_doc(doctype="Sales Partner Type", sales_partner_type=s).insert()
|
||||
|
||||
@@ -30,15 +30,13 @@ def execute():
|
||||
if task.subject:
|
||||
replace_tasks = True
|
||||
new_task = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Task",
|
||||
subject=task.subject,
|
||||
start=task.start,
|
||||
duration=task.duration,
|
||||
task_weight=task.task_weight,
|
||||
description=task.description,
|
||||
is_template=1,
|
||||
)
|
||||
doctype="Task",
|
||||
subject=task.subject,
|
||||
start=task.start,
|
||||
duration=task.duration,
|
||||
task_weight=task.task_weight,
|
||||
description=task.description,
|
||||
is_template=1,
|
||||
).insert()
|
||||
new_tasks.append(new_task)
|
||||
|
||||
|
||||
@@ -127,22 +127,20 @@ class Project(Document):
|
||||
|
||||
def create_task_from_template(self, task_details):
|
||||
return frappe.get_doc(
|
||||
dict(
|
||||
doctype="Task",
|
||||
subject=task_details.subject,
|
||||
project=self.name,
|
||||
status="Open",
|
||||
exp_start_date=self.calculate_start_date(task_details),
|
||||
exp_end_date=self.calculate_end_date(task_details),
|
||||
description=task_details.description,
|
||||
task_weight=task_details.task_weight,
|
||||
type=task_details.type,
|
||||
issue=task_details.issue,
|
||||
is_group=task_details.is_group,
|
||||
color=task_details.color,
|
||||
template_task=task_details.name,
|
||||
priority=task_details.priority,
|
||||
)
|
||||
doctype="Task",
|
||||
subject=task_details.subject,
|
||||
project=self.name,
|
||||
status="Open",
|
||||
exp_start_date=self.calculate_start_date(task_details),
|
||||
exp_end_date=self.calculate_end_date(task_details),
|
||||
description=task_details.description,
|
||||
task_weight=task_details.task_weight,
|
||||
type=task_details.type,
|
||||
issue=task_details.issue,
|
||||
is_group=task_details.is_group,
|
||||
color=task_details.color,
|
||||
template_task=task_details.name,
|
||||
priority=task_details.priority,
|
||||
).insert()
|
||||
|
||||
def calculate_start_date(self, task_details):
|
||||
|
||||
@@ -255,14 +255,12 @@ class TestProject(ERPNextTestSuite):
|
||||
|
||||
def get_project(name, template):
|
||||
project = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Project",
|
||||
project_name=name,
|
||||
status="Open",
|
||||
project_template=template.name,
|
||||
expected_start_date=nowdate(),
|
||||
company="_Test Company",
|
||||
)
|
||||
doctype="Project",
|
||||
project_name=name,
|
||||
status="Open",
|
||||
project_template=template.name,
|
||||
expected_start_date=nowdate(),
|
||||
company="_Test Company",
|
||||
).insert()
|
||||
|
||||
return project
|
||||
@@ -275,13 +273,11 @@ def make_project(args):
|
||||
return frappe.get_doc("Project", {"project_name": args.project_name})
|
||||
|
||||
project = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Project",
|
||||
project_name=args.project_name,
|
||||
status="Open",
|
||||
expected_start_date=args.start_date,
|
||||
company=args.company or "_Test Company",
|
||||
)
|
||||
doctype="Project",
|
||||
project_name=args.project_name,
|
||||
status="Open",
|
||||
expected_start_date=args.start_date,
|
||||
company=args.company or "_Test Company",
|
||||
)
|
||||
|
||||
if args.project_template_name:
|
||||
|
||||
@@ -20,7 +20,7 @@ def make_project_template(project_template_name, project_tasks=None):
|
||||
create_task(subject="_Test Template Task 1", is_template=1, begin=0, duration=3),
|
||||
create_task(subject="_Test Template Task 2", is_template=1, begin=0, duration=2),
|
||||
]
|
||||
doc = frappe.get_doc(dict(doctype="Project Template", name=project_template_name))
|
||||
doc = frappe.get_doc(doctype="Project Template", name=project_template_name)
|
||||
for task in project_tasks:
|
||||
doc.append("tasks", {"task": task.name})
|
||||
doc.insert()
|
||||
|
||||
@@ -1106,7 +1106,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
||||
var payment_types = $.map(this.frm.doc.payments, function (d) {
|
||||
return d.type;
|
||||
});
|
||||
if (in_list(payment_types, "Cash")) {
|
||||
if (payment_types.includes("Cash")) {
|
||||
var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
|
||||
var base_grand_total = this.frm.doc.base_rounded_total || this.frm.doc.base_grand_total;
|
||||
|
||||
|
||||
@@ -904,7 +904,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
get_incoming_rate(item, posting_date, posting_time, voucher_type, company) {
|
||||
let item_args = {
|
||||
item_code: item.item_code,
|
||||
warehouse: in_list("Purchase Receipt", "Purchase Invoice") ? item.from_warehouse : item.warehouse,
|
||||
warehouse: item.warehouse,
|
||||
posting_date: posting_date,
|
||||
posting_time: posting_time,
|
||||
qty: item.qty * item.conversion_factor,
|
||||
@@ -2248,7 +2248,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
child.apply_rule_on_other_items &&
|
||||
JSON.parse(child.apply_rule_on_other_items).length
|
||||
) {
|
||||
if (!in_list(JSON.parse(child.apply_rule_on_other_items), child.item_code)) {
|
||||
if (!JSON.parse(child.apply_rule_on_other_items).includes(child.item_code)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2296,7 +2296,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
if (JSON.parse(data.apply_rule_on_other_items).includes(d[data.apply_rule_on])) {
|
||||
for (var k in data) {
|
||||
if (
|
||||
in_list(fields, k) &&
|
||||
fields.includes(k) &&
|
||||
data[k] &&
|
||||
(data.price_or_product_discount === "Price" || k === "pricing_rules")
|
||||
) {
|
||||
@@ -2768,8 +2768,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
}
|
||||
|
||||
has_discount_in_schedule() {
|
||||
let is_eligible = in_list(
|
||||
["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"],
|
||||
let is_eligible = ["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"].includes(
|
||||
this.frm.doctype
|
||||
);
|
||||
let has_payment_schedule = this.frm.doc.payment_schedule && this.frm.doc.payment_schedule.length;
|
||||
@@ -3205,16 +3204,13 @@ erpnext.show_serial_batch_selector = function (frm, item_row, callback, on_close
|
||||
}
|
||||
|
||||
if (
|
||||
in_list(
|
||||
[
|
||||
"Material Transfer",
|
||||
"Send to Subcontractor",
|
||||
"Material Issue",
|
||||
"Material Consumption for Manufacture",
|
||||
"Material Transfer for Manufacture",
|
||||
],
|
||||
frm.doc.purpose
|
||||
)
|
||||
[
|
||||
"Material Transfer",
|
||||
"Send to Subcontractor",
|
||||
"Material Issue",
|
||||
"Material Consumption for Manufacture",
|
||||
"Material Transfer for Manufacture",
|
||||
].includes(frm.doc.purpose)
|
||||
) {
|
||||
warehouse_field = "s_warehouse";
|
||||
} else {
|
||||
|
||||
@@ -338,7 +338,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
|
||||
? this.dialog.get_value("serial_no").split("\n")
|
||||
: [];
|
||||
|
||||
if (in_list(serial_nos, serial_no)) {
|
||||
if (serial_nos.includes(serial_no)) {
|
||||
frappe.throw(__("Serial No {0} already scanned", [serial_no]));
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
|
||||
];
|
||||
|
||||
for (let key in prev_row) {
|
||||
if (in_list(ignore_fields, key)) {
|
||||
if (ignore_fields.includes(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ erpnext.utils.get_party_details = function (frm, method, args, callback) {
|
||||
}
|
||||
|
||||
if (!args) {
|
||||
if (in_list(SALES_DOCTYPES, frm.doc.doctype)) {
|
||||
if (SALES_DOCTYPES.includes(frm.doc.doctype)) {
|
||||
args = {
|
||||
party: frm.doc.customer || frm.doc.party_name,
|
||||
party_type: "Customer",
|
||||
};
|
||||
}
|
||||
|
||||
if (in_list(PURCHASE_DOCTYPES, frm.doc.doctype)) {
|
||||
if (PURCHASE_DOCTYPES.includes(frm.doc.doctype)) {
|
||||
args = {
|
||||
party: frm.doc.supplier,
|
||||
party_type: "Supplier",
|
||||
@@ -57,13 +57,13 @@ erpnext.utils.get_party_details = function (frm, method, args, callback) {
|
||||
args.fetch_payment_terms_template = cint(!frm.doc.ignore_default_payment_terms_template);
|
||||
}
|
||||
|
||||
if (in_list(SALES_DOCTYPES, frm.doc.doctype)) {
|
||||
if (SALES_DOCTYPES.includes(frm.doc.doctype)) {
|
||||
if (!args.company_address && frm.doc.company_address) {
|
||||
args.company_address = frm.doc.company_address;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_list(PURCHASE_DOCTYPES, frm.doc.doctype)) {
|
||||
if (PURCHASE_DOCTYPES.includes(frm.doc.doctype)) {
|
||||
if (!args.company_address && frm.doc.billing_address) {
|
||||
args.company_address = frm.doc.billing_address;
|
||||
}
|
||||
|
||||
@@ -9,20 +9,16 @@ from frappe.tests import IntegrationTestCase
|
||||
class TestQualityFeedback(IntegrationTestCase):
|
||||
def test_quality_feedback(self):
|
||||
template = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Quality Feedback Template",
|
||||
template="Test Template",
|
||||
parameters=[dict(parameter="Test Parameter 1"), dict(parameter="Test Parameter 2")],
|
||||
)
|
||||
doctype="Quality Feedback Template",
|
||||
template="Test Template",
|
||||
parameters=[dict(parameter="Test Parameter 1"), dict(parameter="Test Parameter 2")],
|
||||
).insert()
|
||||
|
||||
feedback = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Quality Feedback",
|
||||
template=template.name,
|
||||
document_type="User",
|
||||
document_name=frappe.session.user,
|
||||
)
|
||||
doctype="Quality Feedback",
|
||||
template=template.name,
|
||||
document_type="User",
|
||||
document_name=frappe.session.user,
|
||||
).insert()
|
||||
|
||||
self.assertEqual(template.parameters[0].parameter, feedback.parameters[0].parameter)
|
||||
|
||||
@@ -16,10 +16,8 @@ class TestQualityGoal(IntegrationTestCase):
|
||||
|
||||
def get_quality_goal():
|
||||
return frappe.get_doc(
|
||||
dict(
|
||||
doctype="Quality Goal",
|
||||
goal="Test Quality Module",
|
||||
frequency="Daily",
|
||||
objectives=[dict(objective="Check test cases", target="100", uom="Percent")],
|
||||
)
|
||||
doctype="Quality Goal",
|
||||
goal="Test Quality Module",
|
||||
frequency="Daily",
|
||||
objectives=[dict(objective="Check test cases", target="100", uom="Percent")],
|
||||
).insert()
|
||||
|
||||
@@ -50,5 +50,5 @@ def update_address_template(country, html, is_default=0):
|
||||
frappe.db.set_value("Address Template", country, "is_default", is_default)
|
||||
else:
|
||||
frappe.get_doc(
|
||||
dict(doctype="Address Template", country=country, is_default=is_default, template=html)
|
||||
doctype="Address Template", country=country, is_default=is_default, template=html
|
||||
).insert()
|
||||
|
||||
@@ -470,11 +470,9 @@ def setup_report():
|
||||
|
||||
if not frappe.db.get_value("Custom Role", dict(report=report_name)):
|
||||
frappe.get_doc(
|
||||
dict(
|
||||
doctype="Custom Role",
|
||||
report=report_name,
|
||||
roles=[dict(role="Accounts User"), dict(role="Accounts Manager")],
|
||||
)
|
||||
doctype="Custom Role",
|
||||
report=report_name,
|
||||
roles=[dict(role="Accounts User"), dict(role="Accounts Manager")],
|
||||
).insert()
|
||||
|
||||
|
||||
|
||||
@@ -50,9 +50,7 @@ def add_permissions():
|
||||
|
||||
if not frappe.db.get_value("Custom Role", dict(report="VAT Audit Report")):
|
||||
frappe.get_doc(
|
||||
dict(
|
||||
doctype="Custom Role",
|
||||
report="VAT Audit Report",
|
||||
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
|
||||
)
|
||||
doctype="Custom Role",
|
||||
report="VAT Audit Report",
|
||||
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
|
||||
).insert()
|
||||
|
||||
@@ -261,11 +261,9 @@ def add_custom_roles_for_reports():
|
||||
"""Add Access Control to UAE VAT 201."""
|
||||
if not frappe.db.get_value("Custom Role", dict(report="UAE VAT 201")):
|
||||
frappe.get_doc(
|
||||
dict(
|
||||
doctype="Custom Role",
|
||||
report="UAE VAT 201",
|
||||
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
|
||||
)
|
||||
doctype="Custom Role",
|
||||
report="UAE VAT 201",
|
||||
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
|
||||
).insert()
|
||||
|
||||
|
||||
|
||||
@@ -104,28 +104,24 @@ class TestCustomer(IntegrationTestCase):
|
||||
self.assertEqual(details.tax_category, "_Test Tax Category 1")
|
||||
|
||||
billing_address = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Address",
|
||||
address_title="_Test Address With Tax Category",
|
||||
tax_category="_Test Tax Category 2",
|
||||
address_type="Billing",
|
||||
address_line1="Station Road",
|
||||
city="_Test City",
|
||||
country="India",
|
||||
links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")],
|
||||
)
|
||||
doctype="Address",
|
||||
address_title="_Test Address With Tax Category",
|
||||
tax_category="_Test Tax Category 2",
|
||||
address_type="Billing",
|
||||
address_line1="Station Road",
|
||||
city="_Test City",
|
||||
country="India",
|
||||
links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")],
|
||||
).insert()
|
||||
shipping_address = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Address",
|
||||
address_title="_Test Address With Tax Category",
|
||||
tax_category="_Test Tax Category 3",
|
||||
address_type="Shipping",
|
||||
address_line1="Station Road",
|
||||
city="_Test City",
|
||||
country="India",
|
||||
links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")],
|
||||
)
|
||||
doctype="Address",
|
||||
address_title="_Test Address With Tax Category",
|
||||
tax_category="_Test Tax Category 3",
|
||||
address_type="Shipping",
|
||||
address_line1="Station Road",
|
||||
city="_Test City",
|
||||
country="India",
|
||||
links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")],
|
||||
).insert()
|
||||
|
||||
settings = frappe.get_single("Accounts Settings")
|
||||
|
||||
@@ -1743,18 +1743,16 @@ def make_work_orders(items, sales_order, company, project=None):
|
||||
frappe.throw(_("Please select Qty against item {0}").format(i.get("item_code")))
|
||||
|
||||
work_order = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Work Order",
|
||||
production_item=i["item_code"],
|
||||
bom_no=i.get("bom"),
|
||||
qty=i["pending_qty"],
|
||||
company=company,
|
||||
sales_order=sales_order,
|
||||
sales_order_item=i["sales_order_item"],
|
||||
project=project,
|
||||
fg_warehouse=i["warehouse"],
|
||||
description=i["description"],
|
||||
)
|
||||
doctype="Work Order",
|
||||
production_item=i["item_code"],
|
||||
bom_no=i.get("bom"),
|
||||
qty=i["pending_qty"],
|
||||
company=company,
|
||||
sales_order=sales_order,
|
||||
sales_order_item=i["sales_order_item"],
|
||||
project=project,
|
||||
fg_warehouse=i["warehouse"],
|
||||
description=i["description"],
|
||||
).insert()
|
||||
work_order.set_work_order_operations()
|
||||
work_order.flags.ignore_mandatory = True
|
||||
|
||||
@@ -2713,8 +2713,8 @@ def make_sales_order_workflow():
|
||||
doc.save()
|
||||
return doc
|
||||
|
||||
frappe.get_doc(dict(doctype="Role", role_name="Test Junior Approver")).insert(ignore_if_duplicate=True)
|
||||
frappe.get_doc(dict(doctype="Role", role_name="Test Approver")).insert(ignore_if_duplicate=True)
|
||||
frappe.get_doc(doctype="Role", role_name="Test Junior Approver").insert(ignore_if_duplicate=True)
|
||||
frappe.get_doc(doctype="Role", role_name="Test Approver").insert(ignore_if_duplicate=True)
|
||||
frappe.cache().hdel("roles", frappe.session.user)
|
||||
|
||||
workflow = frappe.get_doc(
|
||||
|
||||
@@ -54,7 +54,7 @@ frappe.query_reports["Item-wise Sales History"] = {
|
||||
value = default_formatter(value, row, column, data);
|
||||
let format_fields = ["delivered_quantity", "billed_amount"];
|
||||
|
||||
if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) {
|
||||
if (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) {
|
||||
value = "<span style='color:green;'>" + value + "</span>";
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -96,7 +96,7 @@ frappe.query_reports["Sales Order Analysis"] = {
|
||||
value = default_formatter(value, row, column, data);
|
||||
let format_fields = ["delivered_qty", "billed_amount"];
|
||||
|
||||
if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) {
|
||||
if (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) {
|
||||
value = "<span style='color:green;'>" + value + "</span>";
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ erpnext.company.set_chart_of_accounts_options = function (doc) {
|
||||
callback: function (r) {
|
||||
if (!r.exc) {
|
||||
set_field_options("chart_of_accounts", [""].concat(r.message).join("\n"));
|
||||
if (in_list(r.message, selected_value))
|
||||
if (r.message.includes(selected_value))
|
||||
cur_frm.set_value("chart_of_accounts", selected_value);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -306,7 +306,7 @@ def get_batches_by_oldest(item_code, warehouse):
|
||||
@frappe.whitelist()
|
||||
def split_batch(batch_no: str, item_code: str, warehouse: str, qty: float, new_batch_id: str | None = None):
|
||||
"""Split the batch into a new batch"""
|
||||
batch = frappe.get_doc(dict(doctype="Batch", item=item_code, batch_id=new_batch_id)).insert()
|
||||
batch = frappe.get_doc(doctype="Batch", item=item_code, batch_id=new_batch_id).insert()
|
||||
qty = flt(qty)
|
||||
|
||||
company = frappe.db.get_value("Warehouse", warehouse, "company")
|
||||
@@ -330,22 +330,18 @@ def split_batch(batch_no: str, item_code: str, warehouse: str, qty: float, new_b
|
||||
)
|
||||
|
||||
stock_entry = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Stock Entry",
|
||||
purpose="Repack",
|
||||
company=company,
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_code,
|
||||
qty=qty,
|
||||
s_warehouse=warehouse,
|
||||
serial_and_batch_bundle=from_bundle_id,
|
||||
),
|
||||
dict(
|
||||
item_code=item_code, qty=qty, t_warehouse=warehouse, serial_and_batch_bundle=to_bundle_id
|
||||
),
|
||||
],
|
||||
)
|
||||
doctype="Stock Entry",
|
||||
purpose="Repack",
|
||||
company=company,
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_code,
|
||||
qty=qty,
|
||||
s_warehouse=warehouse,
|
||||
serial_and_batch_bundle=from_bundle_id,
|
||||
),
|
||||
dict(item_code=item_code, qty=qty, t_warehouse=warehouse, serial_and_batch_bundle=to_bundle_id),
|
||||
],
|
||||
)
|
||||
stock_entry.set_stock_entry_type()
|
||||
stock_entry.insert()
|
||||
|
||||
@@ -45,12 +45,10 @@ class TestBatch(IntegrationTestCase):
|
||||
self.make_batch_item("ITEM-BATCH-1")
|
||||
|
||||
receipt = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Purchase Receipt",
|
||||
supplier="_Test Supplier",
|
||||
company="_Test Company",
|
||||
items=[dict(item_code="ITEM-BATCH-1", qty=batch_qty, rate=10, warehouse="Stores - _TC")],
|
||||
)
|
||||
doctype="Purchase Receipt",
|
||||
supplier="_Test Supplier",
|
||||
company="_Test Company",
|
||||
items=[dict(item_code="ITEM-BATCH-1", qty=batch_qty, rate=10, warehouse="Stores - _TC")],
|
||||
).insert()
|
||||
receipt.submit()
|
||||
|
||||
@@ -66,12 +64,10 @@ class TestBatch(IntegrationTestCase):
|
||||
self.make_batch_item("ITEM-BATCH-1")
|
||||
|
||||
receipt = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Purchase Receipt",
|
||||
supplier="_Test Supplier",
|
||||
company="_Test Company",
|
||||
items=[dict(item_code="ITEM-BATCH-1", qty=10, rate=10, warehouse="Stores - _TC")],
|
||||
)
|
||||
doctype="Purchase Receipt",
|
||||
supplier="_Test Supplier",
|
||||
company="_Test Company",
|
||||
items=[dict(item_code="ITEM-BATCH-1", qty=10, rate=10, warehouse="Stores - _TC")],
|
||||
).insert()
|
||||
receipt.submit()
|
||||
|
||||
@@ -96,20 +92,18 @@ class TestBatch(IntegrationTestCase):
|
||||
)
|
||||
|
||||
receipt2 = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Purchase Receipt",
|
||||
supplier="_Test Supplier",
|
||||
company="_Test Company",
|
||||
items=[
|
||||
dict(
|
||||
item_code="ITEM-BATCH-1",
|
||||
qty=20,
|
||||
rate=10,
|
||||
warehouse="_Test Warehouse - _TC",
|
||||
serial_and_batch_bundle=bundle_id,
|
||||
)
|
||||
],
|
||||
)
|
||||
doctype="Purchase Receipt",
|
||||
supplier="_Test Supplier",
|
||||
company="_Test Company",
|
||||
items=[
|
||||
dict(
|
||||
item_code="ITEM-BATCH-1",
|
||||
qty=20,
|
||||
rate=10,
|
||||
warehouse="_Test Warehouse - _TC",
|
||||
serial_and_batch_bundle=bundle_id,
|
||||
)
|
||||
],
|
||||
).insert()
|
||||
receipt2.submit()
|
||||
|
||||
@@ -135,20 +129,18 @@ class TestBatch(IntegrationTestCase):
|
||||
self.make_batch_item("ITEM-BATCH-1")
|
||||
|
||||
stock_entry = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Stock Entry",
|
||||
purpose="Material Receipt",
|
||||
company="_Test Company",
|
||||
items=[
|
||||
dict(
|
||||
item_code="ITEM-BATCH-1",
|
||||
qty=90,
|
||||
t_warehouse="_Test Warehouse - _TC",
|
||||
cost_center="Main - _TC",
|
||||
rate=10,
|
||||
)
|
||||
],
|
||||
)
|
||||
doctype="Stock Entry",
|
||||
purpose="Material Receipt",
|
||||
company="_Test Company",
|
||||
items=[
|
||||
dict(
|
||||
item_code="ITEM-BATCH-1",
|
||||
qty=90,
|
||||
t_warehouse="_Test Warehouse - _TC",
|
||||
cost_center="Main - _TC",
|
||||
rate=10,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
stock_entry.set_stock_entry_type()
|
||||
@@ -187,20 +179,18 @@ class TestBatch(IntegrationTestCase):
|
||||
)
|
||||
|
||||
delivery_note = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Delivery Note",
|
||||
customer="_Test Customer",
|
||||
company=receipt.company,
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_code,
|
||||
qty=batch_qty,
|
||||
rate=10,
|
||||
warehouse=receipt.items[0].warehouse,
|
||||
serial_and_batch_bundle=bundle_id,
|
||||
)
|
||||
],
|
||||
)
|
||||
doctype="Delivery Note",
|
||||
customer="_Test Customer",
|
||||
company=receipt.company,
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_code,
|
||||
qty=batch_qty,
|
||||
rate=10,
|
||||
warehouse=receipt.items[0].warehouse,
|
||||
serial_and_batch_bundle=bundle_id,
|
||||
)
|
||||
],
|
||||
).insert()
|
||||
delivery_note.submit()
|
||||
|
||||
@@ -261,19 +251,17 @@ class TestBatch(IntegrationTestCase):
|
||||
)
|
||||
|
||||
stock_entry = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Stock Entry",
|
||||
purpose="Material Issue",
|
||||
company=receipt.company,
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_code,
|
||||
qty=batch_qty,
|
||||
s_warehouse=receipt.items[0].warehouse,
|
||||
serial_and_batch_bundle=bundle_id,
|
||||
)
|
||||
],
|
||||
)
|
||||
doctype="Stock Entry",
|
||||
purpose="Material Issue",
|
||||
company=receipt.company,
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_code,
|
||||
qty=batch_qty,
|
||||
s_warehouse=receipt.items[0].warehouse,
|
||||
serial_and_batch_bundle=bundle_id,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
stock_entry.set_stock_entry_type()
|
||||
@@ -373,7 +361,7 @@ class TestBatch(IntegrationTestCase):
|
||||
"""Make a new stock entry for given target warehouse and batch name of item"""
|
||||
|
||||
if not frappe.db.exists("Batch", batch_name):
|
||||
batch = frappe.get_doc(dict(doctype="Batch", item=item_name, batch_id=batch_name)).insert(
|
||||
batch = frappe.get_doc(doctype="Batch", item=item_name, batch_id=batch_name).insert(
|
||||
ignore_permissions=True
|
||||
)
|
||||
batch.save()
|
||||
@@ -393,22 +381,20 @@ class TestBatch(IntegrationTestCase):
|
||||
).make_serial_and_batch_bundle()
|
||||
|
||||
stock_entry = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Stock Entry",
|
||||
purpose="Material Receipt",
|
||||
company="_Test Company",
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_name,
|
||||
qty=90,
|
||||
serial_and_batch_bundle=sn_doc.name,
|
||||
t_warehouse=warehouse,
|
||||
cost_center="Main - _TC",
|
||||
rate=10,
|
||||
allow_zero_valuation_rate=1,
|
||||
)
|
||||
],
|
||||
)
|
||||
doctype="Stock Entry",
|
||||
purpose="Material Receipt",
|
||||
company="_Test Company",
|
||||
items=[
|
||||
dict(
|
||||
item_code=item_name,
|
||||
qty=90,
|
||||
serial_and_batch_bundle=sn_doc.name,
|
||||
t_warehouse=warehouse,
|
||||
cost_center="Main - _TC",
|
||||
rate=10,
|
||||
allow_zero_valuation_rate=1,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
stock_entry.set_stock_entry_type()
|
||||
|
||||
@@ -56,7 +56,7 @@ frappe.ui.form.on("Inventory Dimension", {
|
||||
];
|
||||
|
||||
frm.fields.forEach((field) => {
|
||||
if (!in_list(allow_to_edit_fields, field.df.fieldname)) {
|
||||
if (!allow_to_edit_fields.includes(field.df.fieldname)) {
|
||||
frm.set_df_property(field.df.fieldname, "read_only", "1");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1089,9 +1089,9 @@ function open_form(frm, doctype, child_doctype, parentfield) {
|
||||
let new_child_doc = frappe.model.add_child(new_doc, child_doctype, parentfield);
|
||||
new_child_doc.item_code = frm.doc.name;
|
||||
new_child_doc.item_name = frm.doc.item_name;
|
||||
if (in_list(SALES_DOCTYPES, doctype) && frm.doc.sales_uom) {
|
||||
if (SALES_DOCTYPES.includes(doctype) && frm.doc.sales_uom) {
|
||||
new_child_doc.uom = frm.doc.sales_uom;
|
||||
} else if (in_list(PURCHASE_DOCTYPES, doctype) && frm.doc.purchase_uom) {
|
||||
} else if (PURCHASE_DOCTYPES.includes(doctype) && frm.doc.purchase_uom) {
|
||||
new_child_doc.uom = frm.doc.purchase_uom;
|
||||
} else {
|
||||
new_child_doc.uom = frm.doc.stock_uom;
|
||||
|
||||
@@ -30,9 +30,9 @@ frappe.ui.form.on("Item Variant Settings", {
|
||||
field_label_map[d.fieldname] = __(d.label, null, d.parent) + ` (${d.fieldname})`;
|
||||
|
||||
if (
|
||||
!in_list(exclude_field_types, d.fieldtype) &&
|
||||
!exclude_field_types.includes(d.fieldtype) &&
|
||||
!d.no_copy &&
|
||||
!in_list(exclude_fields, d.fieldname)
|
||||
!exclude_fields.includes(d.fieldname)
|
||||
) {
|
||||
allow_fields.push({
|
||||
label: field_label_map[d.fieldname],
|
||||
|
||||
@@ -1290,10 +1290,11 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle
|
||||
// Clear Work Order record from locals, because it is updated via Stock Entry
|
||||
if (
|
||||
this.frm.doc.work_order &&
|
||||
in_list(
|
||||
["Manufacture", "Material Transfer for Manufacture", "Material Consumption for Manufacture"],
|
||||
this.frm.doc.purpose
|
||||
)
|
||||
[
|
||||
"Manufacture",
|
||||
"Material Transfer for Manufacture",
|
||||
"Material Consumption for Manufacture",
|
||||
].includes(this.frm.doc.purpose)
|
||||
) {
|
||||
frappe.model.remove_from_locals("Work Order", this.frm.doc.work_order);
|
||||
}
|
||||
|
||||
@@ -13,12 +13,10 @@ class TestStockSettings(IntegrationTestCase):
|
||||
|
||||
def test_settings(self):
|
||||
item = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Item",
|
||||
item_code="Item for description test",
|
||||
item_group="Products",
|
||||
description='<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>',
|
||||
)
|
||||
doctype="Item",
|
||||
item_code="Item for description test",
|
||||
item_group="Products",
|
||||
description='<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>',
|
||||
).insert()
|
||||
|
||||
settings = frappe.get_single("Stock Settings")
|
||||
@@ -40,12 +38,10 @@ class TestStockSettings(IntegrationTestCase):
|
||||
settings.save()
|
||||
|
||||
item = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Item",
|
||||
item_code="Item for description test",
|
||||
item_group="Products",
|
||||
description='<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>',
|
||||
)
|
||||
doctype="Item",
|
||||
item_code="Item for description test",
|
||||
item_group="Products",
|
||||
description='<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>',
|
||||
).insert()
|
||||
|
||||
self.assertEqual(
|
||||
|
||||
@@ -26,17 +26,15 @@ def send_message(sender, message, subject="Website Query"):
|
||||
lead = frappe.db.get_value("Lead", dict(email_id=sender))
|
||||
if not lead:
|
||||
new_lead = frappe.get_doc(
|
||||
dict(doctype="Lead", email_id=sender, lead_name=sender.split("@")[0].title())
|
||||
doctype="Lead", email_id=sender, lead_name=sender.split("@")[0].title()
|
||||
).insert(ignore_permissions=True)
|
||||
|
||||
opportunity = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Opportunity",
|
||||
opportunity_from="Customer" if customer else "Lead",
|
||||
status="Open",
|
||||
title=subject,
|
||||
contact_email=sender,
|
||||
)
|
||||
doctype="Opportunity",
|
||||
opportunity_from="Customer" if customer else "Lead",
|
||||
status="Open",
|
||||
title=subject,
|
||||
contact_email=sender,
|
||||
)
|
||||
|
||||
if customer:
|
||||
|
||||
Reference in New Issue
Block a user