Merge pull request #21920 from marination/import-italian-invoice

chore: Added Italian Import Supplier Invoice to Menu
This commit is contained in:
Deepesh Garg
2020-05-28 12:33:12 +05:30
committed by GitHub
5 changed files with 54 additions and 4 deletions

View File

@@ -1,8 +1,9 @@
from __future__ import unicode_literals
import frappe
from frappe import _
def get_data():
return [
config = [
{
"label": _("Purchasing"),
"icon": "fa fa-star",
@@ -243,3 +244,21 @@ def get_data():
},
]
regional = {
"label": _("Regional"),
"items": [
{
"type": "doctype",
"name": "Import Supplier Invoice",
"description": _("Import Italian Supplier Invoice."),
"onboard": 1,
}
]
}
countries = frappe.get_all("Company", fields="country")
countries = [country["country"] for country in countries]
if "Italy" in countries:
config.append(regional)
return config

View File

@@ -668,3 +668,4 @@ erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price
erpnext.patches.v12_0.set_serial_no_status #2020-05-21
erpnext.patches.v12_0.update_price_list_currency_in_bom
erpnext.patches.v12_0.update_uom_conversion_factor
erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions

View File

@@ -0,0 +1,12 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.regional.italy.setup import add_permissions
def execute():
countries = frappe.get_all("Company", fields="country")
countries = [country["country"] for country in countries]
if "Italy" in countries:
add_permissions()

View File

@@ -1,5 +1,4 @@
{
"actions": [],
"creation": "2019-10-15 12:33:21.845329",
"doctype": "DocType",
"editable_grid": 1,
@@ -92,8 +91,7 @@
"label": "Upload XML Invoices"
}
],
"links": [],
"modified": "2019-12-10 16:37:26.793398",
"modified": "2020-05-25 21:32:49.064579",
"modified_by": "Administrator",
"module": "Regional",
"name": "Import Supplier Invoice",

View File

@@ -7,11 +7,13 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.permissions import add_permission, update_permission_property
from erpnext.regional.italy import fiscal_regimes, tax_exemption_reasons, mode_of_payment_codes, vat_collectability_options
def setup(company=None, patch=True):
make_custom_fields()
setup_report()
add_permissions()
def make_custom_fields(update=True):
invoice_item_fields = [
@@ -200,3 +202,21 @@ def setup_report():
dict(role='Accounts Manager')
]
)).insert()
def add_permissions():
doctype = 'Import Supplier Invoice'
add_permission(doctype, 'All', 0)
for role in ('Accounts Manager', 'Accounts User','Purchase User', 'Auditor'):
add_permission(doctype, role, 0)
update_permission_property(doctype, role, 0, 'print', 1)
update_permission_property(doctype, role, 0, 'report', 1)
if role in ('Accounts Manager', 'Accounts User'):
update_permission_property(doctype, role, 0, 'write', 1)
update_permission_property(doctype, role, 0, 'create', 1)
update_permission_property(doctype, 'Accounts Manager', 0, 'delete', 1)
add_permission(doctype, 'Accounts Manager', 1)
update_permission_property(doctype, 'Accounts Manager', 1, 'write', 1)
update_permission_property(doctype, 'Accounts Manager', 1, 'create', 1)