Merge pull request #21985 from marination/import-italian-invoice-dev

chore: Added Italian Import Supplier Invoice to Desk
This commit is contained in:
Deepesh Garg 2020-05-28 12:33:53 +05:30 committed by GitHub
commit ab17b07f14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 5 deletions

View File

@ -34,6 +34,11 @@
"hidden": 0,
"label": "Other Reports",
"links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Items To Be Requested\",\n \"name\": \"Items To Be Requested\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase History\",\n \"name\": \"Item-wise Purchase History\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Subcontracted Raw Materials To Be Transferred\",\n \"name\": \"Subcontracted Raw Materials To Be Transferred\",\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Subcontracted Item To Be Received\",\n \"name\": \"Subcontracted Item To Be Received\",\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Quoted Item Comparison\",\n \"name\": \"Quoted Item Comparison\",\n \"onboard\": 1,\n \"reference_doctype\": \"Supplier Quotation\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Material Requests for which Supplier Quotations are not created\",\n \"name\": \"Material Requests for which Supplier Quotations are not created\",\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier Addresses And Contacts\",\n \"name\": \"Address And Contacts\",\n \"reference_doctype\": \"Address\",\n \"route_options\": {\n \"party_type\": \"Supplier\"\n },\n \"type\": \"report\"\n }\n]"
},
{
"hidden": 0,
"label": "Regional",
"links": "[\n {\n \"description\": \"Import Italian Purchase Invoices\",\n \"label\": \"Import Supplier Invoice\",\n \"name\": \"Import Supplier Invoice\",\n \"type\": \"doctype\"\n } \n]"
}
],
"cards_label": "Masters & Reports ",
@ -55,7 +60,7 @@
"idx": 0,
"is_standard": 1,
"label": "Buying",
"modified": "2020-05-27 19:55:22.407528",
"modified": "2020-05-27 22:23:38.529720",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying",

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

@ -694,3 +694,4 @@ execute:frappe.delete_doc("Report", "Department Analytics")
execute:frappe.rename_doc("Desk Page", "Loan Management", "Loan", force=True)
erpnext.patches.v12_0.update_uom_conversion_factor
erpnext.patches.v13_0.delete_old_purchase_reports
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)