Compare commits

...

77 Commits

Author SHA1 Message Date
rohitwaghchaure
a3cb5df2e5 Merge pull request #51440 from rohitwaghchaure/rc-2
chore: v16 beta RC 2
2026-01-01 19:01:53 +05:30
Mihir Kandoi
2cf72e3b85 Revert "fix: autofixes by semgrep" 2026-01-01 18:46:52 +05:30
Rohit Waghchaure
765510d878 Merge branch 'develop' into version-16-beta 2026-01-01 18:07:49 +05:30
Rohit Waghchaure
2696f69ad4 Merge branch 'develop' into version-16-beta 2025-12-23 21:40:14 +05:30
Smit Vora
904840c5b3 Merge pull request #51278 from frappe/mergify/bp/version-16-beta/pr-51248
fix: don't consider phantom item in additional costs in stock entry (backport #51248)
2025-12-23 16:19:10 +05:30
Smit Vora
f6d3bbdf06 test: ensure enough stock
(cherry picked from commit a441b1c53a)
2025-12-23 09:34:34 +00:00
Smit Vora
4d8227a042 fix: conditional check for phantom item if field exists
(cherry picked from commit a5e5365ba9)
2025-12-23 09:34:33 +00:00
Smit Vora
ffd33c904c fix: don't consider phantom item in additional costs in stock entry
(cherry picked from commit 6e8a6582a0)
2025-12-23 09:34:33 +00:00
Diptanil Saha
4ccd823dcc Merge pull request #51253 from frappe/mergify/bp/version-16-beta/pr-50775
fix: item price not considering based on valid_upto (backport #50558)
2025-12-22 13:53:21 +05:30
Diptanil Saha
cd7e9e48de chore: resolve conflict
(cherry picked from commit 31142b2f47)
2025-12-22 07:38:16 +00:00
Sherin KR
797b6937f2 fix: item price not considering based on valid_upto
(cherry picked from commit dfda8e6241)

# Conflicts:
#	erpnext/selling/page/point_of_sale/point_of_sale.py
(cherry picked from commit c5d92d7999)
2025-12-22 07:38:16 +00:00
ruthra kumar
0507dae04a Merge pull request #51107 from frappe/mergify/bp/version-16-beta/pr-50837
feat(accounting-period): add role-based bypass for accounting period restrictions (backport #50837)
2025-12-15 20:52:11 +05:30
Jatin3128
fb96bbb8f8 feat(accounting-period): add role-based bypass for accounting period restrictions
(cherry picked from commit cfdbeb6a1a)
2025-12-15 12:07:08 +00:00
Smit Vora
a18ef85283 Merge pull request #51104 from frappe/mergify/bp/version-16-beta/pr-50782
fix: only show net balance as opening in general ledger (backport #50782)
2025-12-15 15:50:33 +05:30
Smit Vora
4d8ba5cca4 fix: only show net gl balance as opening in general ledger
(cherry picked from commit b7c7e0746e)
2025-12-15 10:00:47 +00:00
Sagar Vora
e930702faa Merge pull request #51060 from frappe/mergify/bp/version-16-beta/pr-51057
fix: re-calculate outstanding / write-off amount during submission (backport #51057)
2025-12-11 23:26:22 +05:30
Sagar Vora
16fe099317 fix: re-calculate outstanding / write-off amount during submission
(cherry picked from commit 09c9ac1b66)
2025-12-11 17:35:30 +00:00
Sagar Vora
626eb0d28e Merge pull request #51054 from frappe/mergify/bp/version-16-beta/pr-51051
fix: ensure fresh `grand_total_diff` is used for each calculation (backport #51051)
2025-12-11 18:07:57 +05:30
Sagar Vora
857574be69 fix: ensure fresh grand_total_diff is used for each calculation
(cherry picked from commit b3fdef8d19)
2025-12-11 12:35:29 +00:00
Khushi Rawat
f9ff06d926 Merge pull request #51008 from frappe/mergify/bp/version-16-beta/pr-50804
fix: correct logic for repair cost in asset repair (backport #50804)
2025-12-10 14:03:34 +05:30
ljain112
af9f4c7dd1 chore: remove unused import for depreciation schedule
(cherry picked from commit e1fd90f731)
2025-12-10 07:28:53 +00:00
ljain112
b81e1f8fe9 chore: remove unwanted strings
(cherry picked from commit 8ee2cbf259)
2025-12-10 07:28:53 +00:00
ljain112
5279bec1b2 refactor: linters
(cherry picked from commit 2a0ba84f69)
2025-12-10 07:28:52 +00:00
ljain112
0257fc42bb fix: add permission check
(cherry picked from commit 0c1df30771)
2025-12-10 07:28:52 +00:00
ljain112
fef76907c3 fix: add duplicate purchase invoice validation in asset repair
(cherry picked from commit ff9b392024)
2025-12-10 07:28:52 +00:00
ljain112
f12319b123 perf: enhance validation for purchase invoices to check submission status for all invoices
(cherry picked from commit 0b84d11600)
2025-12-10 07:28:52 +00:00
ljain112
945568183c perf: replace get_doc with get_lazy_doc for asset retrieval and optimize stock entry fetching
(cherry picked from commit c2810ea799)
2025-12-10 07:28:51 +00:00
ljain112
8fa785a45b fix: update repair cost logic to set value only for positive amounts
(cherry picked from commit 00ffdee928)
2025-12-10 07:28:51 +00:00
ljain112
e50ba37108 fix: remove unnecessary filtering by search text in get_expense_accounts
(cherry picked from commit b9aaae6343)
2025-12-10 07:28:51 +00:00
ljain112
c06e121cda fix: correct logic for repair cost in asset repair
(cherry picked from commit e6160d1b63)
2025-12-10 07:28:51 +00:00
Khushi Rawat
b4da06459d Merge pull request #51006 from frappe/mergify/bp/version-16-beta/pr-50999
fix: better manual budget distribution (backport #50999)
2025-12-10 12:20:29 +05:30
Khushi Rawat
b84531d4ea fix: conflicts 2025-12-10 11:59:14 +05:30
khushi8112
07c83246d0 fix: patch to set budget distribution total
(cherry picked from commit ed4c17d3a2)

# Conflicts:
#	erpnext/patches.txt
2025-12-10 06:27:36 +00:00
khushi8112
e1d46d4dad feat: show budget distribution total
(cherry picked from commit f194ac093c)
2025-12-10 06:27:35 +00:00
khushi8112
341ea89d16 fix: better manual budget distribution on update
(cherry picked from commit 1c82f42fa8)
2025-12-10 06:27:35 +00:00
khushi8112
88af49f6c0 fix: remove revise budget permission
(cherry picked from commit d42aad18a7)
2025-12-10 06:27:35 +00:00
khushi8112
7ea82ce2f0 fix: add company-based filter to account field
(cherry picked from commit 6a03fc6ede)
2025-12-10 06:27:35 +00:00
khushi8112
77f70b4c26 fix: make amount and percent field read only when distribute equally is enabled
(cherry picked from commit 75999a7ae4)
2025-12-10 06:27:34 +00:00
Smit Vora
a0c768d55d Merge pull request #50866 from frappe/mergify/bp/version-16-beta/pr-50733 2025-12-02 15:15:36 +05:30
Smit Vora
79181e307c fix: use ValueWrapper consistently
(cherry picked from commit a2fadd9347)
2025-12-02 09:13:52 +00:00
Smit Vora
9f07579a05 refactor: further changes to adapt to query builder changes
(cherry picked from commit 8235a551f0)
2025-12-02 09:13:52 +00:00
Khushi Rawat
7bfdd4b0a8 Merge pull request #50861 from frappe/mergify/bp/version-16-beta/pr-50794
fix: use asset in against_voucher while posting gl entries for capitalised asset repairs (backport #50794)
2025-12-02 12:46:09 +05:30
Khushi Rawat
a2242439c8 Merge pull request #50859 from frappe/mergify/bp/version-16-beta/pr-50793
fix: include accounting dimensions in stock entries created during asset repair. (backport #50793)
2025-12-02 12:23:37 +05:30
Navin-S-R
8440a5c68d chore: reload asset doc before assertEqual
(cherry picked from commit 8c35a6ecdd)
2025-12-02 06:37:52 +00:00
Navin-S-R
665a092cd0 test: add unit test to validate capitalized asset repair gl entries being booked against the asset
(cherry picked from commit bcf6deec9a)
2025-12-02 06:37:52 +00:00
Navin S R
a6b7985eb2 fix: use asset in against_voucher while posting gl entries for capitalized asset repairs
(cherry picked from commit a7e43eddad)
2025-12-02 06:37:52 +00:00
ljain112
30f368c4c0 refactor: show_general ledger for consistency with other doctyoes
(cherry picked from commit cdbe8b909b)
2025-12-02 06:27:36 +00:00
ljain112
be37d44d4c fix: include accounting dimensions in stock entries created during asset repair.
(cherry picked from commit 147a5ee953)
2025-12-02 06:27:36 +00:00
ruthra kumar
7ecf86af18 Merge pull request #50806 from frappe/mergify/bp/version-16-beta/pr-50802
fix(accounts-payable-summary): add Show GL Balance check similar to A… (backport #50802)
2025-11-29 12:06:33 +05:30
Jatin3128
895694f870 fix(accounts-payable-summary): add Show GL Balance check similar to Accounts Receivable Summary
(cherry picked from commit 8a7e5d0626)
2025-11-29 06:04:29 +00:00
Khushi Rawat
370ddb181b Merge pull request #50801 from frappe/mergify/bp/version-16-beta/pr-50792
fix: add Stock Entry link to Asset Repair doctype. (backport #50792)
2025-11-29 00:27:53 +05:30
ljain112
db446f33ad fix: add Stock Entry link to Asset Repair doctype.
(cherry picked from commit da7f28a3c3)
2025-11-28 12:05:40 +00:00
mergify[bot]
b7d831cc47 fix: incorrect positional param for get_field_precision util (backport #50764) (#50796) 2025-11-28 14:18:33 +05:30
Smit Vora
b8e5f3f996 fix: restore missing account number for Indirect Expenses in standard COA with Numbers (backport #50767) (#50784)
Co-authored-by: Aadhil <36843795+aadhilpm@users.noreply.github.com>
fix: restore missing account number for Indirect Expenses in standard COA with Numbers (#50767)
2025-11-27 19:41:58 +05:30
Aadhil
b8ab6403ab fix: restore missing account number for Indirect Expenses in standard COA with Numbers (#50767)
(cherry picked from commit 9145bf5563)
2025-11-27 13:54:25 +00:00
Smit Vora
0ade33e46a feat: add Account Category field to Account (Chart of Accounts) (backport #50766) (#50783)
Co-authored-by: Aadhil <36843795+aadhilpm@users.noreply.github.com>
2025-11-27 19:19:09 +05:30
Aadhil
6b877af91d feat: add Account Category field to Account (Chart of Accounts) (#50766)
(cherry picked from commit 355aa52cb8)
2025-11-27 13:11:14 +00:00
Rohit Waghchaure
4bf4df0f1d Merge branch 'develop' into version-16-beta 2025-11-21 22:08:39 +05:30
Lakshit Jain
1b32889eed Merge pull request #50682 from frappe/mergify/bp/version-16-beta/pr-50609
fix: handle empty item_tax_rate in ItemTax class (backport #50609)
2025-11-21 18:46:38 +05:30
Karm Soni
538b54a2dc fix: handle empty item_tax_rate in ItemTax class
(cherry picked from commit fc098a732b)
2025-11-21 12:57:48 +00:00
Lakshit Jain
11eda0e051 Merge pull request #50676 from frappe/mergify/bp/version-16-beta/pr-50675
fix: ignore chunk if no valid invoices found (backport #50675)
2025-11-21 18:27:34 +05:30
Smit Vora
cca315d072 Merge pull request #50679 from frappe/mergify/bp/version-16-beta/pr-50658
fix: handle zero rate actual taxes in calculate_taxes_and_totals (backport #50658)
2025-11-21 17:10:21 +05:30
ljain112
843a38acfd fix: handle zero rate actual taxes in calculate_taxes_and_totals
(cherry picked from commit ef37e6aa16)
2025-11-21 11:14:41 +00:00
Sagar Vora
434d05f9cf fix: ignore chunk if no valid invoices found
(cherry picked from commit f644c19760)
2025-11-21 08:53:52 +00:00
ruthra kumar
71611f81c9 Merge pull request #50630 from frappe/mergify/bp/version-16-beta/pr-50623
fix: replace `this` with function path (backport #50623)
2025-11-19 16:21:09 +05:30
Smit Vora
635047c290 fix: replace this with function path
(cherry picked from commit 2a1eb08b08)
2025-11-19 10:49:36 +00:00
Mihir Kandoi
82ba11e432 Merge pull request #50616 from frappe/mergify/bp/version-16-beta/pr-50614
fix: redundant message on bom save (backport #50614)
2025-11-19 12:55:56 +05:30
Mihir Kandoi
9374958473 fix: redundant message on bom save
(cherry picked from commit 074f07694f)
2025-11-19 07:08:17 +00:00
ruthra kumar
fe73f43d8b Merge pull request #50604 from frappe/mergify/bp/version-16-beta/pr-50524
fix: use dynamic account type to get average ratio balance (backport #50524)
2025-11-18 17:44:25 +05:30
ruthra kumar
dd93af80e0 Merge pull request #50602 from frappe/mergify/bp/version-16-beta/pr-50516
fix(general_ledger): add translation for accounting dimension (backport #50516)
2025-11-18 17:13:19 +05:30
Navin-S-R
a2fe72013f fix: correct profit after tax calculation by reducing expenses from income
(cherry picked from commit f420371a7e)
2025-11-18 11:22:47 +00:00
Navin-S-R
2b1f31bacb fix: use dynamic account type to get average ratio balance
(cherry picked from commit 9118f08e7b)
2025-11-18 11:22:47 +00:00
Logesh Periyasamy
e87e9b4769 fix(general_ledger): add translation for accounting dimension
(cherry picked from commit 113ff17c71)
2025-11-18 11:16:36 +00:00
ruthra kumar
3830dc9099 Merge pull request #50586 from frappe/mergify/bp/version-16-beta/pr-50529
fix: unintended backported depends_on expression (backport #50529)
2025-11-18 15:05:49 +05:30
rohitwaghchaure
42c1f95981 Merge pull request #50590 from frappe/mergify/bp/version-16-beta/pr-50585
fix: icons for workspace sidebar in ERPNext modules (backport #50585)
2025-11-18 14:35:56 +05:30
Rohit Waghchaure
052ce11d0f fix: icons for workspace sidebar in ERPNext modules
(cherry picked from commit 842546d917)
2025-11-18 08:42:07 +00:00
Kavin
9cafee3b59 fix: unintended backported depends_on expression (#50529)
Co-authored-by: Kavin <78342682+kavin0411@users.noreply.github.com>
(cherry picked from commit 81a16286a1)
2025-11-18 08:08:01 +00:00
41 changed files with 373 additions and 294 deletions

View File

@@ -450,12 +450,14 @@ def process_deferred_accounting(posting_date=None):
for company in companies:
for record_type in ("Income", "Expense"):
doc = frappe.get_doc(
doctype="Process Deferred Accounting",
company=company.name,
posting_date=posting_date,
start_date=start_date,
end_date=end_date,
type=record_type,
dict(
doctype="Process Deferred Accounting",
company=company.name,
posting_date=posting_date,
start_date=start_date,
end_date=end_date,
type=record_type,
)
)
doc.insert()

View File

@@ -415,13 +415,15 @@ def create_account(**kwargs):
return account.name
else:
account = frappe.get_doc(
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"),
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"),
)
)
account.save()

View File

@@ -182,7 +182,7 @@ frappe.ui.form.on("Payment Entry", {
"Dunning",
];
if (party_type_doctypes.includes(child.reference_doctype)) {
if (in_list(party_type_doctypes, 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 (!frm.events.get_order_doctypes(frm).includes(d.voucher_type)) {
if (!in_list(frm.events.get_order_doctypes(frm), 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 (frm.events.get_invoice_doctypes(frm).includes(d.reference_doctype)) {
if (in_list(frm.events.get_invoice_doctypes(frm), d.reference_doctype)) {
c.due_date = d.due_date;
}
});

View File

@@ -50,10 +50,12 @@ class TestPaymentOrder(IntegrationTestCase):
def create_payment_order_against_payment_entry(ref_doc, order_type, bank_account):
payment_order = frappe.get_doc(
doctype="Payment Order",
company="_Test Company",
payment_order_type=order_type,
company_bank_account=bank_account,
dict(
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()

View File

@@ -171,7 +171,7 @@ frappe.ui.form.on("Pricing Rule", {
set_field_options("applicable_for", options.join("\n"));
if (!options.includes(applicable_for)) applicable_for = null;
if (!in_list(options, applicable_for)) applicable_for = null;
frm.set_value("applicable_for", applicable_for);
},
});

View File

@@ -48,11 +48,13 @@ class TestProcessDeferredAccounting(IntegrationTestCase):
check_gl_entries(self, si.name, original_gle, "2023-07-01")
process_deferred_accounting = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date="2023-07-01",
start_date="2023-05-01",
end_date="2023-06-30",
type="Income",
dict(
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()
@@ -78,11 +80,13 @@ class TestProcessDeferredAccounting(IntegrationTestCase):
def test_pda_submission_and_cancellation(self):
pda = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date="2019-01-01",
start_date="2019-01-01",
end_date="2019-01-31",
type="Income",
dict(
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()

View File

@@ -46,7 +46,7 @@ frappe.ui.form.on("Promotional Scheme", {
set_field_options("applicable_for", options.join("\n"));
if (!options.includes(applicable_for)) applicable_for = null;
if (!in_list(options, applicable_for)) applicable_for = null;
frm.set_value("applicable_for", applicable_for);
},

View File

@@ -1249,12 +1249,14 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
pi.submit()
pda1 = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2019-01-01",
end_date="2019-03-31",
type="Expense",
company="_Test Company",
dict(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2019-01-01",
end_date="2019-03-31",
type="Expense",
company="_Test Company",
)
)
pda1.insert()

View File

@@ -2510,12 +2510,14 @@ class TestSalesInvoice(ERPNextTestSuite):
si.submit()
pda1 = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2019-01-01",
end_date="2019-03-31",
type="Income",
company="_Test Company",
dict(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2019-01-01",
end_date="2019-03-31",
type="Income",
company="_Test Company",
)
)
pda1.insert()
@@ -2566,12 +2568,14 @@ class TestSalesInvoice(ERPNextTestSuite):
si.submit()
pda1 = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date="2019-03-31",
start_date="2019-01-01",
end_date="2019-03-31",
type="Income",
company="_Test Company",
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",
)
)
pda1.insert()
@@ -3474,12 +3478,14 @@ class TestSalesInvoice(ERPNextTestSuite):
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", getdate("2019-01-31"))
pda1 = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2019-01-01",
end_date="2019-03-31",
type="Income",
company="_Test Company",
dict(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2019-01-01",
end_date="2019-03-31",
type="Income",
company="_Test Company",
)
)
pda1.insert()

View File

@@ -101,12 +101,14 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
si.submit()
pda = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2021-05-01",
end_date="2021-08-01",
type="Income",
company=self.company,
dict(
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()
@@ -171,12 +173,14 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
pi.submit()
pda = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2021-05-01",
end_date="2021-08-01",
type="Expense",
company=self.company,
dict(
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()
@@ -236,12 +240,14 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
si.submit()
pda = frappe.get_doc(
doctype="Process Deferred Accounting",
posting_date=nowdate(),
start_date="2021-05-01",
end_date="2021-08-01",
type="Income",
company=self.company,
dict(
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()

View File

@@ -131,14 +131,16 @@ class TestSupplier(IntegrationTestCase):
self.assertEqual(details.tax_category, "_Test Tax Category 1")
address = frappe.get_doc(
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")],
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")],
)
).insert()
# Tax Category with Address

View File

@@ -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 (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) {
if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) {
value = "<span style='color:green'>" + value + "</span>";
}
return value;

View File

@@ -30,4 +30,4 @@ def execute():
def insert_sales_partner_type(s):
if not frappe.db.exists("Sales Partner Type", s):
frappe.get_doc(doctype="Sales Partner Type", sales_partner_type=s).insert()
frappe.get_doc(dict(doctype="Sales Partner Type", sales_partner_type=s)).insert()

View File

@@ -30,13 +30,15 @@ def execute():
if task.subject:
replace_tasks = True
new_task = frappe.get_doc(
doctype="Task",
subject=task.subject,
start=task.start,
duration=task.duration,
task_weight=task.task_weight,
description=task.description,
is_template=1,
dict(
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)

View File

@@ -127,20 +127,22 @@ class Project(Document):
def create_task_from_template(self, task_details):
return frappe.get_doc(
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,
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,
)
).insert()
def calculate_start_date(self, task_details):

View File

@@ -255,12 +255,14 @@ class TestProject(ERPNextTestSuite):
def get_project(name, template):
project = frappe.get_doc(
doctype="Project",
project_name=name,
status="Open",
project_template=template.name,
expected_start_date=nowdate(),
company="_Test Company",
dict(
doctype="Project",
project_name=name,
status="Open",
project_template=template.name,
expected_start_date=nowdate(),
company="_Test Company",
)
).insert()
return project
@@ -273,11 +275,13 @@ def make_project(args):
return frappe.get_doc("Project", {"project_name": args.project_name})
project = frappe.get_doc(
doctype="Project",
project_name=args.project_name,
status="Open",
expected_start_date=args.start_date,
company=args.company or "_Test Company",
dict(
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:

View File

@@ -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(doctype="Project Template", name=project_template_name)
doc = frappe.get_doc(dict(doctype="Project Template", name=project_template_name))
for task in project_tasks:
doc.append("tasks", {"task": task.name})
doc.insert()

View File

@@ -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 (payment_types.includes("Cash")) {
if (in_list(payment_types, "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;

View File

@@ -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: "Purchase Receipt".includes("Purchase Invoice") ? item.from_warehouse : item.warehouse,
warehouse: in_list("Purchase Receipt", "Purchase Invoice") ? item.from_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 (!JSON.parse(child.apply_rule_on_other_items).includes(child.item_code)) {
if (!in_list(JSON.parse(child.apply_rule_on_other_items), 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 (
fields.includes(k) &&
in_list(fields, k) &&
data[k] &&
(data.price_or_product_discount === "Price" || k === "pricing_rules")
) {
@@ -2768,7 +2768,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
has_discount_in_schedule() {
let is_eligible = ["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"].includes(
let is_eligible = in_list(
["Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"],
this.frm.doctype
);
let has_payment_schedule = this.frm.doc.payment_schedule && this.frm.doc.payment_schedule.length;
@@ -3204,13 +3205,16 @@ erpnext.show_serial_batch_selector = function (frm, item_row, callback, on_close
}
if (
[
"Material Transfer",
"Send to Subcontractor",
"Material Issue",
"Material Consumption for Manufacture",
"Material Transfer for Manufacture",
].includes(frm.doc.purpose)
in_list(
[
"Material Transfer",
"Send to Subcontractor",
"Material Issue",
"Material Consumption for Manufacture",
"Material Transfer for Manufacture",
],
frm.doc.purpose
)
) {
warehouse_field = "s_warehouse";
} else {

View File

@@ -338,7 +338,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner {
? this.dialog.get_value("serial_no").split("\n")
: [];
if (serial_nos.includes(serial_no)) {
if (in_list(serial_nos, 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 (ignore_fields.includes(key)) {
if (in_list(ignore_fields, key)) {
continue;
}

View File

@@ -36,14 +36,14 @@ erpnext.utils.get_party_details = function (frm, method, args, callback) {
}
if (!args) {
if (SALES_DOCTYPES.includes(frm.doc.doctype)) {
if (in_list(SALES_DOCTYPES, frm.doc.doctype)) {
args = {
party: frm.doc.customer || frm.doc.party_name,
party_type: "Customer",
};
}
if (PURCHASE_DOCTYPES.includes(frm.doc.doctype)) {
if (in_list(PURCHASE_DOCTYPES, 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 (SALES_DOCTYPES.includes(frm.doc.doctype)) {
if (in_list(SALES_DOCTYPES, frm.doc.doctype)) {
if (!args.company_address && frm.doc.company_address) {
args.company_address = frm.doc.company_address;
}
}
if (PURCHASE_DOCTYPES.includes(frm.doc.doctype)) {
if (in_list(PURCHASE_DOCTYPES, frm.doc.doctype)) {
if (!args.company_address && frm.doc.billing_address) {
args.company_address = frm.doc.billing_address;
}

View File

@@ -9,16 +9,20 @@ from frappe.tests import IntegrationTestCase
class TestQualityFeedback(IntegrationTestCase):
def test_quality_feedback(self):
template = frappe.get_doc(
doctype="Quality Feedback Template",
template="Test Template",
parameters=[dict(parameter="Test Parameter 1"), dict(parameter="Test Parameter 2")],
dict(
doctype="Quality Feedback Template",
template="Test Template",
parameters=[dict(parameter="Test Parameter 1"), dict(parameter="Test Parameter 2")],
)
).insert()
feedback = frappe.get_doc(
doctype="Quality Feedback",
template=template.name,
document_type="User",
document_name=frappe.session.user,
dict(
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)

View File

@@ -16,8 +16,10 @@ class TestQualityGoal(IntegrationTestCase):
def get_quality_goal():
return frappe.get_doc(
doctype="Quality Goal",
goal="Test Quality Module",
frequency="Daily",
objectives=[dict(objective="Check test cases", target="100", uom="Percent")],
dict(
doctype="Quality Goal",
goal="Test Quality Module",
frequency="Daily",
objectives=[dict(objective="Check test cases", target="100", uom="Percent")],
)
).insert()

View File

@@ -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(
doctype="Address Template", country=country, is_default=is_default, template=html
dict(doctype="Address Template", country=country, is_default=is_default, template=html)
).insert()

View File

@@ -470,9 +470,11 @@ def setup_report():
if not frappe.db.get_value("Custom Role", dict(report=report_name)):
frappe.get_doc(
doctype="Custom Role",
report=report_name,
roles=[dict(role="Accounts User"), dict(role="Accounts Manager")],
dict(
doctype="Custom Role",
report=report_name,
roles=[dict(role="Accounts User"), dict(role="Accounts Manager")],
)
).insert()

View File

@@ -50,7 +50,9 @@ def add_permissions():
if not frappe.db.get_value("Custom Role", dict(report="VAT Audit Report")):
frappe.get_doc(
doctype="Custom Role",
report="VAT Audit Report",
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
dict(
doctype="Custom Role",
report="VAT Audit Report",
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
)
).insert()

View File

@@ -261,9 +261,11 @@ 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(
doctype="Custom Role",
report="UAE VAT 201",
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
dict(
doctype="Custom Role",
report="UAE VAT 201",
roles=[dict(role="Accounts User"), dict(role="Accounts Manager"), dict(role="Auditor")],
)
).insert()

View File

@@ -104,24 +104,28 @@ class TestCustomer(IntegrationTestCase):
self.assertEqual(details.tax_category, "_Test Tax Category 1")
billing_address = frappe.get_doc(
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")],
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")],
)
).insert()
shipping_address = frappe.get_doc(
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")],
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")],
)
).insert()
settings = frappe.get_single("Accounts Settings")

View File

@@ -1743,16 +1743,18 @@ 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(
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"],
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"],
)
).insert()
work_order.set_work_order_operations()
work_order.flags.ignore_mandatory = True

View File

@@ -2713,8 +2713,8 @@ def make_sales_order_workflow():
doc.save()
return doc
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.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.cache().hdel("roles", frappe.session.user)
workflow = frappe.get_doc(

View File

@@ -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 (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) {
if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) {
value = "<span style='color:green;'>" + value + "</span>";
}
return value;

View File

@@ -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 (format_fields.includes(column.fieldname) && data && data[column.fieldname] > 0) {
if (in_list(format_fields, column.fieldname) && data && data[column.fieldname] > 0) {
value = "<span style='color:green;'>" + value + "</span>";
}

View File

@@ -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 (r.message.includes(selected_value))
if (in_list(r.message, selected_value))
cur_frm.set_value("chart_of_accounts", selected_value);
}
},

View File

@@ -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(doctype="Batch", item=item_code, batch_id=new_batch_id).insert()
batch = frappe.get_doc(dict(doctype="Batch", item=item_code, batch_id=new_batch_id)).insert()
qty = flt(qty)
company = frappe.db.get_value("Warehouse", warehouse, "company")
@@ -330,18 +330,22 @@ def split_batch(batch_no: str, item_code: str, warehouse: str, qty: float, new_b
)
stock_entry = frappe.get_doc(
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),
],
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
),
],
)
)
stock_entry.set_stock_entry_type()
stock_entry.insert()

View File

@@ -45,10 +45,12 @@ class TestBatch(IntegrationTestCase):
self.make_batch_item("ITEM-BATCH-1")
receipt = frappe.get_doc(
doctype="Purchase Receipt",
supplier="_Test Supplier",
company="_Test Company",
items=[dict(item_code="ITEM-BATCH-1", qty=batch_qty, rate=10, warehouse="Stores - _TC")],
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")],
)
).insert()
receipt.submit()
@@ -64,10 +66,12 @@ class TestBatch(IntegrationTestCase):
self.make_batch_item("ITEM-BATCH-1")
receipt = frappe.get_doc(
doctype="Purchase Receipt",
supplier="_Test Supplier",
company="_Test Company",
items=[dict(item_code="ITEM-BATCH-1", qty=10, rate=10, warehouse="Stores - _TC")],
dict(
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()
@@ -92,18 +96,20 @@ class TestBatch(IntegrationTestCase):
)
receipt2 = frappe.get_doc(
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,
)
],
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,
)
],
)
).insert()
receipt2.submit()
@@ -129,18 +135,20 @@ class TestBatch(IntegrationTestCase):
self.make_batch_item("ITEM-BATCH-1")
stock_entry = frappe.get_doc(
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,
)
],
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,
)
],
)
)
stock_entry.set_stock_entry_type()
@@ -179,18 +187,20 @@ class TestBatch(IntegrationTestCase):
)
delivery_note = frappe.get_doc(
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,
)
],
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,
)
],
)
).insert()
delivery_note.submit()
@@ -251,17 +261,19 @@ class TestBatch(IntegrationTestCase):
)
stock_entry = frappe.get_doc(
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,
)
],
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,
)
],
)
)
stock_entry.set_stock_entry_type()
@@ -361,7 +373,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(doctype="Batch", item=item_name, batch_id=batch_name).insert(
batch = frappe.get_doc(dict(doctype="Batch", item=item_name, batch_id=batch_name)).insert(
ignore_permissions=True
)
batch.save()
@@ -381,20 +393,22 @@ class TestBatch(IntegrationTestCase):
).make_serial_and_batch_bundle()
stock_entry = frappe.get_doc(
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,
)
],
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,
)
],
)
)
stock_entry.set_stock_entry_type()

View File

@@ -56,7 +56,7 @@ frappe.ui.form.on("Inventory Dimension", {
];
frm.fields.forEach((field) => {
if (!allow_to_edit_fields.includes(field.df.fieldname)) {
if (!in_list(allow_to_edit_fields, field.df.fieldname)) {
frm.set_df_property(field.df.fieldname, "read_only", "1");
}
});

View File

@@ -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 (SALES_DOCTYPES.includes(doctype) && frm.doc.sales_uom) {
if (in_list(SALES_DOCTYPES, doctype) && frm.doc.sales_uom) {
new_child_doc.uom = frm.doc.sales_uom;
} else if (PURCHASE_DOCTYPES.includes(doctype) && frm.doc.purchase_uom) {
} else if (in_list(PURCHASE_DOCTYPES, doctype) && frm.doc.purchase_uom) {
new_child_doc.uom = frm.doc.purchase_uom;
} else {
new_child_doc.uom = frm.doc.stock_uom;

View File

@@ -30,9 +30,9 @@ frappe.ui.form.on("Item Variant Settings", {
field_label_map[d.fieldname] = __(d.label, null, d.parent) + ` (${d.fieldname})`;
if (
!exclude_field_types.includes(d.fieldtype) &&
!in_list(exclude_field_types, d.fieldtype) &&
!d.no_copy &&
!exclude_fields.includes(d.fieldname)
!in_list(exclude_fields, d.fieldname)
) {
allow_fields.push({
label: field_label_map[d.fieldname],

View File

@@ -1290,11 +1290,10 @@ 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 &&
[
"Manufacture",
"Material Transfer for Manufacture",
"Material Consumption for Manufacture",
].includes(this.frm.doc.purpose)
in_list(
["Manufacture", "Material Transfer for Manufacture", "Material Consumption for Manufacture"],
this.frm.doc.purpose
)
) {
frappe.model.remove_from_locals("Work Order", this.frm.doc.work_order);
}

View File

@@ -13,10 +13,12 @@ class TestStockSettings(IntegrationTestCase):
def test_settings(self):
item = frappe.get_doc(
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>',
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>',
)
).insert()
settings = frappe.get_single("Stock Settings")
@@ -38,10 +40,12 @@ class TestStockSettings(IntegrationTestCase):
settings.save()
item = frappe.get_doc(
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>',
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>',
)
).insert()
self.assertEqual(

View File

@@ -26,15 +26,17 @@ 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(
doctype="Lead", email_id=sender, lead_name=sender.split("@")[0].title()
dict(doctype="Lead", email_id=sender, lead_name=sender.split("@")[0].title())
).insert(ignore_permissions=True)
opportunity = frappe.get_doc(
doctype="Opportunity",
opportunity_from="Customer" if customer else "Lead",
status="Open",
title=subject,
contact_email=sender,
dict(
doctype="Opportunity",
opportunity_from="Customer" if customer else "Lead",
status="Open",
title=subject,
contact_email=sender,
)
)
if customer: