Merge branch 'develop' into error-message
This commit is contained in:
commit
0afdafdbce
@ -6,6 +6,18 @@ frappe.ui.form.on('Item Tax Template', {
|
||||
frm.set_query("tax_type", "taxes", function(doc) {
|
||||
return {
|
||||
filters: [
|
||||
['Account', 'company', '=', frm.doc.company],
|
||||
['Account', 'is_group', '=', 0],
|
||||
['Account', 'account_type', 'in', ['Tax', 'Chargeable', 'Income Account', 'Expense Account', 'Expenses Included In Valuation']]
|
||||
]
|
||||
}
|
||||
});
|
||||
},
|
||||
company: function (frm) {
|
||||
frm.set_query("tax_type", "taxes", function(doc) {
|
||||
return {
|
||||
filters: [
|
||||
['Account', 'company', '=', frm.doc.company],
|
||||
['Account', 'is_group', '=', 0],
|
||||
['Account', 'account_type', 'in', ['Tax', 'Chargeable', 'Income Account', 'Expense Account', 'Expenses Included In Valuation']]
|
||||
]
|
||||
|
@ -1,168 +1,85 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:title",
|
||||
"beta": 0,
|
||||
"creation": "2018-11-22 22:45:00.370913",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"title",
|
||||
"company",
|
||||
"taxes"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Title",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "taxes",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Tax Rates",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item Tax Template Detail",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-12-21 23:51:16.328340",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2020-06-18 20:27:42.615842",
|
||||
"modified_by": "ahmad@havenir.com",
|
||||
"module": "Accounts",
|
||||
"name": "Item Tax Template",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
"share": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
"track_changes": 1
|
||||
}
|
@ -140,10 +140,8 @@ def make_entry(args, adv_adj, update_outstanding):
|
||||
gle = frappe.new_doc("GL Entry")
|
||||
gle.update(args)
|
||||
gle.flags.ignore_permissions = 1
|
||||
gle.validate()
|
||||
gle.db_insert()
|
||||
gle.insert()
|
||||
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
|
||||
gle.flags.ignore_validate = True
|
||||
gle.submit()
|
||||
|
||||
# check against budget
|
||||
|
@ -582,7 +582,8 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
|
||||
args = {
|
||||
'item_code': filters.get('item_code'),
|
||||
'posting_date': filters.get('valid_from'),
|
||||
'tax_category': filters.get('tax_category')
|
||||
'tax_category': filters.get('tax_category'),
|
||||
'company': filters.get('company')
|
||||
}
|
||||
|
||||
taxes = _get_item_tax_template(args, taxes, for_validate=True)
|
||||
|
@ -53,7 +53,8 @@ class calculate_taxes_and_totals(object):
|
||||
'tax_category': self.doc.get('tax_category'),
|
||||
'posting_date': self.doc.get('posting_date'),
|
||||
'bill_date': self.doc.get('bill_date'),
|
||||
'transaction_date': self.doc.get('transaction_date')
|
||||
'transaction_date': self.doc.get('transaction_date'),
|
||||
'company': self.doc.get('company')
|
||||
}
|
||||
|
||||
item_group = item_doc.item_group
|
||||
|
@ -172,7 +172,9 @@ def get_number_cards():
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Lead",
|
||||
"name": "New Lead (Last 1 Month)",
|
||||
"filters_json": json.dumps([["Lead","creation","Previous","1 month",False]]),
|
||||
"filters_json": json.dumps([
|
||||
["Lead", "creation", "Timespan", "last month"]
|
||||
]),
|
||||
"function": "Count",
|
||||
"is_public": 1,
|
||||
"label": _("New Lead (Last 1 Month)"),
|
||||
@ -183,7 +185,9 @@ def get_number_cards():
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Opportunity",
|
||||
"name": "New Opportunity (Last 1 Month)",
|
||||
"filters_json": json.dumps([["Opportunity","creation","Previous","1 month",False]]),
|
||||
"filters_json": json.dumps([
|
||||
["Opportunity", "creation", "Timespan", "last month"]
|
||||
]),
|
||||
"function": "Count",
|
||||
"is_public": 1,
|
||||
"label": _("New Opportunity (Last 1 Month)"),
|
||||
@ -194,7 +198,10 @@ def get_number_cards():
|
||||
"doctype": "Number Card",
|
||||
"document_type": "Opportunity",
|
||||
"name": "Won Opportunity (Last 1 Month)",
|
||||
"filters_json": json.dumps([["Opportunity","creation","Previous","1 month",False]]),
|
||||
"filters_json": json.dumps([
|
||||
["Opportunity", "status", "=", "Converted",False],
|
||||
["Opportunity", "creation", "Timespan", "last month"]
|
||||
]),
|
||||
"function": "Count",
|
||||
"is_public": 1,
|
||||
"label": _("Won Opportunity (Last 1 Month)"),
|
||||
|
@ -114,10 +114,12 @@ class Lead(SellingController):
|
||||
def set_lead_name(self):
|
||||
if not self.lead_name:
|
||||
# Check for leads being created through data import
|
||||
if not self.company_name and not self.flags.ignore_mandatory:
|
||||
if not self.company_name and not self.email_id and not self.flags.ignore_mandatory:
|
||||
frappe.throw(_("A Lead requires either a person's name or an organization's name"))
|
||||
|
||||
elif self.company_name:
|
||||
self.lead_name = self.company_name
|
||||
else:
|
||||
self.lead_name = self.email_id.split("@")[0]
|
||||
|
||||
def set_title(self):
|
||||
if self.organization_lead:
|
||||
|
@ -40,6 +40,8 @@ frappe.ui.form.on("Leave Application", {
|
||||
validate: function(frm) {
|
||||
if (frm.doc.from_date == frm.doc.to_date && frm.doc.half_day == 1){
|
||||
frm.doc.half_day_date = frm.doc.from_date;
|
||||
}else if (frm.doc.half_day == 0){
|
||||
frm.doc.half_day_date = "";
|
||||
}
|
||||
frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
|
||||
},
|
||||
|
@ -293,6 +293,8 @@ class LeaveApplication(Document):
|
||||
def set_half_day_date(self):
|
||||
if self.from_date == self.to_date and self.half_day == 1:
|
||||
self.half_day_date = self.from_date
|
||||
elif self.half_day == 0:
|
||||
self.half_day_date = None
|
||||
|
||||
def notify_employee(self):
|
||||
employee = frappe.get_doc("Employee", self.employee)
|
||||
|
@ -707,3 +707,4 @@ erpnext.patches.v13_0.move_doctype_reports_and_notification_from_hr_to_payroll #
|
||||
erpnext.patches.v13_0.move_payroll_setting_separately_from_hr_settings #22-06-2020
|
||||
erpnext.patches.v13_0.check_is_income_tax_component #22-06-2020
|
||||
erpnext.patches.v12_0.add_taxjar_integration_field
|
||||
erpnext.patches.v12_0.update_item_tax_template_company
|
||||
|
13
erpnext/patches/v12_0/update_item_tax_template_company.py
Normal file
13
erpnext/patches/v12_0/update_item_tax_template_company.py
Normal file
@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('accounts', 'doctype', 'item_tax_template')
|
||||
|
||||
item_tax_template_list = frappe.get_list('Item Tax Template')
|
||||
for template in item_tax_template_list:
|
||||
doc = frappe.get_doc('Item Tax Template', template.name)
|
||||
for tax in doc.taxes:
|
||||
doc.company = frappe.get_value('Account', tax.tax_type, 'company')
|
||||
break
|
||||
doc.save()
|
@ -30,6 +30,7 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
).toggleClass('btn-primary', !(frm.doc.employees || []).length);
|
||||
}
|
||||
if ((frm.doc.employees || []).length) {
|
||||
frm.page.clear_primary_action();
|
||||
frm.page.set_primary_action(__('Create Salary Slips'), () => {
|
||||
frm.save('Submit').then(()=>{
|
||||
frm.page.clear_primary_action();
|
||||
@ -49,15 +50,16 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
return frappe.call({
|
||||
doc: frm.doc,
|
||||
method: 'fill_employee_details',
|
||||
callback: function(r) {
|
||||
if (r.docs[0].employees){
|
||||
}).then(r => {
|
||||
if (r.docs && r.docs[0].employees){
|
||||
frm.employees = r.docs[0].employees;
|
||||
frm.dirty();
|
||||
frm.save();
|
||||
frm.refresh();
|
||||
if(r.docs[0].validate_attendance){
|
||||
render_employee_attendance(frm, r.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -1835,7 +1835,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
|
||||
if (doc.tax_category)
|
||||
filters['tax_category'] = doc.tax_category;
|
||||
|
||||
if (doc.company)
|
||||
filters['company'] = doc.company;
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_tax_template",
|
||||
filters: filters
|
||||
|
@ -172,7 +172,7 @@
|
||||
"default": "Today",
|
||||
"fieldname": "valid_from",
|
||||
"fieldtype": "Date",
|
||||
"label": "Valid From "
|
||||
"label": "Valid From"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@ -187,7 +187,7 @@
|
||||
{
|
||||
"fieldname": "valid_upto",
|
||||
"fieldtype": "Date",
|
||||
"label": "Valid Upto "
|
||||
"label": "Valid Upto"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_24",
|
||||
@ -208,7 +208,7 @@
|
||||
"icon": "fa fa-flag",
|
||||
"idx": 1,
|
||||
"links": [],
|
||||
"modified": "2020-02-28 14:21:25.580331",
|
||||
"modified": "2020-07-06 22:31:32.943475",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Price",
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2013-02-22 01:28:01",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
@ -38,8 +37,7 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2019-12-28 21:54:40.807849",
|
||||
"modified": "2020-06-25 01:40:28.859752",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Tax",
|
||||
|
@ -413,7 +413,7 @@ def get_item_tax_info(company, tax_category, item_codes):
|
||||
continue
|
||||
out[item_code] = {}
|
||||
item = frappe.get_cached_doc("Item", item_code)
|
||||
get_item_tax_template({"tax_category": tax_category}, item, out[item_code])
|
||||
get_item_tax_template({"company": company, "tax_category": tax_category}, item, out[item_code])
|
||||
out[item_code]["item_tax_rate"] = get_item_tax_map(company, out[item_code].get("item_tax_template"), as_json=True)
|
||||
|
||||
return out
|
||||
@ -442,7 +442,8 @@ def _get_item_tax_template(args, taxes, out={}, for_validate=False):
|
||||
taxes_with_no_validity = []
|
||||
|
||||
for tax in taxes:
|
||||
if tax.valid_from:
|
||||
tax_company = frappe.get_value("Item Tax Template", tax.item_tax_template, 'company')
|
||||
if tax.valid_from and tax_company == args['company']:
|
||||
# In purchase Invoice first preference will be given to supplier invoice date
|
||||
# if supplier date is not present then posting date
|
||||
validation_date = args.get('transaction_date') or args.get('bill_date') or args.get('posting_date')
|
||||
@ -450,6 +451,7 @@ def _get_item_tax_template(args, taxes, out={}, for_validate=False):
|
||||
if getdate(tax.valid_from) <= getdate(validation_date):
|
||||
taxes_with_validity.append(tax)
|
||||
else:
|
||||
if tax_company == args['company']:
|
||||
taxes_with_no_validity.append(tax)
|
||||
|
||||
if taxes_with_validity:
|
||||
|
Loading…
x
Reference in New Issue
Block a user