Skip to content

[IMP][16.0] website_forum: faq also need BS5 migration#533

Merged
royle-vietnam merged 1 commit intoViindoo:16.0from
daiduongnguyen-odoo:v16_imp_mig_base_not_translate_model_terms
Sep 5, 2023
Merged

[IMP][16.0] website_forum: faq also need BS5 migration#533
royle-vietnam merged 1 commit intoViindoo:16.0from
daiduongnguyen-odoo:v16_imp_mig_base_not_translate_model_terms

Conversation

@daiduongnguyen-odoo
Copy link

@daiduongnguyen-odoo daiduongnguyen-odoo commented Aug 29, 2023

No description provided.

@phamgiang2510
Copy link
Collaborator

@duong77476 bao giờ cái PR này done thì báo a cái nhé, để a chạy migrate :v

@daiduongnguyen-odoo
Copy link
Author

@duong77476 bao giờ cái PR này done thì báo a cái nhé, để a chạy migrate :v

Vâng a, để test chạy xong xem lỗi j không đã ạ, e có test ở local ăn rồi :v
cc @royleviindoo

@daiduongnguyen-odoo
Copy link
Author

@phamgiang2510 Xong rồi anh ơi, a nhớ cài lại thư viện như e note ở đầu mô tả PR anh nha
cc @royleviindoo

@daiduongnguyen-odoo
Copy link
Author

@phamgiang2510 A chạy ra file log với tham số --logfile anh nhé, để có gì còn check var được ạ
cc @royleviindoo

@daiduongnguyen-odoo daiduongnguyen-odoo force-pushed the v16_imp_mig_base_not_translate_model_terms branch 3 times, most recently from db6b2c8 to afbc23b Compare September 4, 2023 03:55
Comment on lines 8 to 17
def _bs5_field_migration(env):
forums = env["forum.forum"].with_context(active_test=False).search([])
for forum in forums:
forum.faq = convert_string_bootstrap_4to5(forum.faq)


@openupgrade.migrate()
def migrate(env, version):
_bs5_field_migration(env)
migrate_translations_to_jsonb(env, [("forum.forum", "faq")])
Copy link
Author

Choose a reason for hiding this comment

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

Em xử lý thêm cho ticket https://viindoo.com/web#id=48829&cids=1&menu_id=777&action=1074&active_id=39&model=helpdesk.ticket&view_type=form . Có lẽ với các trường luu dạng html thì cũng cần phải booostrap migration

@daiduongnguyen-odoo daiduongnguyen-odoo force-pushed the v16_imp_mig_base_not_translate_model_terms branch 2 times, most recently from 013e30f to 4dd4630 Compare September 4, 2023 08:55
@royle-vietnam
Copy link
Collaborator

@duong77476 anh có thay bằng PR #536, em xem có cần PR này nữa không nhé

@daiduongnguyen-odoo
Copy link
Author

@duong77476 anh có thay bằng PR #536, em xem có cần PR này nữa không nhé

Chỉ cần giữ lại commit sau cùng thôi ạ

@royle-vietnam
Copy link
Collaborator

@duong77476 anh có thay bằng PR #536, em xem có cần PR này nữa không nhé

Chỉ cần giữ lại commit sau cùng thôi ạ

@duong77476 vậy revert và squash lại giúp anh nhé

@daiduongnguyen-odoo daiduongnguyen-odoo force-pushed the v16_imp_mig_base_not_translate_model_terms branch 2 times, most recently from 158762b to ffed07c Compare September 5, 2023 02:37
@daiduongnguyen-odoo daiduongnguyen-odoo changed the title [IMP][16.0] base: support translate 'model_terms' type [IMP][16.0] website_forum: faq also need BS5 migration Sep 5, 2023
def _bs5_field_migration(env):
forums = env["forum.forum"].with_context(active_test=False).search([])
for forum in forums:
forum.faq = convert_string_bootstrap_4to5(forum.faq)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@duong77476 có cần làm tổng quát không em? kiểu như tìm tất cả các trường kiểu html, và cho qua hàm convert_string_bootstrap_4to5?

Suggested change
forum.faq = convert_string_bootstrap_4to5(forum.faq)
new_faq = convert_string_bootstrap_4to5(forum.faq)
if forum.faq != new_faq:
forum.faq = new_faq

Copy link
Author

@daiduongnguyen-odoo daiduongnguyen-odoo Sep 5, 2023

Choose a reason for hiding this comment

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

@royleviindoo Nhưng cần lấy giá trị của trường thi có cách nào tổng quát không ạ

Copy link
Collaborator

Choose a reason for hiding this comment

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

@duong77476 anh merge trước, về cơ bản thì anh thấy vẫn cần làm tổng quát để tránh sót
em thử theo hướng như này nhé
xử lý ở end-migration:

  1. select tất cả model, tên field từ bảng ir.model.fieldsstore=True and ttype='html'
  2. sau đó search_read tất cả các model tìm được ở trên, đọc các fields ở trên với domain=[]
  3. convert và write nó nếu có khác biệt về giá trị

Copy link
Author

Choose a reason for hiding this comment

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

@royleviindoo Vâng a, tạm thời e tạo issue ở : #537 xử sau ạ

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.

3 participants