Merge branch 'develop' into consolidated_report_acc_name_fix

This commit is contained in:
Ankush Menat 2021-03-10 16:35:59 +05:30 committed by GitHub
commit 59fdee4dfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 378 additions and 236 deletions

View File

@ -63,17 +63,21 @@
"Gewinnermittlung \u00a74/3 nicht Ergebniswirksam": {
"account_number": "1371"
},
"Abziehbare VSt. 7%": {
"account_number": "1571"
},
"Abziehbare VSt. 19%": {
"account_number": "1576"
},
"Abziehbare VStr. nach \u00a713b UStG 19%": {
"account_number": "1577"
},
"Leistungen \u00a713b UStG 19% Vorsteuer, 19% Umsatzsteuer": {
"account_number": "3120"
"Abziehbare Vorsteuer": {
"account_type": "Tax",
"is_group": 1,
"Abziehbare Vorsteuer 7%": {
"account_number": "1571"
},
"Abziehbare Vorsteuer 19%": {
"account_number": "1576"
},
"Abziehbare Vorsteuer nach \u00a713b UStG 19%": {
"account_number": "1577"
},
"Leistungen \u00a713b UStG 19% Vorsteuer, 19% Umsatzsteuer": {
"account_number": "3120"
}
}
},
"III. Wertpapiere": {
@ -196,6 +200,7 @@
},
"Umsatzsteuer": {
"is_group": 1,
"account_type": "Tax",
"Umsatzsteuer 7%": {
"account_number": "1771"
},

View File

@ -292,18 +292,21 @@
"Umsatzsteuerforderungen fr\u00fchere Jahre": {}
},
"Sonstige Verm\u00f6gensgegenst\u00e4nde oder sonstige Verbindlichkeiten": {
"Abziehbare Vorsteuer": {},
"Abziehbare Vorsteuer 16%": {},
"Abziehbare Vorsteuer 19%": {},
"Abziehbare Vorsteuer 7%": {},
"Abziehbare Vorsteuer aus der Auslagerung von Gegenst\u00e4nden aus einem Unsatzsteuerlager": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 16%": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19%": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb von Neufahrzeugen von Lieferanten ohne Ust-Identifikationsnummer": {},
"Abziehbare Vorsteuer nach \u00a7 13b UStG ": {},
"Abziehbare Vorsteuer nach \u00a7 13b UStG 16%": {},
"Abziehbare Vorsteuer nach \u00a7 13b UStG 19%": {},
"Abziehbare Vorsteuer": {
"account_type": "Tax",
"is_group": 1,
"Abziehbare Vorsteuer 16%": {},
"Abziehbare Vorsteuer 19%": {},
"Abziehbare Vorsteuer 7%": {},
"Abziehbare Vorsteuer aus der Auslagerung von Gegenst\u00e4nden aus einem Unsatzsteuerlager": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 16%": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19%": {},
"Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb von Neufahrzeugen von Lieferanten ohne Ust-Identifikationsnummer": {},
"Abziehbare Vorsteuer nach \u00a7 13b UStG ": {},
"Abziehbare Vorsteuer nach \u00a7 13b UStG 16%": {},
"Abziehbare Vorsteuer nach \u00a7 13b UStG 19%": {}
},
"Aufl\u00f6sung Vorsteuer aus Vorjahr \u00a7 4/3 EStG": {},
"Aufzuteilende Vorsteuer": {},
"Aufzuteilende Vorsteuer 16%": {},
@ -673,23 +676,26 @@
"Sonstige Verrechnungskonten (Interimskonto)": {
"account_type": "Stock Received But Not Billed"
},
"Umsatzsteuer": {},
"Umsatzsteuer 16%": {},
"Umsatzsteuer 19%": {},
"Umsatzsteuer 7%": {},
"Umsatzsteuer Vorjahr": {},
"Umsatzsteuer aus der Auslagerung von Gegenst\u00e4nden aus einem Umsatzsteuerlager": {},
"Umsatzsteuer aus im Inland steuerpflichtigen EG-Lieferungen": {},
"Umsatzsteuer aus im Inland steuerpflichtigen EG-Lieferungen 19%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 16%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 19%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ohne Vorsteuerabzug": {},
"Umsatzsteuer fr\u00fchere Jahre": {},
"Umsatzsteuer laufendes Jahr": {},
"Umsatzsteuer nach \u00a713b UStG": {},
"Umsatzsteuer nach \u00a713b UStG 16%": {},
"Umsatzsteuer nach \u00a713b UStG 19%": {},
"Umsatzsteuer": {
"account_type": "Tax",
"is_group": 1,
"Umsatzsteuer 16%": {},
"Umsatzsteuer 19%": {},
"Umsatzsteuer 7%": {},
"Umsatzsteuer Vorjahr": {},
"Umsatzsteuer aus der Auslagerung von Gegenst\u00e4nden aus einem Umsatzsteuerlager": {},
"Umsatzsteuer aus im Inland steuerpflichtigen EG-Lieferungen": {},
"Umsatzsteuer aus im Inland steuerpflichtigen EG-Lieferungen 19%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 16%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 19%": {},
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ohne Vorsteuerabzug": {},
"Umsatzsteuer fr\u00fchere Jahre": {},
"Umsatzsteuer laufendes Jahr": {},
"Umsatzsteuer nach \u00a713b UStG": {},
"Umsatzsteuer nach \u00a713b UStG 16%": {},
"Umsatzsteuer nach \u00a713b UStG 19%": {}
},
"Umsatzsteuer- Vorauszahlungen": {},
"Umsatzsteuer- Vorauszahlungen 1/11": {},
"Verbindlichkeiten aus Lohn- und Kirchensteuer": {}

View File

@ -659,6 +659,7 @@
},
"Abziehbare Vorsteuer (Gruppe)": {
"is_group": 1,
"account_type": "Tax",
"Abziehbare Vorsteuer": {
"account_number": "1400"
},

View File

@ -1,7 +1,7 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
"creation": "2018-11-22 22:45:00.370913",
"doctype": "DocType",
"document_type": "Setup",
@ -20,8 +20,7 @@
"in_list_view": 1,
"label": "Title",
"no_copy": 1,
"reqd": 1,
"unique": 1
"reqd": 1
},
{
"fieldname": "taxes",
@ -33,12 +32,14 @@
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"options": "Company",
"reqd": 1
}
],
"modified": "2020-09-18 17:26:09.703215",
"links": [],
"modified": "2021-03-08 19:50:21.416513",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Item Tax Template",
@ -81,5 +82,6 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "title",
"track_changes": 1
}

