Skip to content

[ADD] viin_brand_base, viin_brand_crm: add new module#1

Merged
leotranviindoo merged 10 commits into
Viindoo:13.0from
0xhieula:13.0
Sep 13, 2020
Merged

[ADD] viin_brand_base, viin_brand_crm: add new module#1
leotranviindoo merged 10 commits into
Viindoo:13.0from
0xhieula:13.0

Conversation

@0xhieula

@0xhieula 0xhieula commented Sep 9, 2020

Copy link
Copy Markdown
Contributor

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).

Comment on lines +2 to +3
'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",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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é

Comment thread viin_brand_account/views/menu.xml Outdated
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- viin_brand_ -->
<menuitem name="Invoicing"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chỉ thay đổi lại thông tin web_icon, không ghi đè lại name

Suggested change
<menuitem name="Invoicing"
<menuitem

Comment thread viin_brand_contacts/__init__.py Outdated
module_icon.write({'icon' : '/viin_brand_contacts/static/description/icon.png'})
module_icon._get_icon_image()

def uninstall_brand_icon(cr, registry):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vâng ạ, bọn em sẽ xử lý phần viin_brand_base bên #3

@0xhieula

Copy link
Copy Markdown
Contributor Author

@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'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@param icon_path: file icon default, default: static/description/icon.png
@param icon_path: default: static/description/icon.png

Comment thread viin_brand_base/models/viin_brand_base.py Outdated
Comment thread viin_brand_base/models/viin_brand_base.py Outdated
@leotranviindoo

Copy link
Copy Markdown
Contributor

@Cinereouss anh có comment cho method modify_module_icon chú làm tương tự với modify_menu_icon nhé. Về cơ bản thì anh đồng ý với ý tưởng và cách đóng gói phương thức của chú. Có điều sao module base không gọi function từ xml giống module CRM mà vẫn viết post_init_hook? Ngoài ra file update_icon.xml nên đưa vào thư mục data thay vì thư mục views.

CC @manhtu5796 @thongthele

@0xhieula

Copy link
Copy Markdown
Contributor Author

@Cinereouss anh có comment cho method modify_module_icon chú làm tương tự với modify_menu_icon nhé. Về cơ bản thì anh đồng ý với ý tưởng và cách đóng gói phương thức của chú. Có điều sao module base không gọi function từ xml giống module CRM mà vẫn viết post_init_hook? Ngoài ra file update_icon.xml nên đưa vào thư mục data thay vì thư mục views.

CC @manhtu5796 @thongthele

Vâng anh, em rõ rồi.

Comment thread viin_brand_base/__init__.py Outdated
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')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@param origin_module_name: module name needed to replace icon
@param origin_module_name: module name needed to replace menu app icon

@leotranviindoo leotranviindoo changed the title [IMP] Update Viin Brand icon [ADD] viin_brand_base, viin_brand_crm: add new module Sep 13, 2020
@leotranviindoo
leotranviindoo merged commit a21f116 into Viindoo:13.0 Sep 13, 2020
@leotranviindoo

Copy link
Copy Markdown
Contributor

@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.

SonCrits added a commit to SonCrits/branding_public that referenced this pull request Jul 24, 2026
…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.
davidtranhp pushed a commit that referenced this pull request Jul 25, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants