Skip to content

[MIG] price_security_planned_price: Migration to 20.0 - #1001

Open
lef-adhoc wants to merge 4 commits into
ingadhoc:20.0from
adhoc-dev:20.0-t-76462-lef
Open

lef-adhoc wants to merge 4 commits into
ingadhoc:20.0from
adhoc-dev:20.0-t-76462-lef

Conversation

@lef-adhoc

Copy link
Copy Markdown
Contributor

Migration of price_security_planned_price to 20.0.

Tarea: https://www.adhoc.inc/odoo/project.task/76462

What changed

The Python of the module did not need any change: _get_view keeps the same
signature and the same contract in 20.0, and none of the symbols the module
uses changed in the jump. The [MIG] commit is just the manifest bump.

On top of that:

  • Tests — the module had none. They cover the two behaviours it adds to the
    product form, on product.template and on product.product:
    group_only_view turns the planned price fields readonly, and
    group_only_view_sale_price (which implies it) also hides the planned price
    block.
  • README — Configuration and Usage were copied from price_security and
    described its sale order, invoice and partner restrictions. They now describe
    what this module actually does.
  • .pot re-exported: from 20.0 the export includes the module description,
    which is the README.

Depends on

This cannot be merged before:

Both were stacked locally to install and test. This branch is clean off 20.0.

Test plan

  • pre-commit run green on every file of the module.
  • Installs clean on a 20.0 database: 127 modules, no errors.
  • --test-enable --test-tags /price_security_planned_price: 4 tests, 0 failed,
    0 errors. They were also seen failing on purpose, by dropping the readonly
    assignment from product_template.py.

Notes for the reviewer

Three things that already existed in 19.0 and this PR leaves as they are:

  • //group[@name='costing'] matches nothing on the product form. That group
    only exists on mrp.workcenter views, both in 19.0 and in 20.0, and no OBA
    module adds it to the product form, so group_only_view_sale_price only ever
    hides the planned price block.
  • The block that writes a modifiers attribute is dead code: nothing in the
    core reads or writes that attribute on view nodes, in 19.0 or in 20.0.
  • product_template.py and product_product.py are identical except for the
    class name and the _inherit.

What makes this module correct is not obvious and is worth keeping in mind:
_get_view runs inside _get_view_cache, whose ormcache key does not include
the user. price_security extends _get_view_cache_key on both models with the
two group flags, so each profile gets its own cached arch. If that key ever
changes, this module starts serving one user's arch to another.

Translations were not re-exported: odoo-i18n fails on the language install
step with psycopg2.errors.SerializationFailure, on a freshly created database
too. The .po has two terms and both are already translated.

The module had no tests. These cover the two behaviours it adds to the product
form, on product.template and on product.product: group_only_view turns the
planned price fields readonly, and group_only_view_sale_price (which implies
the former) also hides the planned price block. A plain user keeps the fields
editable and the block visible.
Configuration and Usage were copied from price_security and listed its sale
order, invoice and partner restrictions. This module only restricts the
planned price fields on the product form, so the README now says that.
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants