Name: [MISC][15.0] to_hr_expense: rename field as odoo have the same but different type

State: Killed finished in 227m

PR State: merged

PR Author: Nguyễn Đại Dương

PR Author Email: daiduongnguyen2709@gmail.com

PR: #10109

Committer: duongnguyen-viindoo

Committer Email: daiduongnguyen2709@gmail.com

Commit: dc97e8fa0db111ad269bb5b811a116ef5da33cbe

Description:

                                            [MISC] to_hr_expense: rename field as odoo have the same but different
type

-New PR merge upstream from v15 https://github.com/Viindoo/odoo/pull/833
with latest odoo commit 230e5beba518c7bfdaedbf4587e25e20c490d4e8 has add
a field call 'expense_sheet_id' (one2many) in module sale_expense, we
have this field but with type is many2one.
-So there are a few cases here:

Case 1: Customers using odoo 15 and have latest code from odoo. If they
buy and install to_hr_expense, expense_sheet_id will be changed to
many2one, expense_sheet_id one2many field will no longer exist -> this
is really bad because it will definitely cause errors.

Case 2: The customer has purchased the to_hr_expense module without the
latest code from odoo 15, the customer's server (not yet installed
sale_expense) updates the latest code from odoo 15, then install the
sale_expense field, the expense_sheet_id field is still only many2one
defined by the to_hr_expense module (tested twice but still dont get it
why it still many2one, well never mind)

==>>>>> With both 2 cases, this commit will always cover: we change
'expense_sheet_id' to 'viin_expense_sheet_id' (just like we did when
upgrade to 16) , and of course change the related logic, add migration
script to change the field name (change in ir_model_fields table and
rename column).
***NOTE:
- This commit also remove some redundant code and when forward it to
v16/master + only change the code which has been removed in the init
file (the pre_init_hook)
-Only notify the customer to get the latest and upgrade module and they
will good to go.
                                            

Branch: 15.0

Instance ID: 0

Age:

Up-time: