upgrade-util icon indicating copy to clipboard operation
upgrade-util copied to clipboard

[IMP] util.update_record_from_xml

Open KangOl opened this issue 5 months ago • 6 comments

Set the xml_filename argument of the xml_import records.

KangOl avatar Jul 02 '25 14:07 KangOl

Pull request status dashboard

robodoo avatar Jul 02 '25 14:07 robodoo

upgradeci retry with always only hr

KangOl avatar Jul 03 '25 14:07 KangOl

After some tests, it doesn't work as expected in all cases.

  • ir.ui.view: works correctly due to the arch field being computed with an inverse function
  • theme.ir.ui.view: just read in the default function, so not updated during write
  • template.reset.mixin ({mail,sms}.template): set in the create overwrite only.

Maybe all those usages should be standardized in a common mixin which also handle the update.

KangOl avatar Jul 04 '25 09:07 KangOl

After some tests, it doesn't work as expected in all cases.

* `ir.ui.view`: works correctly due to the `arch` field being computed with an `inverse` function

* `theme.ir.ui.view`: just read in the `default` function, so not updated during `write`

* `template.reset.mixin` (`{mail,sms}.template`): set in the `create` overwrite only.
  • theme.ir.ui.view: can't we just add @api.depends('arch') here https://github.com/odoo/odoo/blob/07626050bd0104fecd8799b56d30245d00da3f27/addons/website/models/theme_models.py#L56 ?
  • template.reset.mixin: we can do in write the same as in create, https://github.com/odoo/odoo/blob/07626050bd0104fecd8799b56d30245d00da3f27/addons/mail/models/template_reset_mixin.py#L30-L36 (in master it could be extracted to a local private method...)

Maybe all those usages should be standardized in a common mixin which also handle the update.

I think this could be an option if this becomes more widely use. For current cases it looks very localized and (if I'm not mistaked) with a simple solution. The mixin may add extra complexity that we don't need for these few cases.

aj-fuentes avatar Jul 07 '25 07:07 aj-fuentes

  • theme.ir.ui.view: can't we just add @api.depends('arch') here https://github.com/odoo/odoo/blob/07626050bd0104fecd8799b56d30245d00da3f27/addons/website/models/theme_models.py#L56 ?

No, it's not enough. It should be set in create and write, like for other models.

KangOl avatar Jul 07 '25 07:07 KangOl

  • theme.ir.ui.view: can't we just add @api.depends('arch') here https://github.com/odoo/odoo/blob/07626050bd0104fecd8799b56d30245d00da3f27/addons/website/models/theme_models.py#L56 ?

No, it's not enough. It should be set in create and write, like for other models.

What I had in mind was that the field should be a computed stored field, with "depends". I missed that it was just default=...

aj-fuentes avatar Jul 07 '25 07:07 aj-fuentes