Upgrade to 5.2 : ir_rule_group is null

while upgrading to 5.2 I notice the following:

29007 140059431294592 [2019-09-08 16:48:53,502] WARNING trytond.backend.postgresql.table Unable to set column name of table ir_rule_group not null !
Try to re-run: trytond.py --update=module
If it doesn't work, update records and execute manually:
ALTER TABLE "ir_rule_group" ALTER COLUMN "name" SET NOT NULL

But trying to do so I notice:

test=# select count(*) from ir_rule_group where name is null;
count 
-------
 65
(1 ligne)

test=# select * from ir_module where id in (select model from ir_rule_group where name is null);
id  | create_uid |        create_date         |         write_date         | write_uid |               name               |     state     
-----+------------+----------------------------+----------------------------+-----------+----------------------------------+---------------
  11 |          0 | 2019-01-18 15:39:48.171251 |                            |           | notification_email               | not activated
  12 |          0 | 2019-01-18 15:39:48.171251 |                            |           | purchase_invoice_line_standalone | not activated
  13 |          0 | 2019-01-18 15:39:48.171251 |                            |           | account_dunning_email            | not activated
  14 |          0 | 2019-01-18 15:39:48.171251 |                            |           | stock_supply                     | not activated
  19 |          0 | 2019-01-18 15:39:48.171251 |                            |           | product_price_list_parent        | not activated
  21 |          0 | 2019-01-18 15:39:48.171251 |                            |           | sale_invoice_grouping            | not activated
  22 |          0 | 2019-01-18 15:39:48.171251 |                            |           | account_dunning_fee              | not activated
  27 |          0 | 2019-01-18 15:39:48.171251 |                            |           | product_classification_taxonomic | not activated
  61 |          0 | 2019-01-18 15:39:48.171251 |                            |           | sale_opportunity                 | not activated
  68 |          0 | 2019-01-18 15:39:48.171251 |                            |           | web_user                         | not activated
  69 |          0 | 2019-01-18 15:39:48.171251 |                            |           | account_invoice_line_standalone  | not activated
 108 |          0 | 2019-01-18 15:39:48.171251 |                            |           | analytic_sale                    | not activated
 118 |          0 | 2019-01-18 15:39:48.171251 |                            |           | production_outsourcing           | not activated
 119 |          0 | 2019-01-18 15:39:48.171251 |                            |           | account_payment_stripe           | not activated
 121 |          0 | 2019-01-18 15:39:48.171251 |                            |           | sale_supply                      | not activated
  60 |          0 | 2019-01-18 15:39:48.171251 | 2019-01-19 01:08:22.396287 |         1 | bank                             | activated
  24 |          0 | 2019-01-18 15:39:48.171251 | 2019-01-19 01:08:22.396287 |         1 | product_classification           | activated
  23 |          0 | 2019-01-18 15:39:48.171251 | 2019-01-19 01:08:22.396287 |         1 | party_siret                      | activated
 114 |          0 | 2019-01-18 15:39:48.171251 | 2019-01-19 01:08:22.396287 |         1 | product_measurements             | activated
 111 |          0 | 2019-01-18 15:39:48.171251 | 2019-01-19 01:08:22.396287 |         1 | account_invoice_correction       | activated
 132 |          0 | 2019-02-21 06:17:18.468266 | 2019-02-21 14:23:25.642797 |         4 | account_invoice_merge            | activated
  28 |          0 | 2019-01-18 15:39:48.171251 | 2019-01-29 17:02:21.434953 |         1 | account_tax_cash                 | activated
(22 lignes)

What to do here, delete these records or add a name? if so, what name?

records are unsync. you should resync them.

using gui: Administration > Model > Model > Data , select all unsync records and run “resync” action

using trytond-console:

  $ trytond-console -c config.ini -d ${DBNAME}
  >>> Data = pool.get('ir.model.data')
  >>> ms = Data.search([('out_of_sync', '=', True)])
  >>> Data.sync(ms)
  >>> transaction.commit()

