Merge branch 'master' into develop

This commit is contained in:
Sagar Vora 2019-02-26 17:08:59 +05:30
commit e0eafb1c2c
10 changed files with 444 additions and 413 deletions

View File

@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
from frappe.utils import getdate from frappe.utils import getdate
__version__ = '11.1.10' __version__ = '11.1.11'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -8,5 +8,6 @@ frappe.ui.form.on('Payment Terms Template', {
frm.add_fetch("payment_term", "due_date_based_on", "due_date_based_on"); frm.add_fetch("payment_term", "due_date_based_on", "due_date_based_on");
frm.add_fetch("payment_term", "credit_days", "credit_days"); frm.add_fetch("payment_term", "credit_days", "credit_days");
frm.add_fetch("payment_term", "credit_months", "credit_months"); frm.add_fetch("payment_term", "credit_months", "credit_months");
frm.add_fetch("payment_term", "mode_of_payment", "mode_of_payment");
} }
}); });

View File

@ -35,6 +35,7 @@ $.extend(cur_frm.cscript, new erpnext.hr.ExpenseClaimController({frm: cur_frm}))
cur_frm.add_fetch('employee', 'company', 'company'); cur_frm.add_fetch('employee', 'company', 'company');
cur_frm.add_fetch('employee','employee_name','employee_name'); cur_frm.add_fetch('employee','employee_name','employee_name');
cur_frm.add_fetch('expense_type','description','description');
cur_frm.cscript.onload = function(doc) { cur_frm.cscript.onload = function(doc) {
if (doc.__islocal) { if (doc.__islocal) {

View File

@ -1,366 +1,378 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_guest_to_view": 0, "allow_events_in_timeline": 0,
"allow_import": 0, "allow_guest_to_view": 0,
"allow_rename": 0, "allow_import": 0,
"beta": 0, "allow_rename": 0,
"creation": "2013-02-22 01:27:46", "beta": 0,
"custom": 0, "creation": "2013-02-22 01:27:46",
"docstatus": 0, "custom": 0,
"doctype": "DocType", "docstatus": 0,
"editable_grid": 1, "doctype": "DocType",
"editable_grid": 1,
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "expense_date", "columns": 0,
"fieldtype": "Date", "fieldname": "expense_date",
"hidden": 0, "fieldtype": "Date",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 1, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 1,
"label": "Expense Date", "in_standard_filter": 0,
"length": 0, "label": "Expense Date",
"no_copy": 0, "length": 0,
"oldfieldname": "expense_date", "no_copy": 0,
"oldfieldtype": "Date", "oldfieldname": "expense_date",
"permlevel": 0, "oldfieldtype": "Date",
"print_hide": 0, "permlevel": 0,
"print_hide_if_no_value": 0, "print_hide": 0,
"print_width": "150px", "print_hide_if_no_value": 0,
"read_only": 0, "print_width": "150px",
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0, "unique": 0,
"width": "150px" "width": "150px"
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "column_break_2", "columns": 0,
"fieldtype": "Column Break", "fieldname": "column_break_2",
"hidden": 0, "fieldtype": "Column Break",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 0, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 0,
"length": 0, "in_standard_filter": 0,
"no_copy": 0, "length": 0,
"permlevel": 0, "no_copy": 0,
"precision": "", "permlevel": 0,
"print_hide": 0, "precision": "",
"print_hide_if_no_value": 0, "print_hide": 0,
"read_only": 0, "print_hide_if_no_value": 0,
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "expense_type", "columns": 0,
"fieldtype": "Link", "fieldname": "expense_type",
"hidden": 0, "fieldtype": "Link",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 1, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 1,
"label": "Expense Claim Type", "in_standard_filter": 0,
"length": 0, "label": "Expense Claim Type",
"no_copy": 0, "length": 0,
"oldfieldname": "expense_type", "no_copy": 0,
"oldfieldtype": "Link", "oldfieldname": "expense_type",
"options": "Expense Claim Type", "oldfieldtype": "Link",
"permlevel": 0, "options": "Expense Claim Type",
"print_hide": 0, "permlevel": 0,
"print_hide_if_no_value": 0, "print_hide": 0,
"print_width": "150px", "print_hide_if_no_value": 0,
"read_only": 0, "print_width": "150px",
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 1, "report_hide": 0,
"search_index": 0, "reqd": 1,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0, "unique": 0,
"width": "150px" "width": "150px"
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"depends_on": "expense_type", "columns": 0,
"fieldname": "default_account", "depends_on": "expense_type",
"fieldtype": "Link", "fieldname": "default_account",
"hidden": 1, "fieldtype": "Link",
"ignore_user_permissions": 0, "hidden": 1,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 0, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 0,
"label": "Default Account", "in_standard_filter": 0,
"length": 0, "label": "Default Account",
"no_copy": 0, "length": 0,
"options": "Account", "no_copy": 0,
"permlevel": 0, "options": "Account",
"precision": "", "permlevel": 0,
"print_hide": 0, "precision": "",
"print_hide_if_no_value": 0, "print_hide": 0,
"read_only": 1, "print_hide_if_no_value": 0,
"remember_last_selected_value": 0, "read_only": 1,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "section_break_4", "columns": 0,
"fieldtype": "Section Break", "fieldname": "section_break_4",
"hidden": 0, "fieldtype": "Section Break",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 0, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 0,
"length": 0, "in_standard_filter": 0,
"no_copy": 0, "length": 0,
"permlevel": 0, "no_copy": 0,
"precision": "", "permlevel": 0,
"print_hide": 0, "precision": "",
"print_hide_if_no_value": 0, "print_hide": 0,
"read_only": 0, "print_hide_if_no_value": 0,
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fetch_from": "expense_type.description", "columns": 0,
"fieldname": "description", "fetch_from": "",
"fieldtype": "Text Editor", "fieldname": "description",
"hidden": 0, "fieldtype": "Text Editor",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 1, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 1,
"label": "Description", "in_standard_filter": 0,
"length": 0, "label": "Description",
"no_copy": 0, "length": 0,
"oldfieldname": "description", "no_copy": 0,
"oldfieldtype": "Small Text", "oldfieldname": "description",
"options": "", "oldfieldtype": "Small Text",
"permlevel": 0, "options": "",
"print_hide": 0, "permlevel": 0,
"print_hide_if_no_value": 0, "print_hide": 0,
"print_width": "300px", "print_hide_if_no_value": 0,
"read_only": 0, "print_width": "300px",
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0, "unique": 0,
"width": "300px" "width": "300px"
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "section_break_6", "columns": 0,
"fieldtype": "Section Break", "fieldname": "section_break_6",
"hidden": 0, "fieldtype": "Section Break",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 0, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 0,
"length": 0, "in_standard_filter": 0,
"no_copy": 0, "length": 0,
"permlevel": 0, "no_copy": 0,
"precision": "", "permlevel": 0,
"print_hide": 0, "precision": "",
"print_hide_if_no_value": 0, "print_hide": 0,
"read_only": 0, "print_hide_if_no_value": 0,
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "claim_amount", "columns": 0,
"fieldtype": "Currency", "fieldname": "claim_amount",
"hidden": 0, "fieldtype": "Currency",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 1, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 1,
"label": "Claim Amount", "in_standard_filter": 0,
"length": 0, "label": "Claim Amount",
"no_copy": 0, "length": 0,
"oldfieldname": "claim_amount", "no_copy": 0,
"oldfieldtype": "Currency", "oldfieldname": "claim_amount",
"options": "Company:company:default_currency", "oldfieldtype": "Currency",
"permlevel": 0, "options": "Company:company:default_currency",
"print_hide": 0, "permlevel": 0,
"print_hide_if_no_value": 0, "print_hide": 0,
"print_width": "150px", "print_hide_if_no_value": 0,
"read_only": 0, "print_width": "150px",
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 1, "report_hide": 0,
"search_index": 0, "reqd": 1,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0, "unique": 0,
"width": "150px" "width": "150px"
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "column_break_8", "columns": 0,
"fieldtype": "Column Break", "fieldname": "column_break_8",
"hidden": 0, "fieldtype": "Column Break",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 0, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 0,
"length": 0, "in_standard_filter": 0,
"no_copy": 0, "length": 0,
"permlevel": 0, "no_copy": 0,
"precision": "", "permlevel": 0,
"print_hide": 0, "precision": "",
"print_hide_if_no_value": 0, "print_hide": 0,
"read_only": 0, "print_hide_if_no_value": 0,
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_in_quick_entry": 0,
"bold": 0, "allow_on_submit": 0,
"collapsible": 0, "bold": 0,
"columns": 0, "collapsible": 0,
"fieldname": "sanctioned_amount", "columns": 0,
"fieldtype": "Currency", "fieldname": "sanctioned_amount",
"hidden": 0, "fieldtype": "Currency",
"ignore_user_permissions": 0, "hidden": 0,
"ignore_xss_filter": 0, "ignore_user_permissions": 0,
"in_filter": 0, "ignore_xss_filter": 0,
"in_global_search": 0, "in_filter": 0,
"in_list_view": 1, "in_global_search": 0,
"in_standard_filter": 0, "in_list_view": 1,
"label": "Sanctioned Amount", "in_standard_filter": 0,
"length": 0, "label": "Sanctioned Amount",
"no_copy": 1, "length": 0,
"oldfieldname": "sanctioned_amount", "no_copy": 1,
"oldfieldtype": "Currency", "oldfieldname": "sanctioned_amount",
"options": "Company:company:default_currency", "oldfieldtype": "Currency",
"permlevel": 0, "options": "Company:company:default_currency",
"print_hide": 0, "permlevel": 0,
"print_hide_if_no_value": 0, "print_hide": 0,
"print_width": "150px", "print_hide_if_no_value": 0,
"read_only": 0, "print_width": "150px",
"remember_last_selected_value": 0, "read_only": 0,
"report_hide": 0, "remember_last_selected_value": 0,
"reqd": 0, "report_hide": 0,
"search_index": 0, "reqd": 0,
"set_only_once": 0, "search_index": 0,
"set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0, "unique": 0,
"width": "150px" "width": "150px"
} }
], ],
"has_web_view": 0, "has_web_view": 0,
"hide_heading": 0, "hide_heading": 0,
"hide_toolbar": 0, "hide_toolbar": 0,
"idx": 1, "idx": 1,
"image_view": 0, "image_view": 0,
"in_create": 0, "in_create": 0,
"is_submittable": 0, "is_submittable": 0,
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-05-16 22:42:56.727863", "modified": "2019-02-24 08:41:36.122565",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Expense Claim Detail", "name": "Expense Claim Detail",
"owner": "harshada@webnotestech.com", "owner": "harshada@webnotestech.com",
"permissions": [], "permissions": [],
"quick_entry": 0, "quick_entry": 0,
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"show_name_in_global_search": 0, "show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"track_changes": 0, "track_changes": 0,
"track_seen": 0 "track_seen": 0,
"track_views": 0
} }

View File

@ -708,8 +708,11 @@ def get_children(doctype, parent=None, is_root=False, **filters):
def get_boms_in_bottom_up_order(bom_no=None): def get_boms_in_bottom_up_order(bom_no=None):
def _get_parent(bom_no): def _get_parent(bom_no):
return frappe.db.sql_list("""select distinct parent from `tabBOM Item` return frappe.db.sql_list("""
where bom_no = %s and docstatus=1 and parenttype='BOM'""", bom_no) select distinct bom_item.parent from `tabBOM Item` bom_item
where bom_item.bom_no = %s and bom_item.docstatus=1 and bom_item.parenttype='BOM'
and exists(select bom.name from `tabBOM` bom where bom.name=bom_item.parent and bom.is_active=1)
""", bom_no)
count = 0 count = 0
bom_list = [] bom_list = []
@ -717,9 +720,10 @@ def get_boms_in_bottom_up_order(bom_no=None):
bom_list.append(bom_no) bom_list.append(bom_no)
else: else:
# get all leaf BOMs # get all leaf BOMs
bom_list = frappe.db.sql_list("""select name from `tabBOM` bom where docstatus=1 bom_list = frappe.db.sql_list("""select name from `tabBOM` bom
and not exists(select bom_no from `tabBOM Item` where docstatus=1 and is_active=1
where parent=bom.name and ifnull(bom_no, '')!='')""") and not exists(select bom_no from `tabBOM Item`
where parent=bom.name and ifnull(bom_no, '')!='')""")
while(count < len(bom_list)): while(count < len(bom_list)):
for child_bom in _get_parent(bom_list[count]): for child_bom in _get_parent(bom_list[count]):

View File

@ -78,6 +78,39 @@
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "operation",
"fieldtype": "Link",
"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": "Item operation",
"length": 0,
"no_copy": 0,
"options": "Operation",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0, "allow_in_quick_entry": 0,
@ -893,6 +926,38 @@
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_alternative_item",
"fieldtype": "Check",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Alternative Item",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0, "allow_in_quick_entry": 0,
@ -958,71 +1023,6 @@
"set_only_once": 0, "set_only_once": 0,
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "operation",
"fieldtype": "Link",
"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": "Item operation",
"length": 0,
"no_copy": 0,
"options": "Operation",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_alternative_item",
"fieldtype": "Check",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Alternative Item",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "has_web_view": 0,
@ -1035,7 +1035,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-11-23 15:05:55.187136", "modified": "2019-02-21 19:19:54.872459",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM Item", "name": "BOM Item",
@ -1050,4 +1050,4 @@
"track_changes": 0, "track_changes": 0,
"track_seen": 0, "track_seen": 0,
"track_views": 0 "track_views": 0
} }

View File

@ -32,10 +32,10 @@
{%- endmacro -%} {%- endmacro -%}
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<p:FatturaElettronica xmlns:ds="http://www.w3.org/2000/09/xmldsig#" <p:FatturaElettronica xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:p="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" xmlns:p="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
versione="{{ doc.transmission_format_code }}" versione="{{ doc.transmission_format_code }}"
xsi:schemaLocation="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2 http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.2/Schema_del_file_xml_FatturaPA_versione_1.2.xsd"> xsi:schemaLocation="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2 http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.2/Schema_del_file_xml_FatturaPA_versione_1.2.xsd">
<FatturaElettronicaHeader> <FatturaElettronicaHeader>
<DatiTrasmissione> <DatiTrasmissione>
@ -160,7 +160,7 @@
<CodiceTipo>CODICE</CodiceTipo> <CodiceTipo>CODICE</CodiceTipo>
<CodiceValore>{{ item.item_code }}</CodiceValore> <CodiceValore>{{ item.item_code }}</CodiceValore>
</CodiceArticolo> </CodiceArticolo>
<Descrizione>{{ item.description or item.item_name }}</Descrizione> <Descrizione>{{ html2text(item.description) or item.item_name }}</Descrizione>
<Quantita>{{ format_float(item.qty) }}</Quantita> <Quantita>{{ format_float(item.qty) }}</Quantita>
<UnitaMisura>{{ item.stock_uom }}</UnitaMisura> <UnitaMisura>{{ item.stock_uom }}</UnitaMisura>
<PrezzoUnitario>{{ format_float(item.price_list_rate or item.rate) }}</PrezzoUnitario> <PrezzoUnitario>{{ format_float(item.price_list_rate or item.rate) }}</PrezzoUnitario>

