File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
openupgrade_scripts/scripts/account/17.0.1.2 Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,26 @@ def _pre_create_early_pay_discount_computation(env):
195195 )
196196
197197
198+ def _pre_account_move_line_invoice_date_computation (env ):
199+ """Avoid triggering the computed method"""
200+ openupgrade .logged_query (
201+ env .cr ,
202+ """
203+ ALTER TABLE account_move_line
204+ ADD COLUMN IF NOT EXISTS invoice_date DATE;
205+ """ ,
206+ )
207+ openupgrade .logged_query (
208+ env .cr ,
209+ """
210+ UPDATE account_move_line aml
211+ SET invoice_date = am.invoice_date
212+ FROM account_move am
213+ WHERE am.invoice_date IS NOT NULL AND aml.move_id = am.id;
214+ """ ,
215+ )
216+
217+
198218def _decouple_obsolete_tables (env ):
199219 """
200220 Remove all foreign keys held by and pointed to template tables
@@ -280,6 +300,7 @@ def migrate(env, version):
280300 _account_report_update_figure_type (env )
281301 _account_tax_repartition_line_merge_repartition_lines_m2o (env )
282302 _pre_create_early_pay_discount_computation (env )
303+ _pre_account_move_line_invoice_date_computation (env )
283304 _decouple_obsolete_tables (env )
284305 _pre_create_account_report_active (env )
285306 _remove_obsolete_constraints (env )
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ account / account.move.line / display_type (selection) : select
167167# NOTHING TO DO: new feature "Discount allocation" https://github.com/odoo/odoo/pull/133286
168168
169169account / account.move.line / invoice_date (date) : NEW isrelated: related, stored
170- # NOTHING TO DO: ORM resolves by SQL this filling being a direct related field with 1 level depth .
170+ # DONE: pre-migration: Pre-create the column for avoiding triggering the compute and transfer data from account moves to all the account move lines .
171171
172172account / account.move.line / tax_audit (char) : DEL
173173# NOTHING TO DO: deprecated
You can’t perform that action at this time.
0 commit comments