Open dreispt opened 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:
Idea 1 : Let's populate purchase_price
with standard_price
when installing module, for existing invoices.
BUT : that logic is right for current invoices, but not for past invoices. So you'll have bad margin on past invoices.
Idea 2 : Let's populate purchase_price
, with values present in product.price.history
tables, for past invoices.
BUT : product.price.history
was not present before version 10.0. That means that for databases that have been migrated from older version. (my current database comes from 5.0 version), the purchase_price
will be wrong.
-> 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 ?
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
?
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
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.
@legalsylvain Hello, can you please have a look at #202?
Module
account_invoice_margin
Describe the bug
When installing
account_invoice_margin
, thepurchase_price
field is expected to be populated with the product'sstandard_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:
Expected behavior the cost invoice line column: is is zero while it should be the product cost