From 76cda7a607743005a4224ccd038a723cc69ada9f Mon Sep 17 00:00:00 2001 From: duongnguyen Date: Wed, 5 Jul 2023 10:33:14 +0700 Subject: [PATCH 01/15] [FIX] delete_record_translation: invalid input syntax for type json --- openupgradelib/openupgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openupgradelib/openupgrade.py b/openupgradelib/openupgrade.py index f9b36a2a..7dc76598 100644 --- a/openupgradelib/openupgrade.py +++ b/openupgradelib/openupgrade.py @@ -2688,7 +2688,7 @@ def delete_record_translations(cr, module, xml_ids, field_list=None): columns=", ".join(list_columns), values=", ".join( [ - '\'{{"en_US": {x} -> "en_US"}}\'::jsonb'.format(x=x) + "jsonb_build_object('en_US', {x} -> 'en_US')".format(x=x) for x in list_columns ] ), From 9599992bbe1754537f7808d9f90f04e7417f1c5e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 09:22:16 +0000 Subject: [PATCH 02/15] [UPD] HTML documentation --- docs/.buildinfo | 2 +- docs/.doctrees/environment.pickle | Bin 564480 -> 564480 bytes docs/API.html | 4 ++-- docs/_static/documentation_options.js | 2 +- docs/authors.html | 4 ++-- docs/contributing.html | 4 ++-- docs/genindex.html | 4 ++-- docs/history.html | 4 ++-- docs/index.html | 4 ++-- docs/installation.html | 4 ++-- docs/objects.inv | Bin 1101 -> 1101 bytes docs/py-modindex.html | 4 ++-- docs/readme.html | 4 ++-- docs/search.html | 4 ++-- docs/usage.html | 4 ++-- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/.buildinfo b/docs/.buildinfo index 1a7e4c50..b337ae70 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 8fd5c44bb2799ba3d44f24bb1c5177f4 +config: 9c52dc03989800d879e055f1428abd2e tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/.doctrees/environment.pickle b/docs/.doctrees/environment.pickle index 4ce6ffd6eccd9948d66ea6f696f73d32df4b4d4d..3fed6ce0f59b141eeb9d002bd188513e9a7c59a4 100644 GIT binary patch delta 3524 zcmZ8jdsI}%8Rss$%m={-iq(QEAP9Oe_6>B8qlWtH#qNTAv%MF>;PcsI{K>jA;xt*4TbCcXr+FANPL0-+YhxzHjE< znd;+%tB((E|571~#*7OK!U-)K|! zykt+;sQW$aLR^Kq`z7nRrtW>oI`7&yM5huyXQN}NJ#t7Cb)7R9>_5er?5^lYn*UI5 zus?~8wEYDo*z9H09e+#aY)dSHVYzk3T+od<^&mu!gzh zrwC;at6N15>QRn*o0RHM?ye%mTn5&Vz9SVUH69^VH1H^irk@-kx%9(hi0(}c2&EYv zB!v#;G=CoSqvtwEA`R_88c`0vroTIibl?%BmyeR)&<}WkjANvLHggl#F;cjIH(uSk z8ee>&Rmu@BS$&ry-XirdM|^SBQylSyRWESFi&k%N#1~ZkC!$K5-cr8U?0DNTRCUtt z=fXf*o{q1xe;|ixehP%pObhg7I~fU6IPb&$`Y}16L27(VjI??)yuuD1Cl{r@?gaTk zLfa|wT*7xwlV{Q^_$e{kUo-%_@Mm&Hj+t~|WT!tRH>LSUX9(!Td=xzgwHzk)k*pun zog<$~kNlosY`sJb_O7eI{4bEpavVJ)?5_WW(i5Q&!s0FwmkbFmGDwDee*#umovI9G zE3UZnrkJ;p_Oe1K+kBPWkkKNatn~*+}mX)djJvdp`Z4iI0e$uFuv5(v1N)^`Zylko4h;z)*cbM#iPQFI5N!(UJxT zqSwZt)9indqf)~&qgCg0J!tm;)Z{$z4mXH)-Ov&CS~oc@W8xeSBn)~+^s-WHDUoo} z3wJpb4UBZ;34cOOW`8(V3hrgYo$k!WVI}Ub8EBt;!rPb$?V6ud0B|lEqJsC{izRMHcz7!n>(Q20= zip`%2_)9ochV8&#PB#Bj_M@FikVcnPxc@uJ$$YNKQsPCwq1owL zkzrb|@tmro^*M5Z==pMJ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2%1mV!4j`cy~eb7W7G}#ADbtCp@6XYv+J(#x{rX$&^krNtutdX%bLRYMj{WX}A zi~e0h!>vM>uaPE=oE4;Pi!e;w0*QE!so#QM3(|YFuvCfXmxThSXaW*`O+dmcM8Yo! zNciml$zEEy4YJ~S^K7DbHsNIxPB!6V6D~I4VMB-e+whBU(FNOKPLQ~t{Kg-z7qtfZ zw_Ui=*6pBod{z`pUNrdm@mt2X+aUqXO?8lqq^b^PA?d7xBqTr8!F(i1^+MNP&r6{< z>V9s8adk{HnLx<$R@K@)U;ni zw_D+LEsf=KF^#Y!+Pn+Dt>y)K@HBYaF5z)?m*`NW1F|)bk!k3$E}j0+iiu~p>xc9u ze%b*uFvn*OoK6?bcEVdojyi?#o>PRIxf`-j*tlC%b9J}S4Qj*ba?$cOp*z_IuOfQd zCUz*B;_t&n4^kn#P4Q>yqM7Xi+1iEfRy#~XVfY@vt2dpFWQiCcU8bL3NkK`0&EnkR pR1euP?+f_C>A|s7zs&X4cK@Gt+d^;cDK9NOBGzG-_P|8{{{g3zu}S~{ diff --git a/docs/API.html b/docs/API.html index df48814c..fcd9589e 100644 --- a/docs/API.html +++ b/docs/API.html @@ -4,7 +4,7 @@ - OpenUpgrade API — OpenUpgrade Library 0.1.dev1+gd30497a documentation + OpenUpgrade API — OpenUpgrade Library 0.1.dev1+gb354ed4 documentation - - - - - + + + + + @@ -35,7 +35,7 @@ OpenUpgrade Library
- 0.1.dev1+gfb09131 + 0.1.dev1+gddce67b
@@ -177,7 +177,7 @@
-

OpenUpgrade API

+

OpenUpgrade API

The OpenUpgrade library contains all kinds of helper functions for your pre and post scripts, in OpenUpgrade itself or in the migration scripts of your own module (in either major or minor version upgrades). It can be installed with

@@ -189,10 +189,10 @@

OpenUpgrade API -

General methods

+

General methods

-openupgradelib.openupgrade.add_fields(env, field_spec)
+openupgradelib.openupgrade.add_fields(env, field_spec)

This method adds all the needed stuff for having a new field populated in the DB (SQL column, ir.model.fields entry, ir.model.data entry…).

It’s intended for being run in pre-migration scripts for pre-populating @@ -230,7 +230,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.add_ir_model_fields(cr, columnspec)
+openupgradelib.openupgrade.add_ir_model_fields(cr, columnspec)

Typically, new columns on ir_model_fields need to be added in a very early stage in the upgrade process of the base module, in raw sql as they need to be in place before any model gets initialized. @@ -246,7 +246,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.add_xmlid(cr, module, xmlid, model, res_id, noupdate=False)
+openupgradelib.openupgrade.add_xmlid(cr, module, xmlid, model, res_id, noupdate=False)

Adds an entry in ir_model_data. Typically called in the pre script. One usage example is when an entry has been add in the XML and there is a high probability that the user has already created the entry manually. @@ -259,7 +259,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.check_values_selection_field(cr, table_name, field_name, allowed_values)
+openupgradelib.openupgrade.check_values_selection_field(cr, table_name, field_name, allowed_values)

check if the field selection ‘field_name’ of the table ‘table_name’ has only the values ‘allowed_values’. @@ -273,7 +273,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.chunked(records, single=True)
+openupgradelib.openupgrade.chunked(records, single=True)

Memory and performance friendly method to iterate over a potentially large number of records. Yields either a whole chunk or a single record at the time. Don’t nest calls to this method.

@@ -281,13 +281,13 @@

OpenUpgrade API
-openupgradelib.openupgrade.column_exists(cr, table, column)
+openupgradelib.openupgrade.column_exists(cr, table, column)

Check whether a certain column exists

-openupgradelib.openupgrade.convert_field_to_html(cr, table, field_name, html_field_name, verbose=True)
+openupgradelib.openupgrade.convert_field_to_html(cr, table, field_name, html_field_name, verbose=True)

Convert field value to HTML value.

New in version 7.0.

@@ -296,7 +296,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.convert_to_company_dependent(env, model_name, origin_field_name, destination_field_name, model_table_name=None)
+openupgradelib.openupgrade.convert_to_company_dependent(env, model_name, origin_field_name, destination_field_name, model_table_name=None)

For each row in a given table, the value of a given field is set in another ‘company dependant’ field of the same table. Useful in cases when from one version to another one, some field in a @@ -322,7 +322,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.copy_columns(cr, column_spec)
+openupgradelib.openupgrade.copy_columns(cr, column_spec)

Copy table columns. Typically called in the pre script.

Parameters:
@@ -341,7 +341,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.copy_fields_multilang(cr, destination_model, destination_table, destination_columns, relation_column, source_model=None, source_table=None, source_columns=None, translations_only=False)
+openupgradelib.openupgrade.copy_fields_multilang(cr, destination_model, destination_table, destination_columns, relation_column, source_model=None, source_table=None, source_columns=None, translations_only=False)

Copy field contents including translations.

Parameters:
@@ -375,7 +375,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.cow_templates_mark_if_equal_to_upstream(cr, mark_colname=None)
+openupgradelib.openupgrade.cow_templates_mark_if_equal_to_upstream(cr, mark_colname=None)

Record which COW’d templates are equal to their upstream equivalents.

This is meant to be executed in a pre-migration script.

This only makes sense if:

@@ -389,7 +389,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.cow_templates_replicate_upstream(cr, mark_colname=None)
+openupgradelib.openupgrade.cow_templates_replicate_upstream(cr, mark_colname=None)

Reset COW’d templates to their upstream equivalents.

This is meant to be executed in an end-migration script.

This only makes sense if:

@@ -403,7 +403,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.date_to_datetime_tz(cr, table_name, user_field_name, date_field_name, datetime_field_name)
+openupgradelib.openupgrade.date_to_datetime_tz(cr, table_name, user_field_name, date_field_name, datetime_field_name)

Take the related user’s timezone into account when converting date field to datetime in a given table. This function must be call in post migration script.

@@ -418,7 +418,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.deactivate_workflow_transitions(cr, model, transitions=None)
+openupgradelib.openupgrade.deactivate_workflow_transitions(cr, model, transitions=None)

Disable workflow transitions for workflows on a given model. This can be necessary for automatic workflow transitions when writing to an object via the ORM in the post migration step. @@ -438,7 +438,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.delete_model_workflow(cr, model, drop_indexes=False)
+openupgradelib.openupgrade.delete_model_workflow(cr, model, drop_indexes=False)

Forcefully remove active workflows for obsolete models, to prevent foreign key issues when the orm deletes the model.

@@ -456,7 +456,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.delete_record_translations(cr, module, xml_ids, field_list=None)
+openupgradelib.openupgrade.delete_record_translations(cr, module, xml_ids, field_list=None)

Cleanup translations of specific records in a module.

Parameters:
@@ -471,7 +471,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.delete_records_safely_by_xml_id(env, xml_ids, delete_childs=False)
+openupgradelib.openupgrade.delete_records_safely_by_xml_id(env, xml_ids, delete_childs=False)

This removes in the safest possible way the records whose XML-IDs are passed as argument.

If not possible to be removed, and the record is an updatable one @@ -490,7 +490,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.delete_sql_constraint_safely(env, module, table, name)
+openupgradelib.openupgrade.delete_sql_constraint_safely(env, module, table, name)

In case of obsolete constraints, run this in pre-migration script. Useful from v14 onwards. :param module: Module where the sql constraint was declared @@ -500,7 +500,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.disable_invalid_filters(env)
+openupgradelib.openupgrade.disable_invalid_filters(env)

It analyzes all the existing active filters to check if they are still correct. If not, they are disabled for avoiding errors when clicking on them, or worse, if they are default filters when opening the model/action.

@@ -515,7 +515,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.drop_columns(cr, column_spec)
+openupgradelib.openupgrade.drop_columns(cr, column_spec)

Drop columns but perform an additional check if a column exists. This covers the case of function fields that may or may not be stored. Consider that this may not be obvious: an additional module can govern @@ -529,7 +529,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.float_to_integer(cr, table, field)
+openupgradelib.openupgrade.float_to_integer(cr, table, field)

Change column type from float to integer. It will just truncate the float value (It won’t round it)

@@ -547,7 +547,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.get_legacy_name(original_name)
+openupgradelib.openupgrade.get_legacy_name(original_name)

Returns a versioned name for legacy tables/columns/etc Use this function instead of some custom name to avoid collisions with future or past legacy tables/columns/etc

@@ -563,7 +563,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.lift_constraints(cr, table, column)
+openupgradelib.openupgrade.lift_constraints(cr, table, column)

Lift all constraints on column in table. Typically, you use this in a pre-migrate script where you adapt references for many2one fields with changed target objects. @@ -572,7 +572,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.load_data(cr, module_name, filename, idref=None, mode='init')
+openupgradelib.openupgrade.load_data(cr, module_name, filename, idref=None, mode='init')

Load an xml, csv or yml data file from your post script. The usual case for this is the occurrence of newly added essential or useful data in the module that is @@ -608,7 +608,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.logged_query(cr, query, args=None, skip_no_result=False)
+openupgradelib.openupgrade.logged_query(cr, query, args=None, skip_no_result=False)

Logs query and affected rows at level DEBUG.

Parameters:
@@ -625,7 +625,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.logging(args_details=False, step=False)
+openupgradelib.openupgrade.logging(args_details=False, step=False)

This is a decorator for any sub functions called in an OpenUpgrade script. (pre or post migration script)

Decorate functions that can take time, or for debug / development purpose.

@@ -661,7 +661,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.m2o_to_x2m(cr, model, table, field, source_field)
+openupgradelib.openupgrade.m2o_to_x2m(cr, model, table, field, source_field)

Transform many2one relations into one2many or many2many. Use rename_columns in your pre-migrate script to retain the column’s old value, then call m2o_to_x2m in your post-migrate script.

@@ -686,7 +686,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.map_values(cr, source_column, target_column, mapping, model=None, table=None, write='sql')
+openupgradelib.openupgrade.map_values(cr, source_column, target_column, mapping, model=None, table=None, write='sql')

Map old values to new values within the same model or table. Old values presumably come from a legacy column. You will typically want to use it in post-migration scripts.

@@ -712,7 +712,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.merge_models(cr, old_model, new_model, ref_field)
+openupgradelib.openupgrade.merge_models(cr, old_model, new_model, ref_field)

Update model references for models that have merged to an existing model. :param old_model: old model :param new_model: destination model @@ -724,7 +724,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.message(cr, module, table, column, message, *args, **kwargs)
+openupgradelib.openupgrade.message(cr, module, table, column, message, *args, **kwargs)

Log handler for non-critical notifications about the upgrade. To be extended with logging to a table for reporting purposes.

@@ -743,7 +743,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.migrate(no_version=False, use_env=None, uid=None, context=None)
+openupgradelib.openupgrade.migrate(no_version=False, use_env=None, uid=None, context=None)

This is the decorator for the migrate() function in migration scripts.

Set argument no_version to True if the method has to be taken into @@ -764,7 +764,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.move_field_m2o(cr, pool, registry_old_model, field_old_model, m2o_field_old_model, registry_new_model, field_new_model, quick_request=True, compute_func=None, binary_field=False)
+openupgradelib.openupgrade.move_field_m2o(cr, pool, registry_old_model, field_old_model, m2o_field_old_model, registry_new_model, field_new_model, quick_request=True, compute_func=None, binary_field=False)

Use that function in the following case: A field moves from a model A to the model B with : A -> m2o -> B. (For exemple product_product -> product_template) @@ -784,7 +784,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.reactivate_workflow_transitions(cr, transition_conditions)
+openupgradelib.openupgrade.reactivate_workflow_transitions(cr, transition_conditions)

Reactivate workflow transition previously deactivated by deactivate_workflow_transitions.

@@ -802,7 +802,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.remove_tables_fks(cr, tables)
+openupgradelib.openupgrade.remove_tables_fks(cr, tables)

Remove foreign keys declared in tables.

This is useful when a table is not going to be used anymore, but you still don’t want to delete it.

@@ -825,7 +825,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.rename_columns(cr, column_spec)
+openupgradelib.openupgrade.rename_columns(cr, column_spec)

Rename table columns. Typically called in the pre script.

Parameters:
@@ -836,7 +836,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.rename_fields(env, field_spec, no_deep=False)
+openupgradelib.openupgrade.rename_fields(env, field_spec, no_deep=False)

Rename fields. Typically called in the pre script. WARNING: If using this on base module, pass the argument no_deep with True value for avoiding the using of the environment (which is not yet loaded).

@@ -868,7 +868,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.rename_models(cr, model_spec)
+openupgradelib.openupgrade.rename_models(cr, model_spec)

Rename models. Typically called in the pre script. :param model_spec: a list of tuples (old model name, new model name).

Use case: if a model changes name, but still implements equivalent @@ -880,14 +880,14 @@

OpenUpgrade API
-openupgradelib.openupgrade.rename_property(cr, model, old_name, new_name)
+openupgradelib.openupgrade.rename_property(cr, model, old_name, new_name)

Rename property old_name owned by model to new_name. This should happen in a pre-migration script.

-openupgradelib.openupgrade.rename_tables(cr, table_spec)
+openupgradelib.openupgrade.rename_tables(cr, table_spec)

Rename tables. Typically called in the pre script. This function also renames the id sequence if it exists and if it is not modified in the same run.

@@ -900,7 +900,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.rename_xmlids(cr, xmlids_spec, allow_merge=False)
+openupgradelib.openupgrade.rename_xmlids(cr, xmlids_spec, allow_merge=False)

Rename XML IDs. Typically called in the pre script. One usage example is when an ID changes module. In OpenERP 6 for example, a number of res_groups IDs moved to module base from other modules ( @@ -924,7 +924,7 @@

OpenUpgrade API +openupgradelib.openupgrade.safe_unlink(records, do_raise=False)

Allow for errors to occur during unlinking of records.

Prevent broken database transactions, and by default, catch exceptions.

@@ -941,7 +941,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.set_defaults(cr, pool, default_spec, force=False, use_orm=False)
+openupgradelib.openupgrade.set_defaults(cr, pool, default_spec, force=False, use_orm=False)

Set default value. Useful for fields that are newly required. Uses orm, so call from the post script.

@@ -958,7 +958,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.set_xml_ids_noupdate_value(env, module, xml_ids, value)
+openupgradelib.openupgrade.set_xml_ids_noupdate_value(env, module, xml_ids, value)

Set the xml_ids noupdate values in a module.

Parameters:
@@ -973,13 +973,13 @@

OpenUpgrade API
-openupgradelib.openupgrade.table_exists(cr, table)
+openupgradelib.openupgrade.table_exists(cr, table)

Check whether a certain table or view exists

-openupgradelib.openupgrade.update_field_multilang(records, field, method)
+openupgradelib.openupgrade.update_field_multilang(records, field, method)

Update a field in all available languages in the database.

Parameters:
@@ -996,7 +996,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.update_module_moved_fields(cr, model, moved_fields, old_module, new_module)
+openupgradelib.openupgrade.update_module_moved_fields(cr, model, moved_fields, old_module, new_module)

Update module for field definition in general tables that have been moved from one module to another.

No need to use this method: moving the XMLID is covered in @@ -1016,7 +1016,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.update_module_moved_models(cr, model, old_module, new_module)
+openupgradelib.openupgrade.update_module_moved_models(cr, model, old_module, new_module)

Update module for model definition in general tables that have been moved from one module to another. :param cr: Database cursor @@ -1027,7 +1027,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.update_module_names(cr, namespec, merge_modules=False)
+openupgradelib.openupgrade.update_module_names(cr, namespec, merge_modules=False)

Deal with changed module names, making all the needed changes on the related tables, like XML-IDs, translations, and so on.

@@ -1043,7 +1043,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.update_workflow_workitems(cr, pool, ref_spec_actions)
+openupgradelib.openupgrade.update_workflow_workitems(cr, pool, ref_spec_actions)

Find all the workflow items from the target state to set them to the wanted state.

When a workflow action is removed, from model, the objects whose states @@ -1066,7 +1066,7 @@

OpenUpgrade API
-openupgradelib.openupgrade.warn_possible_dataloss(cr, pool, old_module, fields)
+openupgradelib.openupgrade.warn_possible_dataloss(cr, pool, old_module, fields)

Use that function in the following case: if a field of a model was moved from a ‘A’ module to a ‘B’ module. (‘B’ depend on ‘A’), @@ -1091,20 +1091,20 @@

OpenUpgrade API -

Methods for OpenUpgrade 7.0

+

Methods for OpenUpgrade 7.0

The following specific methods for 7.0 are available. These have been developed to cover specific needs as per data model changes in that release.

-
+
-openupgradelib.openupgrade_70.get_partner_id_from_user_id(cr, user_id)
+openupgradelib.openupgrade_70.get_partner_id_from_user_id(cr, user_id)

Get the new partner_id from user_id. :param user_id : user previously used.

-openupgradelib.openupgrade_70.set_partner_id_from_partner_address_id(cr, pool, model_name, partner_field, address_field, table=None)
+openupgradelib.openupgrade_70.set_partner_id_from_partner_address_id(cr, pool, model_name, partner_field, address_field, table=None)

Set the new partner_id on any table with migrated contact ids

Parameters:
@@ -1123,13 +1123,13 @@

Methods for OpenUpgrade 7.0 -

Methods for OpenUpgrade 8.0

+

Methods for OpenUpgrade 8.0

The following specific methods for 8.0 are available. These have been developed to cover specific needs as per data model changes in that release.

-
+
-openupgradelib.openupgrade_80.get_last_post_for_model(cr, uid, ids, model_pool)
+openupgradelib.openupgrade_80.get_last_post_for_model(cr, uid, ids, model_pool)

Given a set of ids and a model pool, return a dict of each object ids with their latest message date as a value. To be called in post-migration scripts

@@ -1150,7 +1150,7 @@

Methods for OpenUpgrade 8.0
-openupgradelib.openupgrade_80.set_message_last_post(cr, uid, pool, models)
+openupgradelib.openupgrade_80.set_message_last_post(cr, uid, pool, models)

Given a list of models, set their ‘message_last_post’ fields to an estimated last post datetime. To be called in post-migration scripts

@@ -1171,7 +1171,7 @@

Methods for OpenUpgrade 8.0
-openupgradelib.openupgrade_80.update_aliases(cr, registry, model_name, set_parent_thread_id, alias_defaults=None, defaults_id_key=False)
+openupgradelib.openupgrade_80.update_aliases(cr, registry, model_name, set_parent_thread_id, alias_defaults=None, defaults_id_key=False)

Update a model’s aliases according to how they are configured in the model’s create() method.

@@ -1188,15 +1188,15 @@

Methods for OpenUpgrade 8.0 -

Methods for OpenUpgrade 9.0

+

Methods for OpenUpgrade 9.0

The following specific methods for 9.0 are available. These have been developed to cover specific needs as per data model changes in that release.

-

This module provides simple tools for OpenUpgrade migration, specific for +

This module provides simple tools for OpenUpgrade migration, specific for the 8.0 -> 9.0 migration.

-openupgradelib.openupgrade_90.convert_binary_field_to_attachment(env, field_spec)
+openupgradelib.openupgrade_90.convert_binary_field_to_attachment(env, field_spec)

This method converts the 8.0 binary fields to attachments like Odoo 9.0 makes with the new attachment=True attribute. It has to be called on post-migration script, as there’s a call to get the res_name of the @@ -1229,7 +1229,7 @@

Methods for OpenUpgrade 9.0
-openupgradelib.openupgrade_90.replace_account_types(env, type_spec, unlink=True)
+openupgradelib.openupgrade_90.replace_account_types(env, type_spec, unlink=True)

Replace old account types with their replacements. The old account type is allowed not to exist anymore, except when running unit tests. :param type_spec: list of tuples (xmlid of old account.account.type, xmlid of new account.account.type) @@ -1238,11 +1238,11 @@

Methods for OpenUpgrade 9.0 -

Methods for OpenUpgrade 12.0

+

Methods for OpenUpgrade 12.0

The following specific methods for 12.0 are available. These have been developed to cover specific needs as per data model changes in that release.

-

Tools specific for migrating Odoo 11.0 to 12.0.

+

Tools specific for migrating Odoo 11.0 to 12.0.

Important changes come from the update from Bootstrap 3 to 4. To understand these changes, these sources have been consulted, among others specific to some rules that can be consulted in inline comments:

@@ -1255,7 +1255,7 @@

Methods for OpenUpgrade 12.0
-openupgradelib.openupgrade_120.convert_field_bootstrap_3to4(env, model_name, field_name, domain=None, method='orm')
+openupgradelib.openupgrade_120.convert_field_bootstrap_3to4(env, model_name, field_name, domain=None, method='orm')

This converts all the values for the given model and field, being able to restrict to a domain of affected records.

@@ -1274,7 +1274,7 @@

Methods for OpenUpgrade 12.0
-openupgradelib.openupgrade_120.convert_string_bootstrap_3to4(html_string, pretty_print=True)
+openupgradelib.openupgrade_120.convert_string_bootstrap_3to4(html_string, pretty_print=True)

Convert an HTML string from Bootstrap 3 to 4.

Parameters:
@@ -1291,14 +1291,14 @@

Methods for OpenUpgrade 12.0 -

Methods for OpenUpgrade 13.0

+

Methods for OpenUpgrade 13.0

The following specific methods for 13.0 are available. These have been developed to cover specific needs as per data model changes in that release.

-

Tools specific for migrating from Odoo 12.0 to 13.0.

+

Tools specific for migrating from Odoo 12.0 to 13.0.

+openupgradelib.openupgrade_130.unlink_invalid_tax_tags_from_repartition_lines(env, module, base_tag_xmlids, tax_tag_xmlids)

The migration script of the account module assigns all tags of the account.tax’s tag_ids field to the tag_ids field of the new account.tax.repartition.line. However, because each repartition @@ -1308,15 +1308,15 @@

Methods for OpenUpgrade 13.0 -

Methods for OpenUpgrade 16.0

+

Methods for OpenUpgrade 16.0

The following specific methods for 16.0 are available. These have been developed to cover specific needs as per data model changes in that release.

-

This module provides simple tools for OpenUpgrade migration, specific for +

This module provides simple tools for OpenUpgrade migration, specific for the >=16.0 migration.

-openupgradelib.openupgrade_160.migrate_translations_to_jsonb(env, fields_spec)
+openupgradelib.openupgrade_160.migrate_translations_to_jsonb(env, fields_spec)

In Odoo 16, translated fields no longer use the model ir.translation. Instead they store all their values into jsonb columns in the model’s table. diff --git a/docs/_static/basic.css b/docs/_static/basic.css index 7577acb1..30fee9d0 100644 --- a/docs/_static/basic.css +++ b/docs/_static/basic.css @@ -237,6 +237,10 @@ a.headerlink { visibility: hidden; } +a:visited { + color: #551A8B; +} + h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, @@ -670,6 +674,16 @@ dd { margin-left: 30px; } +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + dl > dd:last-child, dl > dd:last-child > :last-child { margin-bottom: 0; @@ -738,6 +752,14 @@ abbr, acronym { cursor: help; } +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + /* -- code displays --------------------------------------------------------- */ pre { diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 94de1aab..845f18d4 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,5 @@ -var DOCUMENTATION_OPTIONS = { - URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.1.dev1+gfb09131', +const DOCUMENTATION_OPTIONS = { + VERSION: '0.1.dev1+gddce67b', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/_static/pygments.css b/docs/_static/pygments.css index 691aeb82..0d49244e 100644 --- a/docs/_static/pygments.css +++ b/docs/_static/pygments.css @@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js index 97d56a74..7918c3fa 100644 --- a/docs/_static/searchtools.js +++ b/docs/_static/searchtools.js @@ -57,12 +57,12 @@ const _removeChildren = (element) => { const _escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string -const _displayItem = (item, searchTerms) => { +const _displayItem = (item, searchTerms, highlightTerms) => { const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; - const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; const [docName, title, anchor, descr, score, _filename] = item; @@ -75,20 +75,24 @@ const _displayItem = (item, searchTerms) => { if (dirname.match(/\/index\/$/)) dirname = dirname.substring(0, dirname.length - 6); else if (dirname === "index/") dirname = ""; - requestUrl = docUrlRoot + dirname; + requestUrl = contentRoot + dirname; linkUrl = requestUrl; } else { // normal html builders - requestUrl = docUrlRoot + docName + docFileSuffix; + requestUrl = contentRoot + docName + docFileSuffix; linkUrl = docName + docLinkSuffix; } let linkEl = listItem.appendChild(document.createElement("a")); linkEl.href = linkUrl + anchor; linkEl.dataset.score = score; linkEl.innerHTML = title; - if (descr) + if (descr) { listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } else if (showSearchSummary) fetch(requestUrl) .then((responseData) => responseData.text()) @@ -97,6 +101,9 @@ const _displayItem = (item, searchTerms) => { listItem.appendChild( Search.makeSearchSummary(data, searchTerms) ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); }); Search.output.appendChild(listItem); }; @@ -115,14 +122,15 @@ const _finishSearch = (resultCount) => { const _displayNextItem = ( results, resultCount, - searchTerms + searchTerms, + highlightTerms, ) => { // results left, load the summary and display it // this is intended to be dynamic (don't sub resultsCount) if (results.length) { - _displayItem(results.pop(), searchTerms); + _displayItem(results.pop(), searchTerms, highlightTerms); setTimeout( - () => _displayNextItem(results, resultCount, searchTerms), + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), 5 ); } @@ -360,7 +368,7 @@ const Search = { // console.info("search results:", Search.lastresults); // print the results - _displayNextItem(results, results.length, searchTerms); + _displayNextItem(results, results.length, searchTerms, highlightTerms); }, /** diff --git a/docs/_static/sphinx_highlight.js b/docs/_static/sphinx_highlight.js index aae669d7..8a96c69a 100644 --- a/docs/_static/sphinx_highlight.js +++ b/docs/_static/sphinx_highlight.js @@ -29,14 +29,19 @@ const _highlight = (node, addItems, text, className) => { } span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); parent.insertBefore( span, parent.insertBefore( - document.createTextNode(val.substr(pos + text.length)), + rest, node.nextSibling ) ); node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); if (isInSVG) { const rect = document.createElementNS( @@ -140,5 +145,10 @@ const SphinxHighlight = { }, }; -_ready(SphinxHighlight.highlightSearchWords); -_ready(SphinxHighlight.initEscapeListener); +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/docs/authors.html b/docs/authors.html index 6ec468df..684a2d0c 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -4,18 +4,18 @@ - Credits — OpenUpgrade Library 0.1.dev1+gfb09131 documentation + Credits — OpenUpgrade Library 0.1.dev1+gddce67b documentation - - - - - + + + + + @@ -35,7 +35,7 @@ OpenUpgrade Library

- 0.1.dev1+gfb09131 + 0.1.dev1+gddce67b
@@ -97,15 +97,15 @@
-

Credits

+

Credits

-

Development Lead

+

Development Lead

-

Contributors

+

Contributors