[ADD] viin_brand_base, viin_brand_crm: add new module#1
Conversation
| 'name': "Viindoo Branding TVTMA HR Payroll (Community Edition)", | ||
| 'name_vi_VN': "Ung dụng TVTMA HR Payroll (Community Edition) với thương hiệu Viindoo", |
There was a problem hiding this comment.
Repo này chỉ thay đổi icon cho bản CE của Odoo thôi, đối với các module của công ty thì thay đổi icon trực tiếp, anh thấy em đã làm rồi, nên em xoá module này đi nhé
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <odoo> | ||
| <!-- viin_brand_ --> | ||
| <menuitem name="Invoicing" |
There was a problem hiding this comment.
Chỉ thay đổi lại thông tin web_icon, không ghi đè lại name
| <menuitem name="Invoicing" | |
| <menuitem |
| module_icon.write({'icon' : '/viin_brand_contacts/static/description/icon.png'}) | ||
| module_icon._get_icon_image() | ||
|
|
||
| def uninstall_brand_icon(cr, registry): |
There was a problem hiding this comment.
2 phương thức này có thể phối hợp với @manhtu5796 để làm 1 module viin_brand_base và nhét mấy phương thức chung này vào đấy để tái sử dụng. CC @thongthele
There was a problem hiding this comment.
vâng ạ, bọn em sẽ xử lý phần viin_brand_base bên #3
|
@leotranviindoo anh ơi, em push thay đổi ở nhánh này. |
| _description = 'Viindoo Brand Base model' | ||
|
|
||
|
|
||
| def modify_module_icon(self, module_name, module_brand = '', icon_path = 'static/description/icon.png'): |
There was a problem hiding this comment.
| def modify_module_icon(self, module_name, module_brand = '', icon_path = 'static/description/icon.png'): | |
| def update_module_icon(self, origin_module_name, brand_module_name='', icon_path = 'static/description/icon.png'): |
|
|
||
| def modify_module_icon(self, module_name, module_brand = '', icon_path = 'static/description/icon.png'): | ||
| ''' | ||
| Change module icon |
There was a problem hiding this comment.
| Change module icon | |
| This method used to set origin module's icon by brand module's icon and restore after brand module uninstalled |
| ''' | ||
| Change module icon | ||
|
|
||
| @param module_name: module name want to restore icon |
There was a problem hiding this comment.
| @param module_name: module name want to restore icon | |
| @param origin_module_name: module name needed to replace icon |
| Change module icon | ||
|
|
||
| @param module_name: module name want to restore icon | ||
| @param module_brand: module name contains icon file and handle, |
There was a problem hiding this comment.
| @param module_brand: module name contains icon file and handle, | |
| @param brand_module_name: origin module name replaced by brand module name. | |
| If it is not passed then it means the method is used to restore module icon to origin |
|
|
||
| @param module_name: module name want to restore icon | ||
| @param module_brand: module name contains icon file and handle, | ||
| @param icon_path: file icon default, default: static/description/icon.png |
There was a problem hiding this comment.
| @param icon_path: file icon default, default: static/description/icon.png | |
| @param icon_path: default: static/description/icon.png |
|
@Cinereouss anh có comment cho method CC @manhtu5796 @thongthele |
Vâng anh, em rõ rồi. |
| def uninstall_brand_icon(cr, registry): | ||
| env = api.Environment(cr, SUPERUSER_ID, {}) | ||
| env['viin.brand.base'].modify_menu_icon('base', 'base.menu_administration', icon_path='static/description/settings.png') | ||
| env['viin.brand.base'].modify_menu_icon('base', 'base.menu_management', icon_path='static/description/modules.png') |
There was a problem hiding this comment.
Chưa đổi lại tên hàm ở đây à? Cả bên CRM nữa
|
|
||
| def update_menu_icon(self, origin_module_name, menu_xml_id, icon_path = 'static/description/icon.png'): | ||
| ''' | ||
| This method used to set origin menu module's icon by brand menu module's icon and restore after brand module uninstalled |
There was a problem hiding this comment.
| This method used to set origin menu module's icon by brand menu module's icon and restore after brand module uninstalled | |
| This method used to set origin menu app icon by brand menu icon and restore after brand module uninstalled |
| ''' | ||
| This method used to set origin menu module's icon by brand menu module's icon and restore after brand module uninstalled | ||
|
|
||
| @param origin_module_name: module name needed to replace icon |
There was a problem hiding this comment.
| @param origin_module_name: module name needed to replace icon | |
| @param origin_module_name: module name needed to replace menu app icon |
|
@Cinereouss @manhtu5796 anh merge PR này vào 13.0 rồi nhé. 2 chú rebase và làm tiếp nhé. Ngoài ra nhớ lưu ý đến technical convention, anh có sửa lại tiêu đề của PR cho đúng quy ước. |
…om promo The eCommerce "Powered by" footer stated "The Viindoo#1 Open Source eCommerce Software" (vi_VN: "... mã nguồn mở số 1"), an unverifiable superiority ranking. Vietnam's advertising law forbids "Viindoo#1"/"best" style claims without supporting evidence and penalises them heavily, so remove the ranking wording from both the template source and the Vietnamese translation. - views/templates.xml: promo label "The Viindoo#1 Open Source eCommerce Software" -> "Open Source eCommerce Software"; add a comment at the label noting the VN advertising-law constraint. - i18n/vi_VN.po and .pot: realign msgid to the new source string; msgstr "... mã nguồn mở số 1" -> "... mã nguồn mở". - bump module version 0.1 -> 0.2 so existing databases pick up the updated view and translation on upgrade.
The eCommerce "Powered by" footer stated "The #1 Open Source eCommerce Software" (vi_VN: "... mã nguồn mở số 1"), an unverifiable superiority ranking. Vietnam's advertising law forbids "#1"/"best" style claims without supporting evidence and penalises them heavily, so remove the ranking wording from both the template source and the Vietnamese translation. - views/templates.xml: promo label "The #1 Open Source eCommerce Software" -> "Open Source eCommerce Software"; add a comment at the label noting the VN advertising-law constraint. - i18n/vi_VN.po and .pot: realign msgid to the new source string; msgstr "... mã nguồn mở số 1" -> "... mã nguồn mở". - bump module version 0.1 -> 0.2 so existing databases pick up the updated view and translation on upgrade.
Mô tả vấn đề
Tạm gọi module cần update là A, module update brand của mình là brand_A.
Trong trường hợp sử dụng init hook để update icon module. Module brand của mình chỉ chạy 1 lần duy nhất khi được install. Vì vậy, trường hợp A update hoặc các module mà A depends được update (sự kiện này sẽ kéo theo việc module brand_A bị update một các thụ động do brand_A depends A) thì các thay đổi về icon sẽ bị đè (do A set icon bằng file *.xml).
Gỉải pháp và các xử lý
Không sử dụng init_hook nữa, thay vào đó sẽ gọi trực tiếp hàm modify từ module viin_brand_base từ file *.xml. Việc này đảm bảo module luôn chạy update icon cho module A ngay cả khi update chủ động hay bị động.
[BUG] Vấn đề phát sinh
Mudule CRM của odoo sẽ gặp lỗi ở lần uninstall thứ 2 (Xác nhận lỗi của Odoo, không liên quan tới module phía mình).