View File

@ -191,6 +191,13 @@ def sales_invoice_validate(doc):
else: else:
validate_address(doc.company_address, "Company") validate_address(doc.company_address, "Company")
company_fiscal_regime = frappe.get_cached_value("Company", doc.company, 'fiscal_regime')
if not company_fiscal_regime:
frappe.throw(_("Fiscal Regime is mandatory, kindly set the fiscal regime in the company {0}")
.format(doc.company))
else:
doc.company_fiscal_regime = company_fiscal_regime
if not doc.company_tax_id and not doc.company_fiscal_code: if not doc.company_tax_id and not doc.company_fiscal_code:
frappe.throw(_("Please set either the Tax ID or Fiscal Code on Company '%s'" % doc.company), title=_("E-Invoicing Information Missing")) frappe.throw(_("Please set either the Tax ID or Fiscal Code on Company '%s'" % doc.company), title=_("E-Invoicing Information Missing"))
@ -220,6 +227,10 @@ def sales_invoice_validate(doc):
frappe.throw(_("Row {0}: Please set at Tax Exemption Reason in Sales Taxes and Charges".format(row.idx)), frappe.throw(_("Row {0}: Please set at Tax Exemption Reason in Sales Taxes and Charges".format(row.idx)),
title=_("E-Invoicing Information Missing")) title=_("E-Invoicing Information Missing"))
for schedule in doc.payment_schedule:
if schedule.mode_of_payment and not schedule.mode_of_payment_code:
schedule.mode_of_payment_code = frappe.get_cached_value('Mode of Payment',
schedule.mode_of_payment, 'mode_of_payment_code')
#Ensure payment details are valid for e-invoice. #Ensure payment details are valid for e-invoice.
def sales_invoice_on_submit(doc, method): def sales_invoice_on_submit(doc, method):
@ -246,6 +257,7 @@ def prepare_and_attach_invoice(doc):
invoice = prepare_invoice(doc, progressive_number) invoice = prepare_invoice(doc, progressive_number)
invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True) invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True)
invoice_xml = invoice_xml.replace("&", "&amp;")
xml_filename = progressive_name + ".xml" xml_filename = progressive_name + ".xml"
@ -277,7 +289,7 @@ def get_e_invoice_attachments(invoice):
company_tax_id = invoice.company_tax_id if invoice.company_tax_id.startswith("IT") else "IT" + invoice.company_tax_id company_tax_id = invoice.company_tax_id if invoice.company_tax_id.startswith("IT") else "IT" + invoice.company_tax_id
for attachment in attachments: for attachment in attachments:
if attachment.file_name.startswith(company_tax_id) and attachment.file_name.endswith(".xml"): if attachment.file_name and attachment.file_name.startswith(company_tax_id) and attachment.file_name.endswith(".xml"):
out.append(attachment) out.append(attachment)
return out return out

View File

@ -33,7 +33,8 @@ frappe.query_reports["Sales Person-wise Transaction Summary"] = {
label: __("Company"), label: __("Company"),
fieldtype: "Link", fieldtype: "Link",
options: "Company", options: "Company",
default: frappe.defaults.get_user_default("Company") default: frappe.defaults.get_user_default("Company"),
reqd: 1
}, },
{ {
fieldname:"item_group", fieldname:"item_group",

View File

@ -15,7 +15,7 @@ def execute(filters=None):
item_details = get_item_details() item_details = get_item_details()
data = [] data = []
company_currency = get_company_currency(filters["company"]) company_currency = get_company_currency(filters.get("company"))
for d in entries: for d in entries:
if d.stock_qty > 0 or filters.get('show_return_entries', 0): if d.stock_qty > 0 or filters.get('show_return_entries', 0):