-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add barcode option to show text #63
base: main
Are you sure you want to change the base?
Conversation
@dj12djdjs can you please add more information about this pr in description? |
@maharshivpatel I've updated the description with video example |
let's make barcodeShowText boolean and set default as True! we can write patch for existing formats. I believe this is better in long run. Edit: Also thank you for contributing i was going to add this and then completely forgot about it. |
@maharshivpatel I initially tried using a "Check" field, but it wouldn't render. That is why I used a Select field. I tried searching the code base for existing "Check" usage on the panel but couldn't find any. Can you point me in the right direction to get that working? |
@dj12djdjs Select Field is fine just use formatValue to convert Yes/No to true/false. |
@maharshivpatel I've added this logic to convert "Yes" and "No" into bool. But it results in infinite loop. I'm not familiar with the inner workings of this. Do you have any suggestions? formatValue(object, property) {
const from = object[property];
const to = from === "Yes";
return to;
} |
@dj12djdjs you can do something like this:
you also need to change the logic as per true and false boolean instead of "Yes"/"No" |
@maharshivpatel Thank you, it seems to be working. I just need to figure out the patch. Let me know if there is anything else |
i am planning to write utils for patches as it will be quite complicated otherwise. i will share with you if i get time to write utils in few days else i will help you write a patch. if you want to explore just check how ElementStore is used to save elements. There are two places elements and globalStyles that needs to be patched. Elements can also be nested inside if type is Rectangle. |
@maharshivpatel I think I've got the def execute():
for name, print_format in frappe.get_all("Print Format", filters={"print_designer": 1}, fields=["name", "print_designer_settings"], as_list=1):
print_format = frappe.parse_json(print_format)
if print_format and "barcode" in print_format["globalStyles"]:
print_format["globalStyles"]["barcode"]["showBarcodeText"] = True
frappe.set_value("Print Format", name, "print_designer_settings", frappe.as_json(print_format)) |
@dj12djdjs Patch utils are available now. you can read the patch file and check example here . Incase you want i can also write patch 😄 |
@maharshivpatel Awesome! I'll try to get some time this weekend to finish up this PR. |
Probably over the holiday break I'll get a chance to finish this up |
@dj12djdjs awesome, let me know if/whenever you need any help |
@dj12djdjs hey, did you got time to add patches 😅. |
(cherry picked from commit 39cbee4)
Co-authored-by: Maharshi Patel <maharshi.patel988@gmail.com>
9e142f4
to
424a260
Compare
how to adjust the sizes of the barcode? |
add option to show text for non QR barcode types..
Barcode.Show.Text.mp4