Usually after a resync, you want to rerun trytond-admin update step (and check again that no more unsync records are present).

unfortunately nothing changed with the trytond-console approach.
Same warning during update, no change with the psql queries above.
Other ideas?
cheers

could you expand a bit what your tried ?

during my 5.0->5.2 update, the path I followed was:

  • stop daemon
  • update trytond files from 5.0 to 5.2
  • follow migration path for database with SQL commands
  • update module list: trytond-admin -vv -c config.ini -d ${DBNAME} -m
  • start updating modules: trytond-admin -vv -c config.ini -d ${DBNAME} --all
  • resync out-of-sync records (with trytond-console) – note you could check how many records are out-of-sync with print(len(ms))
  • rerun updating modules: trytond-admin -vv -c config.ini -d ${DBNAME} --all
  • resync out-of-sync records (with trytond-console) if any

as soon there is out-of-sync records, rerun trytond-admin.

I saw the ir_rule_group problem during my upgrade, but resync was enough to deal with. The sole error in my last trytond-admin command was about deleting user, which is an expected error (user can’t be deleted, they are disabled).

Well if some rules have been created manually, the user will have to give them a name also manually in order to set the NOT NULL constraint.

We have made no such rule manually… is there a possibility that rules be made dynamically somehow?
Where are these seen via the GUI?

I checked a number of other bases, all have between 43 and 65 “rules” with null name.
Since we have made no such rules manually… who is the gremlin that has?
And what do these serve? Can they be deleted, or should the have a name generated on them in order to support the NOT NULL constraint?

Look at Administration > Model > Model > Data, next go to tab All, next filter with Model: =ir.rule.group.

You will have all ir.rule.group data in the list.

Next, you should be able to look at the record view, and look at value field: it is what is on database (the fs_value is what is on filesystem).

It has been introduced in trytond: 91206db779f0

The reason is also in CHANGELOG: Display ids and rule names on access error

It took me less than 5 minutes to figure it, by looking at trytond/ir/rule.py file and to the commit that introduced the name field on ir.rule.group.

