Skip to content

[FIX] stock_account_cost_revaluation: link the revaluation entry to the value adjustment - #937

Open
rov-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-64440-rov
Open

[FIX] stock_account_cost_revaluation: link the revaluation entry to the value adjustment#937
rov-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-64440-rov

Conversation

@rov-adhoc

Copy link
Copy Markdown
Contributor

Changing the accounting cost (standard_price) of a product with perpetual valuation posts the revaluation entry in this module, but the product.value the standard records for that same price change was left with no reference to it.

stock_account_ux reads "no entry" as "still part of the difference to adjust", so the adjustment kept showing up as pending in the inventory valuation report and the inventory closing booked it a second time. Telling booked from pending is the whole point of that field.

What changes

  • _link_cost_revaluation_entry points the product.value at the entry right after posting it: the most recent price change of the product in the company still without an entry, which is the one _change_standard_price just created.
  • Lot price changes are left alone — they record their own product.value, and this entry values the product's on-hand stock, not a lot's.
  • When no entry is posted (no revaluation account, no stock, FIFO, periodic category) there is nothing to link and the adjustment stays pending, as it should.
  • stock_account_ux joins depends: it is where account_move_id comes from. It is auto_install over stock_account, which this module already depends on, so it is installed in every database that has this one anyway.

Test plan

2 new tests in test_cost_revaluation, 9 green in the module on a fresh database with demo data. The linking one is red without the fix.

Related

Same branch name as, and part of the same functional review round as, ingadhoc/account-financial-tools#984 and ingadhoc/stock#1004 — runbot builds the three together.

Task: https://www.adhoc.inc/odoo/project.task/64440

@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

…he value adjustment

Task 64440, functional feedback. Changing the accounting cost of a product with
perpetual valuation posts the revaluation entry here, but the ``product.value`` the
standard records for that same price change was left with no reference to it.

``stock_account_ux`` reads "no entry" as "still part of the difference to adjust", so
the adjustment kept showing up as pending in the inventory valuation report and the
closing booked it a second time — telling booked from pending is the whole point of
that field.

``_link_cost_revaluation_entry`` points the record at the entry right after posting
it: the most recent price change of the product in the company still without an entry,
which is the one ``_change_standard_price`` just created. Lot price changes are left
alone —they record their own ``product.value`` and this entry values the product's
on-hand stock, not a lot's. When no entry is posted (no revaluation account, no stock,
FIFO, periodic category) there is nothing to link and the adjustment stays pending, as
it should.

``stock_account_ux`` joins ``depends``: it is where ``account_move_id`` comes from. It
is ``auto_install`` over ``stock_account``, which this module already depends on, so it
is installed in every database that has this one anyway.

Test plan: 2 new tests, 9 green in the module on a fresh database. The linking one is
red without the fix.
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