We also think it could be useful to know purchase/sale history of a product (to which suppliers a product was bought, when was last purchase, what was the purchase/sale price, the quantity, …).
Reporting don’t give all information at once.
So, wondering if a relate from product on purchase_lines/sale_lines (with some function fields from header for details) could help the user to find such information quickly? (and easy to implement)
Maybe this could be done with a new model based on a query for more efficiency ?
We did such add-on as a customization, but we think many users did the same, so why not adding this in sale/purchase modules?
Indeed it makes sense but it will be great to prevent to create lines from this view because we do not really have protection against adding lines to confirmed orders (or we should add such constraint).
Also I think we should try to reduce the number of relate on the product probably by using links for those that works only on 1 product. And also improve the discoverability by adding some relate also as links.
What details?
I do not see why we would need a table query model?
As relate is on lines, some fields are missing for having whole information at once: supplier/customer, sale_date, currency, number, reference, …
Don’t know. But to add missing details (see my previous answer) on the purchase_line/sale_line model, we add some function fields to get info from the header (like for state field). So maybe using a lot of function fields on a model could slow for other use?
Indeed it will be annoying to have to add many Function field on the line, mainly because it may prevent customization that would want to override the order value at the line level.
So probably having a dedicated model for that is not a bad idea and it will solve the creation issue.
I prefered to have an amount field computed in python to ensure that the values are rounded to the currency, but not sure if it’s worth to do the math on the sql part.
I’m not sure if we need to include also the line description for the lines that do not have a product. Of course we will just include the lines of type line.
Feel free to share your toughts to what is missing or no can be improved.
Normally it should not trigger a new SQL read of the data so the overload will be only looping and make the computation. So a Function field in this case should be good enough.
I think we need also the description and summary because it can contain valuable information for business that mainly sale services and fill the description.
And also we should add a link to the actual sale line so it can be opened from there to see more details.
I think the relates should be from product and from party.
I think I asked for something similar here, as @maxx pointed out.
At the moment, my problem is that I need to check whether I invoiced all quarterly provision payments to my cooperation partners. Is there a smarter way than checking every single invoice?