trying all this again with the latest snapshot of my 5.0 base, I now seem to get the names synchronised
with trytond-console…
I also now run into your n_sign_posn and p_sign_posn are considered as string by trytond.convert (#8375) · Issues · Tryton / Tryton · GitLab

287303 140437643757184 [2019-09-14 08:45:35,660] WARNING trytond.convert Field p_sign_posn of 1@ir.lang not updated (id: lang_en), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:35,660] WARNING trytond.convert Field n_sign_posn of 1@ir.lang not updated (id: lang_en), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,354] WARNING trytond.convert Field p_sign_posn of 2@ir.lang not updated (id: lang_bg), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,354] WARNING trytond.convert Field n_sign_posn of 2@ir.lang not updated (id: lang_bg), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,356] WARNING trytond.convert Field p_sign_posn of 3@ir.lang not updated (id: lang_ca), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,357] WARNING trytond.convert Field n_sign_posn of 3@ir.lang not updated (id: lang_ca), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,359] WARNING trytond.convert Field p_sign_posn of 4@ir.lang not updated (id: lang_cs), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,359] WARNING trytond.convert Field n_sign_posn of 4@ir.lang not updated (id: lang_cs), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,361] WARNING trytond.convert Field p_sign_posn of 5@ir.lang not updated (id: lang_de), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,361] WARNING trytond.convert Field n_sign_posn of 5@ir.lang not updated (id: lang_de), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,363] WARNING trytond.convert Field p_sign_posn of 6@ir.lang not updated (id: lang_es), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,364] WARNING trytond.convert Field n_sign_posn of 6@ir.lang not updated (id: lang_es), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,366] WARNING trytond.convert Field p_sign_posn of 7@ir.lang not updated (id: lang_es_419), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,366] WARNING trytond.convert Field n_sign_posn of 7@ir.lang not updated (id: lang_es_419), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,385] WARNING trytond.convert Field p_sign_posn of 8@ir.lang not updated (id: lang_fa), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,385] WARNING trytond.convert Field n_sign_posn of 8@ir.lang not updated (id: lang_fa), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,399] WARNING trytond.convert Field p_sign_posn of 9@ir.lang not updated (id: lang_fr), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,399] WARNING trytond.convert Field n_sign_posn of 9@ir.lang not updated (id: lang_fr), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,424] WARNING trytond.convert Field p_sign_posn of 12@ir.lang not updated (id: lang_lo), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,424] WARNING trytond.convert Field n_sign_posn of 12@ir.lang not updated (id: lang_lo), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,427] WARNING trytond.convert Field p_sign_posn of 13@ir.lang not updated (id: lang_lt), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,427] WARNING trytond.convert Field n_sign_posn of 13@ir.lang not updated (id: lang_lt), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,429] WARNING trytond.convert Field p_sign_posn of 14@ir.lang not updated (id: lang_nl), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,429] WARNING trytond.convert Field n_sign_posn of 14@ir.lang not updated (id: lang_nl), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,431] WARNING trytond.convert Field p_sign_posn of 15@ir.lang not updated (id: lang_pl), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,431] WARNING trytond.convert Field n_sign_posn of 15@ir.lang not updated (id: lang_pl), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,445] WARNING trytond.convert Field p_sign_posn of 17@ir.lang not updated (id: lang_ru), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,445] WARNING trytond.convert Field n_sign_posn of 17@ir.lang not updated (id: lang_ru), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,447] WARNING trytond.convert Field p_sign_posn of 18@ir.lang not updated (id: lang_sl), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,447] WARNING trytond.convert Field n_sign_posn of 18@ir.lang not updated (id: lang_sl), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,458] WARNING trytond.convert Field p_sign_posn of 19@ir.lang not updated (id: lang_zh_CN), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:45:36,458] WARNING trytond.convert Field n_sign_posn of 19@ir.lang not updated (id: lang_zh_CN), because it has changed since the last update
287303 140437643757184 [2019-09-14 08:46:46,962] WARNING trytond.convert Field action of 137@ir.ui.menu not updated (id: menu_location_form), because it has changed since the last update

  • for ir.lang : just ignore the warning or backport the “fix”. it is harmless (representation difference) and it corrects itself on 5.4 update.

  • for ir.ui.menu : re-run synchronisation, and next re-run tryton-admin

I grafted your commit to 5.2 but I still get:

374042 140258747451008 [2019-09-14 10:13:43,383] WARNING trytond.convert Field p_sign_posn of 1@ir.lang not updated (id: lang_en), because it has changed since the last update
374042 140258747451008 [2019-09-14 10:13:43,383] WARNING trytond.convert Field n_sign_posn of 1@ir.lang not updated (id: lang_en), because it has changed since the last update
374042 140258747451008 [2019-09-14 10:14:51,645] WARNING trytond.convert Field action of 137@ir.ui.menu not updated (id: menu_location_form), because it has changed since the last update

I checked again afterwards with trytond-console:

/usr/lib/python3.7/site-packages/zeep/loader.py:3: DeprecationWarning: defusedxml.lxml is no longer supported and will be removed in a future release.
from defusedxml.lxml import fromstring
Tryton 5.2.6, Python 3.7.4 (default, Jul 16 2019, 07:12:58)
[GCC 9.1.0] on linux

Data = pool.get(‘ir.model.data’)
ms = Data.search([(‘out_of_sync’, ‘=’, True)])
print(len(ms))
0

menu_location_form seems to be found in the ‘stock’ module

What’s strange is that I don’t see a field named ‘action’ for ir.ui.menu, there is an ‘active’ though…

