OCA / margin-analysis

Odoo Financial Controlling (margin, costs, ...)
https://odoo-community.org/project/9
GNU Affero General Public License v3.0
74 stars 161 forks source link

account_invoice_margin: does not populate purchase_price on install #182

Open dreispt opened 1 year ago

dreispt commented 1 year ago

Module

account_invoice_margin

Describe the bug

When installing account_invoice_margin, the purchase_price field is expected to be populated with the product's standard_price, but it stays as zero. Manually running _compute_purchase_price fixes it, but I can't see why this is not already being done on install - I could be missing something.

To Reproduce

Affected versions: 14.0

Steps to reproduce the behavior:

  1. Install account_invoice_margin
  2. Find an Invoice using a product that has a non zero cost
  3. Check the cost invoice line column: is is zero while it should be the product cost

Expected behavior the cost invoice line column: is is zero while it should be the product cost

legalsylvain commented 1 year ago

Hi @dreispt. Thanks for your comment.

I've already thought about this, and I haven't found a better solution yet. Here's my train of thought:

-> my current conclusion on that topic : let's put 0 for existing invoices. it's better to have no margin than to have a false margin and base bad decisions on it.

What do you think ?

dreispt commented 1 year ago

Help me understand why purchase_price it is not populated in the first place: The field is added by this module, and it is computed. Why isn't it populated with the computed value? Because of readonly=False ?

legalsylvain commented 1 year ago

Why isn't it populated with the computed value? Because of readonly=False ?

no. because of this hook :

https://github.com/OCA/margin-analysis/blob/12.0/account_invoice_margin/hooks.py

github-actions[bot] commented 8 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

dreispt commented 2 months ago

@legalsylvain Hello, can you please have a look at #202?