View File

@ -11,6 +11,11 @@ class ItemTaxTemplate(Document):
def validate(self):
self.validate_tax_accounts()
def autoname(self):
if self.company and self.title:
abbr = frappe.get_cached_value('Company', self.company, 'abbr')
self.name = '{0} - {1}'.format(self.title, abbr)
def validate_tax_accounts(self):
"""Check whether Tax Rate is not entered twice for same Tax Type"""
check_list = []

View File

@ -198,6 +198,7 @@ def start_import(invoices):
try:
publish(idx, len(invoices), d.doctype)
doc = frappe.get_doc(d)
doc.flags.ignore_mandatory = True
doc.insert()
doc.submit()
frappe.db.commit()

View File

@ -536,7 +536,8 @@
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"print_hide": 1
"print_hide": 1,
"read_only": 1
},
{
"depends_on": "party",
@ -588,7 +589,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2020-10-30 13:56:20.007336",
"modified": "2021-03-08 13:05:16.958866",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",
@ -632,4 +633,4 @@
"sort_order": "DESC",
"title_field": "title",
"track_changes": 1
}
}

View File

@ -455,6 +455,10 @@ class PaymentEntry(AccountsController):
.format(total_negative_outstanding), InvalidPaymentEntry)
def set_title(self):
if frappe.flags.in_import and self.title:
# do not set title dynamically if title exists during data import.
return
if self.payment_type in ("Receive", "Pay"):
self.title = self.party
else:
@ -996,7 +1000,7 @@ def get_amounts_based_on_ref_doc(reference_doctype, ref_doc, party_account_curre
total_amount = flt(ref_doc.total_sanctioned_amount) + flt(ref_doc.total_taxes_and_charges)
elif ref_doc.doctype == "Employee Advance":
total_amount, exchange_rate = get_total_amount_exchange_rate_for_employee_advance(party_account_currency, ref_doc)
if not total_amount:
total_amount, exchange_rate = get_total_amount_exchange_rate_base_on_currency(
party_account_currency, company_currency, ref_doc)
@ -1326,4 +1330,4 @@ def make_payment_order(source_name, target_doc=None):
}, target_doc, set_missing_values)
return doclist
return doclist

View File

@ -99,10 +99,10 @@ class TestPOSInvoice(unittest.TestCase):
item_row = inv.get("items")[0]
add_items = [
(54, '_Test Account Excise Duty @ 12'),
(288, '_Test Account Excise Duty @ 15'),
(144, '_Test Account Excise Duty @ 20'),
(430, '_Test Item Tax Template 1')
(54, '_Test Account Excise Duty @ 12 - _TC'),
(288, '_Test Account Excise Duty @ 15 - _TC'),
(144, '_Test Account Excise Duty @ 20 - _TC'),
(430, '_Test Item Tax Template 1 - _TC')
]
for qty, item_tax_template in add_items:
item_row_copy = copy.deepcopy(item_row)

View File