id  | parent |   name    |    icon     | active |        create_date         | create_uid | sequence | write_date | write_uid 
----+--------+-----------+-------------+--------+----------------------------+------------+----------+------------+-----------
137 |    134 | Locations | tryton-list | t      | 2019-01-18 15:44:18.013324 |          0 |       10 |            |          
(1 ligne)

I have another base to upgrade that I am not able to do the trytond-console step because of the ir_rule_group issue…

I get:

/usr/lib/python3.7/site-packages/zeep/loader.py:3: DeprecationWarning: defusedxml.lxml is no longer supported and will be removed in a future release.
from defusedxml.lxml import fromstring
Tryton 5.2.8, Python 3.7.4 (default, Oct 4 2019, 06:57:26)
[GCC 9.2.0] on linux

Data = pool.get(‘ir.model.data’)
ms = Data.search([(‘out_of_sync’, ‘=’, True)])
Data.sync(ms)
Traceback (most recent call last):
File “”, line 1, in
File “/opt/trytond/trytond/model/modelview.py”, line 692, in wrapper
return func(cls, records, *args, **kwargs)
File “/opt/trytond/trytond/ir/model.py”, line 1276, in sync
Model.write(*values_to_write)
File “/opt/trytond/trytond/res/ir.py”, line 139, in write
super(Lang, cls).write(langs, values, *args)
File “/opt/trytond/trytond/ir/lang.py”, line 295, in write
super(Lang, cls).write(langs, values, *args)
File “/opt/trytond/trytond/model/modelsql.py”, line 159, in wrapper
return func(cls, *args, **kwargs)
File “/opt/trytond/trytond/model/modelsql.py”, line 997, in write
transaction.language, ids, [value] * len(ids))
File “/opt/trytond/trytond/ir/translation.py”, line 494, in set_ids
cls.save(to_save)
File “/opt/trytond/trytond/model/descriptors.py”, line 33, in newfunc
return self.func(owner, *args, **kwargs)
File “/opt/trytond/trytond/model/modelstorage.py”, line 1662, in save
news = cls.create([save_values[r] for r in to_create])
File “/opt/trytond/trytond/ir/translation.py”, line 617, in create
return super(Translation, cls).create(vlist)
File “/opt/trytond/trytond/model/modelsql.py”, line 159, in wrapper
return func(cls, *args, **kwargs)
File “/opt/trytond/trytond/model/modelsql.py”, line 674, in create
cls._validate(sub_records)
File “/opt/trytond/trytond/model/modelstorage.py”, line 73, in wrapper
return func(*args, **kwargs)
File “/opt/trytond/trytond/model/modelstorage.py”, line 1284, in _validate
**error_args))
trytond.model.modelstorage.SelectionValidationError: (‘UserError’, (“La valeur «\xa0fr_FR\xa0» pour le champ «\xa0Langue\xa0» sur «\xa0Traduction\xa0» n’est pas une des options permises.”, ‘’))

It appears that a previous upgrade didn’t do well with the fr_FR → fr work.
I manually upgraded ir_translation.lang from ‘fr_FR’ to ‘fr’ … what else would be needed ?

well, with pudb I found I needed to do the opposite (first problem encountered with ‘Bulgarian’), then the console action worked as did the upgrade.
Can I presume that all the ‘fr_FR’ records can now be deleted since after the update there are as well all the same with lang=‘fr’?

Richard PALO

Sep 14

374042 140258747451008 [2019-09-14 10:14:51,645] WARNING trytond.convert Field action of 137@ir.ui.menu not updated (id: menu_location_form), because it has changed since the last update

What’s strange is that I don’t see a field named ‘action’ for ir.ui.menu, there is an ‘active’ though…

id  | parent |   name    |    icon     | active |        create_date         | create_uid | sequence | write_date | write_uid 
----+--------+-----------+-------------+--------+----------------------------+------------+----------+------------+-----------
137 |    134 | Locations | tryton-list | t      | 2019-01-18 15:44:18.013324 |          0 |       10 |            |          
(1 ligne)

any hints on how to fix this?