Skip to content

Commit

Permalink
feat(Purchase Invoice): add link to E Invoice Inport
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Sep 15, 2024
1 parent 508152b commit f084886
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
16 changes: 16 additions & 0 deletions eu_einvoice/custom_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from .utils import identity as _


def get_custom_fields():
return {
"Purchase Invoice": [
{
"fieldname": "e_invoice_import",
"label": _("E Invoice Import"),
"insert_after": "bill_no",
"fieldtype": "Link",
"options": "E Invoice Import",
"read_only": 1,
}
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,13 @@
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-09-09 12:08:08.252121",
"links": [
{
"link_doctype": "Purchase Invoice",
"link_fieldname": "e_invoice_import"
}
],
"modified": "2024-09-15 11:36:46.090400",
"modified_by": "Administrator",
"module": "European e-Invoice",
"name": "E Invoice Import",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def post_process(source, target: "PurchaseInvoice"):
"E Invoice Import": {
"doctype": "Purchase Invoice",
"field_map": {
# TODO: add back-link to Purchase Invoice
"name": "e_invoice_import",
"supplier": "supplier",
"company": "company",
"id": "bill_no",
Expand Down
2 changes: 1 addition & 1 deletion eu_einvoice/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
# ------------

# before_install = "eu_einvoice.install.before_install"
# after_install = "eu_einvoice.install.after_install"
after_install = "eu_einvoice.install.after_install"

# Uninstallation
# ------------
Expand Down
7 changes: 7 additions & 0 deletions eu_einvoice/install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields

from .custom_fields import get_custom_fields


def after_install():
create_custom_fields(get_custom_fields())
3 changes: 2 additions & 1 deletion eu_einvoice/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations

[post_model_sync]
# Patches added in this section will be executed after doctypes are migrated
# Patches added in this section will be executed after doctypes are migrated
execute:from eu_einvoice.install import after_install; after_install() # 3
3 changes: 3 additions & 0 deletions eu_einvoice/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def identity(value):
"""Used for dummy translation"""
return value

0 comments on commit f084886

Please sign in to comment.