Skip to content

Commit

Permalink
refactor: apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
scdanieli committed Feb 21, 2024
1 parent f63a1a4 commit b47b3bb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ function set_html_data(frm) {

frm.get_field("html_notice").$wrapper.html(html_notice);
frm.get_field("html_help").$wrapper.html(
erpnext_germany.utils.get_business_letter_help()
erpnext_germany.business_letter.get_help_text()
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ def set_content_preview(self):
)

def set_link_title(self):
if self.link_name:
self.link_title = get_title(self.link_document_type, self.link_name)
else:
self.link_title = None
self.link_title = (
get_title(self.link_document_type, self.link_name) if self.link_name else None
)

def get_context(self):
address = frappe.get_doc("Address", self.address) if self.address else None
Expand All @@ -44,16 +43,16 @@ def get_context(self):

def on_submit(self):
self.add_comments(
_(
"submitted Business Letter <a href='/app/business-letter/{0}'><strong>{1}</strong></a>"
).format(self.name, self.subject_preview)
_("submitted Business Letter {0}").format(
f"<a href='/app/business-letter/{self.name}'><strong>{self.subject_preview}</strong></a>"
)
)

def on_cancel(self):
self.add_comments(
_(
"canceled Business Letter <a href='/app/business-letter/{0}'><strong>{1}</strong></a>"
).format(self.name, self.subject_preview)
_("cancelled Business Letter {0}").format(
f"<a href='/app/business-letter/{self.name}'><strong>{self.subject_preview}</strong></a>"
)
)

def add_comments(self, msg):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ frappe.ui.form.on("Business Letter Template", {

function set_html_data(frm) {
frm.get_field("html_help").$wrapper.html(
erpnext_germany.utils.get_business_letter_help()
erpnext_germany.business_letter.get_help_text()
);
}
2 changes: 1 addition & 1 deletion erpnext_germany/public/js/erpnext_germany.bundle.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./erpnext_germany/utils.js";
import "./erpnext_germany/business_letter.js";
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
frappe.provide("erpnext_germany.utils");
frappe.provide("erpnext_germany.business_letter");

erpnext_germany.utils = {
...erpnext_germany.utils,
erpnext_germany.business_letter = {
...erpnext_germany.business_letter,

get_business_letter_help() {
get_help_text() {
return __(
'<div>You can use <a href="https://jinja.palletsprojects.com/en/2.11.x/" target="_blank"><strong>Jinja tags</strong></a> in the Subject and Content fields for dynamic values.<br><br>All address details are available under the <code>address</code> object (e.g., <code>{{ address.city }}</code>), contact details under the <code>contact</code> object (e.g., <code>{{ contact.first_name }}</code>), and any specific information related to the dynamically linked document under the <code>reference</code> object (e.g., <code>{{ reference.some_field }}</code>).<br><br></div>'
);
Expand Down
3 changes: 3 additions & 0 deletions erpnext_germany/translations/de.csv
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ Debit Opening Balance,Soll Anfangsbestand,
Credit Opening Balance,Haben Anfangsbestand,
Debit Closing Balance,Soll Endbestand,
Credit Closing Balance,Haben Endbestand,
submitted Business Letter {0},hat Geschäftsbrief {0} eingereicht,
cancelled Business Letter {0},hat Geschäftsbrief {0} storniert,

0 comments on commit b47b3bb

Please sign in to comment.