@ -58,6 +58,7 @@
"rejected_warehouse",
"col_break_warehouse",
"set_from_warehouse",
"supplier_warehouse",
"is_subcontracted",
"items_section",
"update_stock",
@ -1350,7 +1351,7 @@
"options": "Company"
},
{
"depends_on": "eval:doc.update_stock && (doc.is_subcontracted==\"Yes\" || doc.is_internal_supplier)",
"depends_on": "eval:doc.update_stock && doc.is_internal_supplier",
"description": "Sets 'From Warehouse' in each row of the items table.",
"fieldname": "set_from_warehouse",
"fieldtype": "Link",
@ -1360,13 +1361,24 @@
"print_hide": 1,
"print_width": "50px",
"width": "50px"
},
{
"depends_on": "eval:doc.update_stock && doc.is_subcontracted==\"Yes\"",
"fieldname": "supplier_warehouse",
"fieldtype": "Link",
"label": "Supplier Warehouse",
"no_copy": 1,
"options": "Warehouse",
"print_hide": 1,
"print_width": "50px",
"width": "50px"
}
],
"icon": "fa fa-file-text",
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2020-12-26 20:49:03.305063",
"modified": "2021-03-09 21:12:30.422084",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@ -456,7 +456,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi = make_purchase_invoice(company = "_Test Company with perpetual inventory", warehouse= "Stores - TCP1",
cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1")
return_pi = make_purchase_invoice(is_return=1, return_against=pi.name, qty=-2,
return_pi = make_purchase_invoice(is_return=1, return_against=pi.name, qty=-2,
company = "_Test Company with perpetual inventory", warehouse= "Stores - TCP1",
cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1")
@ -1031,7 +1031,7 @@ def make_purchase_invoice_against_cost_center(**args):
pi.is_return = args.is_return
pi.credit_to = args.return_against or "Creditors - _TC"
pi.is_subcontracted = args.is_subcontracted or "No"
if args.supplier_warehouse:
if args.supplier_warehouse:
pi.supplier_warehouse = "_Test Warehouse 1 - _TC"
pi.append("items", {

View File

@ -18,7 +18,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100",
"item_tax_template": "_Test Account Excise Duty @ 10",
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC",
"parentfield": "items",
"qty": 10,
"rate": 50,

View File

@ -148,7 +148,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100",
"item_tax_template": "_Test Account Excise Duty @ 10",
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC",
"parentfield": "items",
"price_list_rate": 50,
"qty": 10,
@ -276,7 +276,7 @@
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100",
"item_tax_template": "_Test Account Excise Duty @ 10",
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC",
"parentfield": "items",
"price_list_rate": 62.5,
"qty": 10,

View File

@ -405,10 +405,10 @@ class TestSalesInvoice(unittest.TestCase):
item_row = si.get("items")[0]
add_items = [
(54, '_Test Account Excise Duty @ 12'),
(288, '_Test Account Excise Duty @ 15'),
(144, '_Test Account Excise Duty @ 20'),
(430, '_Test Item Tax Template 1')
(54, '_Test Account Excise Duty @ 12 - _TC'),
(288, '_Test Account Excise Duty @ 15 - _TC'),
(144, '_Test Account Excise Duty @ 20 - _TC'),
(430, '_Test Item Tax Template 1 - _TC')
]
for qty, item_tax_template in add_items:
item_row_copy = copy.deepcopy(item_row)
@ -2077,14 +2077,14 @@ def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
item.save()
item.append("taxes", {
"item_tax_template": "_Test Item Tax Template 1",
"item_tax_template": "_Test Item Tax Template 1 - _TC",
"valid_from": add_days(nowdate(), 1)
})
item.save()
sales_invoice = create_sales_invoice(item = "_Test Item 2", do_not_save=1)
sales_invoice.items[0].item_tax_template = "_Test Item Tax Template 1"
sales_invoice.items[0].item_tax_template = "_Test Item Tax Template 1 - _TC"
self.assertRaises(frappe.ValidationError, sales_invoice.save)
item.taxes = []

View File

@ -129,6 +129,9 @@ def get_gl_entries(filters, accounting_dimensions):
order_by_statement = "order by posting_date, account, creation"
if filters.get("include_dimensions"):
order_by_statement = "order by posting_date, creation"
if filters.get("group_by") == _("Group by Voucher"):
order_by_statement = "order by posting_date, voucher_type, voucher_no"
@ -142,7 +145,9 @@ def get_gl_entries(filters, accounting_dimensions):
distributed_cost_center_query = ""
if filters and filters.get('cost_center'):
select_fields_with_percentage = """, debit*(DCC_allocation.percentage_allocation/100) as debit, credit*(DCC_allocation.percentage_allocation/100) as credit, debit_in_account_currency*(DCC_allocation.percentage_allocation/100) as debit_in_account_currency,
select_fields_with_percentage = """, debit*(DCC_allocation.percentage_allocation/100) as debit,
credit*(DCC_allocation.percentage_allocation/100) as credit,
debit_in_account_currency*(DCC_allocation.percentage_allocation/100) as debit_in_account_currency,
credit_in_account_currency*(DCC_allocation.percentage_allocation/100) as credit_in_account_currency """
distributed_cost_center_query = """
@ -200,7 +205,7 @@ def get_gl_entries(filters, accounting_dimensions):
def get_conditions(filters):
conditions = []
if filters.get("account"):
if filters.get("account") and not filters.get("include_dimensions"):
lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"])
conditions.append("""account in (select name from tabAccount
where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))
@ -245,17 +250,19 @@ def get_conditions(filters):
if match_conditions:
conditions.append(match_conditions)
accounting_dimensions = get_accounting_dimensions(as_list=False)
if filters.get("include_dimensions"):
accounting_dimensions = get_accounting_dimensions(as_list=False)
if accounting_dimensions:
for dimension in accounting_dimensions:
if filters.get(dimension.fieldname):
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
filters.get(dimension.fieldname))
conditions.append("{0} in %({0})s".format(dimension.fieldname))
else:
conditions.append("{0} in (%({0})s)".format(dimension.fieldname))
if accounting_dimensions:
for dimension in accounting_dimensions:
if not dimension.disabled:
if filters.get(dimension.fieldname):
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
filters.get(dimension.fieldname))
conditions.append("{0} in %({0})s".format(dimension.fieldname))
else:
conditions.append("{0} in (%({0})s)".format(dimension.fieldname))
return "and {}".format(" and ".join(conditions)) if conditions else ""

View File

@ -55,7 +55,7 @@ def get_result(filters):
except IndexError:
account = []
total_invoiced_amount, tds_deducted = get_invoice_and_tds_amount(supplier.name, account,
filters.company, filters.from_date, filters.to_date)
filters.company, filters.from_date, filters.to_date, filters.fiscal_year)
if total_invoiced_amount or tds_deducted:
row = [supplier.pan, supplier.name]
@ -68,7 +68,7 @@ def get_result(filters):
return out
def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date):
def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date, fiscal_year):
''' calculate total invoice amount and total tds deducted for given supplier '''
entries = frappe.db.sql("""
@ -94,7 +94,9 @@ def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date):
""".format(', '.join(["'%s'" % d for d in vouchers])),
(account, from_date, to_date, company))[0][0])
debit_note_amount = get_debit_note_amount([supplier], from_date, to_date, company=company)
date_range_filter = [fiscal_year, from_date, to_date]
debit_note_amount = get_debit_note_amount([supplier], date_range_filter, company=company)
total_invoiced_amount = supplier_credit_amount + tds_deducted - debit_note_amount

View File

@ -231,12 +231,12 @@ class TestPurchaseOrder(unittest.TestCase):
new_item_with_tax = frappe.get_doc("Item", "Test Item with Tax")
new_item_with_tax.append("taxes", {
"item_tax_template": "Test Update Items Template",
"item_tax_template": "Test Update Items Template - _TC",
"valid_from": nowdate()
})
new_item_with_tax.save()
tax_template = "_Test Account Excise Duty @ 10"
tax_template = "_Test Account Excise Duty @ 10 - _TC"
item = "_Test Item Home Desktop 100"
if not frappe.db.exists("Item Tax", {"parent":item, "item_tax_template":tax_template}):
item_doc = frappe.get_doc("Item", item)
@ -287,7 +287,7 @@ class TestPurchaseOrder(unittest.TestCase):
po.cancel()
po.delete()
new_item_with_tax.delete()
frappe.get_doc("Item Tax Template", "Test Update Items Template").delete()
frappe.get_doc("Item Tax Template", "Test Update Items Template - _TC").delete()
def test_update_child_uom_conv_factor_change(self):
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")

View File

@ -278,7 +278,7 @@ class BuyingController(StockController):
if self.is_subcontracted == "Yes":
if self.doctype in ["Purchase Receipt", "Purchase Invoice"] and not self.supplier_warehouse:
frappe.throw(_("Supplier Warehouse mandatory for sub-contracted Purchase Receipt"))
frappe.throw(_("Supplier Warehouse mandatory for sub-contracted {0}").format(self.doctype))
for item in self.get("items"):
if item in self.sub_contracted_items and not item.bom:

View File

@ -406,7 +406,8 @@ class StockController(AccountsController):
def set_rate_of_stock_uom(self):
if self.doctype in ["Purchase Receipt", "Purchase Invoice", "Purchase Order", "Sales Invoice", "Sales Order", "Delivery Note", "Quotation"]:
for d in self.get("items"):
d.stock_uom_rate = d.rate / d.conversion_factor
if d.conversion_factor:
d.stock_uom_rate = d.rate / d.conversion_factor
def validate_internal_transfer(self):
if self.doctype in ('Sales Invoice', 'Delivery Note', 'Purchase Invoice', 'Purchase Receipt') \

View File

@ -36,6 +36,7 @@ def enroll_student(source_name):
student.save()
program_enrollment = frappe.new_doc("Program Enrollment")
program_enrollment.student = student.name
program_enrollment.student_category = student.student_category
program_enrollment.student_name = student.title
program_enrollment.program = frappe.db.get_value("Student Applicant", source_name, "program")
frappe.publish_realtime('enroll_student_progress', {"progress": [2, 4]}, user=frappe.session.user)

View File

@ -30,7 +30,7 @@ class ProgramEnrollmentTool(Document):
.format(condition), self.as_dict(), as_dict=1)
elif self.get_students_from == "Program Enrollment":
condition2 = 'and student_batch_name=%(student_batch)s' if self.student_batch else " "
students = frappe.db.sql('''select student, student_name, student_batch_name from `tabProgram Enrollment`
students = frappe.db.sql('''select student, student_name, student_batch_name, student_category from `tabProgram Enrollment`
where program=%(program)s and academic_year=%(academic_year)s {0} {1} and docstatus != 2'''
.format(condition, condition2), self.as_dict(), as_dict=1)
@ -57,6 +57,7 @@ class ProgramEnrollmentTool(Document):
prog_enrollment = frappe.new_doc("Program Enrollment")
prog_enrollment.student = stud.student
prog_enrollment.student_name = stud.student_name
prog_enrollment.student_category = stud.student_category
prog_enrollment.program = self.new_program
prog_enrollment.academic_year = self.new_academic_year
prog_enrollment.academic_term = self.new_academic_term

View File

@ -11,6 +11,7 @@
"middle_name",
"last_name",
"program",
"student_category",
"lms_only",
"paid",
"column_break_8",
@ -257,12 +258,18 @@
"options": "Student Applicant",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "student_category",
"fieldtype": "Link",
"label": "Student Category",
"options": "Student Category"
}
],
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2020-10-05 13:59:45.631647",
"modified": "2021-03-01 23:00:25.119241",
"modified_by": "Administrator",
"module": "Education",
"name": "Student Applicant",

View File

@ -364,7 +364,7 @@ let calculate_age = function(birth) {
let age = new Date();
age.setTime(ageMS);
let years = age.getFullYear() - 1970;
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
};
// List Stock items

View File

@ -258,5 +258,5 @@ var calculate_age = function (dob) {
var age = new Date();
age.setTime(ageMS);
var years = age.getFullYear() - 1970;
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
};

View File

@ -46,11 +46,11 @@ frappe.ui.form.on('Patient', {
}
},
onload: function (frm) {
if(!frm.doc.dob){
if (!frm.doc.dob) {
$(frm.fields_dict['age_html'].wrapper).html('');
}
if(frm.doc.dob){
$(frm.fields_dict['age_html'].wrapper).html('AGE : ' + get_age(frm.doc.dob));
if (frm.doc.dob) {
$(frm.fields_dict['age_html'].wrapper).html(`${__('AGE')} : ${get_age(frm.doc.dob)}`);
}
}
});
@ -65,7 +65,7 @@ frappe.ui.form.on('Patient', 'dob', function(frm) {
}
else {
let age_str = get_age(frm.doc.dob);
$(frm.fields_dict['age_html'].wrapper).html('AGE : ' + age_str);
$(frm.fields_dict['age_html'].wrapper).html(`${__('AGE')} : ${age_str}`);
}
}
else {

View File

@ -108,7 +108,7 @@ class Patient(Document):
if self.dob:
dob = getdate(self.dob)
age = dateutil.relativedelta.relativedelta(getdate(), dob)
age_str = str(age.years) + ' year(s) ' + str(age.months) + ' month(s) ' + str(age.days) + ' day(s)'
age_str = str(age.years) + ' ' + _("Years(s)") + ' ' + str(age.months) + ' ' + _("Month(s)") + ' ' + str(age.days) + ' ' + _("Day(s)")
return age_str
def invoice_patient_registration(self):

View File

@ -596,5 +596,5 @@ let calculate_age = function(birth) {
let age = new Date();
age.setTime(ageMS);
let years = age.getFullYear() - 1970;
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
};

View File

@ -358,5 +358,5 @@ let calculate_age = function(birth) {
let age = new Date();
age.setTime(ageMS);
let years = age.getFullYear() - 1970;
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
};

View File

@ -36,5 +36,5 @@ var calculate_age = function(birth) {
var age = new Date();
age.setTime(ageMS);
var years = age.getFullYear() - 1970;
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
return `${years} ${__('Years(s)')} ${age.getMonth()} ${__('Month(s)')} ${age.getDate()} ${__('Day(s)')}`;
};

View File

@ -131,6 +131,10 @@ def mark_bulk_attendance(data):
data = json.loads(data)
data = frappe._dict(data)
company = frappe.get_value('Employee', data.employee, 'company')
if not data.unmarked_days:
frappe.throw(_("Please select a date."))
return
for date in data.unmarked_days:
doc_dict = {
'doctype': 'Attendance',

View File

@ -12,7 +12,7 @@ frappe.listview_settings['Attendance'] = {
onload: function(list_view) {
let me = this;
const months = moment.months()
list_view.page.add_inner_button( __("Mark Attendance"), function(){
list_view.page.add_inner_button( __("Mark Attendance"), function() {
let dialog = new frappe.ui.Dialog({
title: __("Mark Attendance"),
fields: [
@ -22,11 +22,12 @@ frappe.listview_settings['Attendance'] = {
fieldtype: 'Link',
options: 'Employee',
reqd: 1,
onchange: function(){
onchange: function() {
dialog.set_df_property("unmarked_days", "hidden", 1);
dialog.set_df_property("status", "hidden", 1);
dialog.set_df_property("month", "value", '');
dialog.set_df_property("unmarked_days", "options", []);
dialog.no_unmarked_days_left = false;
}
},
{
@ -35,13 +36,18 @@ frappe.listview_settings['Attendance'] = {
fieldname: "month",
options: months,
reqd: 1,
onchange: function(){
onchange: function() {
if(dialog.fields_dict.employee.value && dialog.fields_dict.month.value) {
dialog.set_df_property("status", "hidden", 0);
dialog.set_df_property("unmarked_days", "options", []);
dialog.no_unmarked_days_left = false;
me.get_multi_select_options(dialog.fields_dict.employee.value, dialog.fields_dict.month.value).then(options =>{
dialog.set_df_property("unmarked_days", "hidden", 0);
dialog.set_df_property("unmarked_days", "options", options);
if (options.length > 0) {
dialog.set_df_property("unmarked_days", "hidden", 0);
dialog.set_df_property("unmarked_days", "options", options);
} else {
dialog.no_unmarked_days_left = true;
}
});
}
}
@ -64,21 +70,25 @@ frappe.listview_settings['Attendance'] = {
hidden: 1
},
],
primary_action(data){
frappe.confirm(__('Mark attendance as <b>' + data.status + '</b> for <b>' + data.month +'</b>' + ' on selected dates?'), () => {
frappe.call({
method: "erpnext.hr.doctype.attendance.attendance.mark_bulk_attendance",
args: {
data : data
},
callback: function(r) {
if(r.message === 1) {
frappe.show_alert({message:__("Attendance Marked"), indicator:'blue'});
cur_dialog.hide();
primary_action(data) {
if (cur_dialog.no_unmarked_days_left) {
frappe.msgprint(__("Attendance for the month of {0} , has already been marked for the Employee {1}",[dialog.fields_dict.month.value, dialog.fields_dict.employee.value]));
} else {
frappe.confirm(__('Mark attendance as {0} for {1} on selected dates?', [data.status,data.month]), () => {
frappe.call({
method: "erpnext.hr.doctype.attendance.attendance.mark_bulk_attendance",
args: {
data: data
},
callback: function(r) {
if (r.message === 1) {
frappe.show_alert({message: __("Attendance Marked"), indicator: 'blue'});
cur_dialog.hide();
}
}
}
});
});
});
}
dialog.hide();
list_view.refresh();
},

View File

@ -1,16 +1,19 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from frappe import _
from frappe.utils import formatdate, format_datetime, getdate, get_datetime, nowdate, flt, cstr, add_days, today
from frappe.model.document import Document
from frappe.desk.form import assign_to
import erpnext
import frappe
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
from frappe import _
from frappe.desk.form import assign_to
from frappe.model.document import Document
from frappe.utils import (add_days, cstr, flt, format_datetime, formatdate,
get_datetime, getdate, nowdate, today, unique)
class DuplicateDeclarationError(frappe.ValidationError): pass
class EmployeeBoardingController(Document):
'''
Create the project and the task for the boarding process
@ -48,27 +51,38 @@ class EmployeeBoardingController(Document):
continue
task = frappe.get_doc({
"doctype": "Task",
"project": self.project,
"subject": activity.activity_name + " : " + self.employee_name,
"description": activity.description,
"department": self.department,
"company": self.company,
"task_weight": activity.task_weight
}).insert(ignore_permissions=True)
"doctype": "Task",
"project": self.project,
"subject": activity.activity_name + " : " + self.employee_name,
"description": activity.description,
"department": self.department,
"company": self.company,
"task_weight": activity.task_weight
}).insert(ignore_permissions=True)
activity.db_set("task", task.name)
users = [activity.user] if activity.user else []
if activity.role:
user_list = frappe.db.sql_list('''select distinct(parent) from `tabHas Role`
where parenttype='User' and role=%s''', activity.role)
users = users + user_list
user_list = frappe.db.sql_list('''
SELECT
DISTINCT(has_role.parent)
FROM
`tabHas Role` has_role
LEFT JOIN `tabUser` user
ON has_role.parent = user.name
WHERE
has_role.parenttype = 'User'
AND user.enabled = 1
AND has_role.role = %s
''', activity.role)
users = unique(users + user_list)
if "Administrator" in users:
users.remove("Administrator")
# assign the task the users
if users:
self.assign_task_to_users(task, set(users))
self.assign_task_to_users(task, users)
def assign_task_to_users(self, task, users):
for user in users:

View File

@ -506,7 +506,8 @@ class SalarySlip(TransactionBase):
return amount
except NameError as err:
frappe.throw(_("Name error: {0}").format(err))
frappe.throw(_("{0} <br> This error can be due to missing or deleted field.").format(err),
title=_("Name error"))
except SyntaxError as err:
frappe.throw(_("Syntax error in formula or condition: {0}").format(err))
except Exception as e:
@ -930,7 +931,8 @@ class SalarySlip(TransactionBase):
if condition:
return frappe.safe_eval(condition, self.whitelisted_globals, data)
except NameError as err:
frappe.throw(_("Name error: {0}").format(err))
frappe.throw(_("{0} <br> This error can be due to missing or deleted field.").format(err),
title=_("Name error"))
except SyntaxError as err:
frappe.throw(_("Syntax error in condition: {0}").format(err))
except Exception as e:
@ -1242,4 +1244,4 @@ def unlink_ref_doc_from_salary_slip(ref_no):
def generate_password_for_pdf(policy_template, employee):
employee = frappe.get_doc("Employee", employee)
return policy_template.format(**employee.as_dict())
return policy_template.format(**employee.as_dict())

View File

@ -142,6 +142,8 @@ frappe.ui.form.on('Salary Structure', {
],
primary_action: function() {
var data = d.get_values();
delete data.company
delete data.currency
frappe.call({
doc: frm.doc,
method: "assign_salary_structure",

View File

@ -158,16 +158,18 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
let me = this;
frappe.flags.round_off_applicable_accounts = [];
return frappe.call({
"method": "erpnext.controllers.taxes_and_totals.get_round_off_applicable_accounts",
"args": {
"company": me.frm.doc.company,
"account_list": frappe.flags.round_off_applicable_accounts
},
callback: function(r) {
frappe.flags.round_off_applicable_accounts.push(...r.message);
}
});
if (me.frm.doc.company) {
return frappe.call({
"method": "erpnext.controllers.taxes_and_totals.get_round_off_applicable_accounts",
"args": {
"company": me.frm.doc.company,
"account_list": frappe.flags.round_off_applicable_accounts
},
callback: function(r) {
frappe.flags.round_off_applicable_accounts.push(...r.message);
}
});
}
},
determine_exclusive_rate: function() {

View File

@ -1,11 +1,18 @@
frappe.ui.form.ControlData = frappe.ui.form.ControlData.extend( {
make_input() {
if (!this.df.read_only) {
this._super();
}
this._super();
if (this.df.options == 'Phone') {
this.setup_phone();
}
if (this.frm && this.frm.fields_dict) {
Object.values(this.frm.fields_dict).forEach(function(field) {
if (field.df.read_only === 1 && field.df.options === 'Phone'
&& field.disp_area.style[0] != 'display' && !field.has_icon) {
field.setup_phone();
field.has_icon = true;
}
});
}
},
setup_phone() {
if (frappe.phone_call.handler) {

View File

@ -595,21 +595,7 @@ erpnext.utils.update_child_items = function(opts) {
}
erpnext.utils.map_current_doc = function(opts) {
let query_args = {};
if (opts.get_query_filters) {
query_args.filters = opts.get_query_filters;
}
if (opts.get_query_method) {
query_args.query = opts.get_query_method;
}
if (query_args.filters || query_args.query) {
opts.get_query = () => {
return query_args;
}
}
var _map = function() {
function _map() {
if($.isArray(cur_frm.doc.items) && cur_frm.doc.items.length > 0) {
// remove first item row if empty
if(!cur_frm.doc.items[0].item_code) {
@ -683,8 +669,22 @@ erpnext.utils.map_current_doc = function(opts) {
}
});
}
if(opts.source_doctype) {
var d = new frappe.ui.form.MultiSelectDialog({
let query_args = {};
if (opts.get_query_filters) {
query_args.filters = opts.get_query_filters;
}
if (opts.get_query_method) {
query_args.query = opts.get_query_method;
}
if (query_args.filters || query_args.query) {
opts.get_query = () => query_args;
}
if (opts.source_doctype) {
const d = new frappe.ui.form.MultiSelectDialog({
doctype: opts.source_doctype,
target: opts.target,
date_field: opts.date_field || undefined,
@ -703,7 +703,11 @@ erpnext.utils.map_current_doc = function(opts) {
_map();
},
});
} else if(opts.source_name) {
return d;
}
if (opts.source_name) {
opts.source_name = [opts.source_name];
_map();
}

View File

@ -33,8 +33,7 @@
},
{
"fieldname": "sb_00",
"fieldtype": "Section Break",
"label": "Agenda"
"fieldtype": "Section Break"
},
{
"fieldname": "agenda",
@ -44,13 +43,12 @@
},
{
"fieldname": "sb_01",
"fieldtype": "Section Break",
"label": "Minutes"
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2020-10-27 16:36:45.657883",
"modified": "2021-02-27 16:36:45.657883",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Meeting",
@ -85,4 +83,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
}

View File

@ -105,8 +105,9 @@ def add_print_formats():
frappe.reload_doc("accounts", "print_format", "gst_pos_invoice")
frappe.reload_doc("accounts", "print_format", "GST E-Invoice")
frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
name in('GST POS Invoice', 'GST Tax Invoice', 'GST E-Invoice') """)
frappe.db.set_value("Print Format", "GST POS Invoice", "disabled", 0)
frappe.db.set_value("Print Format", "GST Tax Invoice", "disabled", 0)
frappe.db.set_value("Print Format", "GST E-Invoice", "disabled", 0)
def make_custom_fields(update=True):
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',

View File

@ -189,9 +189,7 @@ def make_custom_fields(update=True):
def setup_report():
report_name = 'Electronic Invoice Register'
frappe.db.sql(""" update `tabReport` set disabled = 0 where
name = %s """, report_name)
frappe.db.set_value("Report", report_name, "disabled", 0)
if not frappe.db.get_value('Custom Role', dict(report=report_name)):
frappe.get_doc(dict(

View File

@ -36,5 +36,4 @@ def make_custom_fields(update=True):
def add_print_formats():
frappe.reload_doc("regional", "print_format", "irs_1099_form")
frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
name in('IRS 1099 Form') """)
frappe.db.set_value("Print Format", "IRS 1099 Form", "disabled", 0)

View File

@ -54,7 +54,11 @@ class TestCustomer(unittest.TestCase):
details = get_party_details("_Test Customer")
for key, value in iteritems(to_check):
self.assertEqual(value, details.get(key))
val = details.get(key)
if not val and not isinstance(val, list):
val = None
self.assertEqual(value, val)
def test_party_details_tax_category(self):
from erpnext.accounts.party import get_party_details

View File

@ -555,12 +555,12 @@ class TestSalesOrder(unittest.TestCase):
new_item_with_tax = frappe.get_doc("Item", "Test Item with Tax")
new_item_with_tax.append("taxes", {
"item_tax_template": "Test Update Items Template",
"item_tax_template": "Test Update Items Template - _TC",
"valid_from": nowdate()
})
new_item_with_tax.save()
tax_template = "_Test Account Excise Duty @ 10"
tax_template = "_Test Account Excise Duty @ 10 - _TC"
item = "_Test Item Home Desktop 100"
if not frappe.db.exists("Item Tax", {"parent":item, "item_tax_template":tax_template}):
item_doc = frappe.get_doc("Item", item)
@ -614,7 +614,7 @@ class TestSalesOrder(unittest.TestCase):
so.cancel()
so.delete()
new_item_with_tax.delete()
frappe.get_doc("Item Tax Template", "Test Update Items Template").delete()
frappe.get_doc("Item Tax Template", "Test Update Items Template - _TC").delete()
frappe.db.set_value("Stock Settings", None, "default_warehouse", old_stock_settings_value)
def test_warehouse_user(self):

View File

@ -725,7 +725,7 @@
{
"fieldname": "default_in_transit_warehouse",
"fieldtype": "Link",
"label": "Default In Transit Warehouse",
"label": "Default In-Transit Warehouse",
"options": "Warehouse"
},
{
@ -740,7 +740,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
"modified": "2020-12-03 12:27:27.085094",
"modified": "2021-02-16 15:53:37.167589",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@ -390,8 +390,10 @@ class Company(NestedSet):
frappe.db.sql("delete from tabDepartment where company=%s", self.name)
frappe.db.sql("delete from `tabTax Withholding Account` where company=%s", self.name)
# delete tax templates
frappe.db.sql("delete from `tabSales Taxes and Charges Template` where company=%s", self.name)
frappe.db.sql("delete from `tabPurchase Taxes and Charges Template` where company=%s", self.name)
frappe.db.sql("delete from `tabItem Tax Template` where company=%s", self.name)
@frappe.whitelist()
def enqueue_replace_abbr(company, old, new):

View File

@ -1,10 +1,5 @@
frappe.listview_settings['Company'] = {
onload: () => {
frappe.breadcrumbs.add({
type: 'Custom',
module: __('Accounts'),
label: __('Accounts'),
route: '#modules/Accounts'
});
}
}
onload() {
frappe.breadcrumbs.add('Accounts');
},
};

View File

@ -79,13 +79,13 @@
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 10",
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC",
"tax_category": ""
},
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 12",
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC",
"tax_category": "_Test Tax Category 1"
}
]
@ -99,7 +99,7 @@
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 15",
"item_tax_template": "_Test Account Excise Duty @ 15 - _TC",
"tax_category": ""
}
]

View File

@ -85,7 +85,7 @@ frappe.ui.form.on("Item", {
}
if (frm.doc.variant_of) {
frm.set_intro(__('This Item is a Variant of {0} (Template).',
[`<a href="/app/item/${frm.doc.variant_of}">${frm.doc.variant_of}</a>`]), true);
[`<a href="/app/item/${frm.doc.variant_of}" onclick="location.reload()">${frm.doc.variant_of}</a>`]), true);
}
if (frappe.defaults.get_default("item_naming_by")!="Naming Series" || frm.doc.variant_of) {

View File

@ -104,41 +104,41 @@ class TestItem(unittest.TestCase):
def test_item_tax_template(self):
expected_item_tax_template = [
{"item_code": "_Test Item With Item Tax Template", "tax_category": "",
"item_tax_template": "_Test Account Excise Duty @ 10"},
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC"},
{"item_code": "_Test Item With Item Tax Template", "tax_category": "_Test Tax Category 1",
"item_tax_template": "_Test Account Excise Duty @ 12"},
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC"},
{"item_code": "_Test Item With Item Tax Template", "tax_category": "_Test Tax Category 2",
"item_tax_template": None},
{"item_code": "_Test Item Inherit Group Item Tax Template 1", "tax_category": "",
"item_tax_template": "_Test Account Excise Duty @ 10"},
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC"},
{"item_code": "_Test Item Inherit Group Item Tax Template 1", "tax_category": "_Test Tax Category 1",
"item_tax_template": "_Test Account Excise Duty @ 12"},
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC"},
{"item_code": "_Test Item Inherit Group Item Tax Template 1", "tax_category": "_Test Tax Category 2",
"item_tax_template": None},
{"item_code": "_Test Item Inherit Group Item Tax Template 2", "tax_category": "",
"item_tax_template": "_Test Account Excise Duty @ 15"},
"item_tax_template": "_Test Account Excise Duty @ 15 - _TC"},
{"item_code": "_Test Item Inherit Group Item Tax Template 2", "tax_category": "_Test Tax Category 1",
"item_tax_template": "_Test Account Excise Duty @ 12"},
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC"},
{"item_code": "_Test Item Inherit Group Item Tax Template 2", "tax_category": "_Test Tax Category 2",
"item_tax_template": None},
{"item_code": "_Test Item Override Group Item Tax Template", "tax_category": "",
"item_tax_template": "_Test Account Excise Duty @ 20"},
"item_tax_template": "_Test Account Excise Duty @ 20 - _TC"},
{"item_code": "_Test Item Override Group Item Tax Template", "tax_category": "_Test Tax Category 1",
"item_tax_template": "_Test Item Tax Template 1"},
"item_tax_template": "_Test Item Tax Template 1 - _TC"},
{"item_code": "_Test Item Override Group Item Tax Template", "tax_category": "_Test Tax Category 2",
"item_tax_template": None},
]
expected_item_tax_map = {
None: {},
"_Test Account Excise Duty @ 10": {"_Test Account Excise Duty - _TC": 10},
"_Test Account Excise Duty @ 12": {"_Test Account Excise Duty - _TC": 12},
"_Test Account Excise Duty @ 15": {"_Test Account Excise Duty - _TC": 15},
"_Test Account Excise Duty @ 20": {"_Test Account Excise Duty - _TC": 20},
"_Test Item Tax Template 1": {"_Test Account Excise Duty - _TC": 5, "_Test Account Education Cess - _TC": 10,
"_Test Account Excise Duty @ 10 - _TC": {"_Test Account Excise Duty - _TC": 10},
"_Test Account Excise Duty @ 12 - _TC": {"_Test Account Excise Duty - _TC": 12},
"_Test Account Excise Duty @ 15 - _TC": {"_Test Account Excise Duty - _TC": 15},
"_Test Account Excise Duty @ 20 - _TC": {"_Test Account Excise Duty - _TC": 20},
"_Test Item Tax Template 1 - _TC": {"_Test Account Excise Duty - _TC": 5, "_Test Account Education Cess - _TC": 10,
"_Test Account S&H Education Cess - _TC": 15}
}

View File

@ -92,7 +92,7 @@
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 10"
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC"
}
],
"stock_uom": "_Test UOM 1"
@ -370,12 +370,12 @@
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 10"
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC"
},
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 12",
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC",
"tax_category": "_Test Tax Category 1"
}
]
@ -449,13 +449,13 @@
{
"doctype": "Item Tax",
"parentfield": "taxes",
"item_tax_template": "_Test Account Excise Duty @ 20"
"item_tax_template": "_Test Account Excise Duty @ 20 - _TC"
},
{
"doctype": "Item Tax",
"parentfield": "taxes",
"tax_category": "_Test Tax Category 1",
"item_tax_template": "_Test Item Tax Template 1"
"item_tax_template": "_Test Item Tax Template 1 - _TC"
}
]
},

View File

@ -554,7 +554,7 @@ def auto_fetch_serial_number(qty, item_code, warehouse, posting_date=None, batch
if batch_nos:
try:
filters["batch_no"] = json.loads(batch_nos)
filters["batch_no"] = json.loads(batch_nos) if (type(json.loads(batch_nos)) == list) else [json.loads(batch_nos)]
except:
filters["batch_no"] = [batch_nos]
@ -626,4 +626,4 @@ def fetch_serial_numbers(filters, qty, do_not_include=[]):
batch_no_condition=batch_no_condition
), filters, as_dict=1)
return serial_numbers
return serial_numbers

View File

@ -231,15 +231,37 @@ frappe.ui.form.on('Stock Entry', {
}, __("Get Items From"));
frm.add_custom_button(__('Material Request'), function() {
erpnext.utils.map_current_doc({
const allowed_request_types = ["Material Transfer", "Material Issue", "Customer Provided"];
const depends_on_condition = "eval:doc.material_request_type==='Customer Provided'";
const d = erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_stock_entry",
source_doctype: "Material Request",
target: frm,
date_field: "schedule_date",
setters: {},
setters: [{
fieldtype: 'Select',
label: __('Purpose'),
options: allowed_request_types.join("\n"),
fieldname: 'material_request_type',
default: "Material Transfer",
mandatory: 1,
change() {
if (this.value === 'Customer Provided') {
d.dialog.get_field("customer").set_focus();
}
},
},
{
fieldtype: 'Link',
label: __('Customer'),
options: 'Customer',
fieldname: 'customer',
depends_on: depends_on_condition,
mandatory_depends_on: depends_on_condition,
}],
get_query_filters: {
docstatus: 1,
material_request_type: ["in", ["Material Transfer", "Material Issue"]],
material_request_type: ["in", allowed_request_types],
status: ["not in", ["Transferred", "Issued"]]
}
})
@ -569,6 +591,7 @@ frappe.ui.form.on('Stock Entry', {
add_to_transit: function(frm) {
if(frm.doc.add_to_transit && frm.doc.purpose=='Material Transfer') {
frm.set_value('to_warehouse', '');
frm.set_value('stock_entry_type', 'Material Transfer');
frm.fields_dict.to_warehouse.get_query = function() {
return {
@ -579,7 +602,15 @@ frappe.ui.form.on('Stock Entry', {
}
};
};
frappe.db.get_value('Company', frm.doc.company, 'default_in_transit_warehouse', (r) => {
frm.trigger('set_tansit_warehouse');
}
},
set_tansit_warehouse: function(frm) {
if(frm.doc.add_to_transit && frm.doc.purpose == 'Material Transfer' && !frm.doc.to_warehouse) {
let dt = frm.doc.from_warehouse ? 'Warehouse' : 'Company';
let dn = frm.doc.from_warehouse ? frm.doc.from_warehouse : frm.doc.company;
frappe.db.get_value(dt, dn, 'default_in_transit_warehouse', (r) => {
if (r.default_in_transit_warehouse) {
frm.set_value('to_warehouse', r.default_in_transit_warehouse);
}
@ -946,6 +977,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
from_warehouse: function(doc) {
this.frm.trigger('set_tansit_warehouse');
this.set_warehouse_in_children(doc.items, "s_warehouse", doc.from_warehouse);
},

View File

@ -3,6 +3,18 @@
frappe.ui.form.on("Warehouse", {
onload: function(frm) {
frm.set_query("default_in_transit_warehouse", function() {
return {
filters:{
'warehouse_type' : 'Transit',
'is_group': 0,
'company': frm.doc.company
}
};
});
},
refresh: function(frm) {
frm.toggle_display('warehouse_name', frm.doc.__islocal);
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);

View File

@ -13,6 +13,7 @@
"column_break_3",
"warehouse_type",
"parent_warehouse",
"default_in_transit_warehouse",
"is_group",
"column_break_4",
"account",
@ -230,13 +231,20 @@
{
"fieldname": "column_break_3",
"fieldtype": "Section Break"
},
{
"depends_on": "eval: doc.warehouse_type !== 'Transit';",
"fieldname": "default_in_transit_warehouse",
"fieldtype": "Link",
"label": "Default In-Transit Warehouse",
"options": "Warehouse"
}
],
"icon": "fa fa-building",
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2020-08-03 18:41:52.442502",
"modified": "2021-02-16 17:21:52.380098",
"modified_by": "Administrator",
"module": "Stock",
"name": "Warehouse",

View File

@ -82,11 +82,6 @@ frappe.query_reports["Stock Ledger"] = {
"label": __("Include UOM"),
"fieldtype": "Link",
"options": "UOM"
},
{
"fieldname": "show_cancelled_entries",
"label": __("Show Cancelled Entries"),
"fieldtype": "Check"
}
],
"formatter": function (value, row, column, data, default_formatter) {

View File

@ -138,7 +138,7 @@ def get_stock_ledger_entries(filters, items):
`tabStock Ledger Entry` sle
WHERE
company = %(company)s
AND posting_date BETWEEN %(from_date)s AND %(to_date)s
AND is_cancelled = 0 AND posting_date BETWEEN %(from_date)s AND %(to_date)s
{sle_conditions}
{item_conditions_sql}
ORDER BY
@ -209,9 +209,6 @@ def get_sle_conditions(filters):
if filters.get("project"):
conditions.append("project=%(project)s")
if not filters.get("show_cancelled_entries"):
conditions.append("is_cancelled = 0")
return "and {}".format(" and ".join(conditions)) if conditions else ""

View File

@ -13,4 +13,4 @@ def get_context(context):
def get_featured_programs():
return utils.get_portal_programs()
return utils.get_portal_programs() or []

View File

@ -26,4 +26,4 @@ def get_program(program_name):
def get_course_progress(courses, program):
progress = {course.name: utils.get_course_progress(course, program) for course in courses}
return progress
return progress or {}