Commit Graph

38 Commits

Author SHA1 Message Date
Daniel-CA 5e466d3507
[FIX] stock_account: prevent division by zero
In case of a move where source location = destination location, the result of
SUM(quantity) would be 0 and ending up with a division by zero.

Closes #12247
Closes #12423
2016-07-06 11:18:20 +02:00
Lionel Sausin 5537c5a13c
[FIX] stock_account: do not sum price unit
The view yields one line per stock move, with a price/unit on each line.
It doesn't make sense to sum price/units, the avg will be only meaningful when
grouping per product but it's correct in the default state.

Closes #11309
2016-07-06 11:16:07 +02:00
Nicolas Martinelli d951a7d5ee [FIX] stock_account: stock history view
The stock history doesn't take into account internal moves. For example,
in the following situation:
- Receive 1000 products to Internal Warehouse 1
- Move these 1000 products to Internal Warehouse 2

The 1000 products are still recorded on the Internal Warehouse 1.

opw-672277
2016-04-21 11:24:49 +02:00
Denis Ledoux 1d7c12022d [FIX] stock_account: valuation history with moves having multiple quant prices
The revision 29bd622521
aimed to improve the performance by changing
the view index, to use a BIGINT instead of a text.

It was assumed that the index used
(`stock_move.id`) could not appear
multiple times with the JOINs and
group bys defined.

This was in fact possible, if a
stock move is associated to
several quants with different costs,
because of the JOIN on the many2many table
`stock_quant_move_rel`
linking quants to moves,
and the GROUP BY
`price_unit_on_quant`
that caused the different moves/quants association
not to be merged within one unique line
if the costs on the quants are different.

Instead of the group by, we now aggregate the quants
costs, using the weighted average, so the index
used can be unique, as expected.

From now, the inventory value per line in
this report view can therefore
be different than what can be found on the quants,
but this report view is based on the stock moves
rather than the stock quants, and this is therefore accepted.

In other words, the inventory value is computed for the stock move
rather than for the stock quant.

opw-658903
2016-02-16 16:37:32 +01:00
Denis Ledoux ab245fcaa2 [FIX] stock_account: stock valuation at date total
When performing a stock valuation at date,
the stock valuation total wasn't equal
to the sum of each line of the report.

This is because the domain forcing the
date wasn't passed to the `search` call
when no group by was applied.

Indeed, when calling
`read_group` with a group by, the lines in the results
contains the domain used for each line, but when
there is no group by applied, this is not the case, the domain
is not included in the line dict returned by `read_group`.

In such a case, therefore, we must use the domain that was passed to
the `read_group` call.

opw-667761
2016-01-25 18:29:28 +01:00
Nicolas Seinlet 5c9897a83f [IMP] stock_account: rework on stock_history view joins
- Replace `LEFT JOIN` by simple `JOIN` for required fields
 - Use `JOIN ... ON (...)` syntax instead of implicit join `A.X = B.Y`
 - Remove of unused column quant_id

Closes #9197
opw-650598
2015-10-22 15:59:54 +02:00
Nicolas Seinlet 29bd622521 [FIX] stock_account: stock history performance
Using BIGINT id instead of Text
 - This doesn't change the behavior, just the variable type,
   while being much more efficient.
Using `UNION ALL` instead of simple `UNION`
 - This doesn't change the behavior either,
   as the ids of each sub select cannot collide

Closes #9197
opw-650598
2015-10-22 15:59:54 +02:00
Goffin Simon 8ef590bb28 [FIX] stock_account: stock inventory valuation
The function "open_table" is not called when triggering the action
window "Current Inventory Valuation". Then the 'history_date' is not
set in the context.

opw:649168
2015-09-16 14:18:40 +02:00
Lionel Sausin 4be4678d8b [FIX] stock_account: use all inbound/outbound moves when valuating
The valuation wizard is based on stock moves and currently only takes into
account the moves which have different companies in source vs destination
locations.
This is a problem because all user-created locations have a default company set
to the user's company, even the "virtual" ones. For example in the demo dataset
visible on runbot, some supplier locations have a company set and some don't.
So we have to make sure to include every move coming from/going to
outside locations based on the locations's type too.

Closes #7530
2015-07-09 11:39:14 +02:00
Josse Colpaert ce0027a6d0 [FIX] stock_account: In stock valuation report, if all products real price, don't do the product history price query 2015-07-02 14:10:03 +02:00
Denis Ledoux bdf980e4b4 [FIX] stock_account: stock valuation report without result
This is related to rev. 55b7f15ee2

Prevent crash when there is no line to display
in the stock valuation report
Reporting > Warehouse > Stock Valuation.

Like when there is not yet any data, or the filter gives no result

opw-643748
2015-07-01 15:59:51 +02:00
Denis Ledoux 55b7f15ee2 [FIX] stock_account: stock valuation report performances
Basically, computation of the `inventory_value` is now done
in batch instead of one by one.

In a real use case, the computation of the stock valuation
passed from 20+ minutes to less than a minute.

This revision contains an unusual SQL request:
`SELECT DISTINCT ON`
Basically, it returns the most recent line of table
product_price_history for each tuple
`(product_template_id, company_id)`
which is actually what we want, with good performances.

See postgresql doc for more information:
http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-DISTINCT

opw-641154
2015-06-15 16:28:13 +02:00
Goffin Simon c884be3be9 [FIX] stock_account: Current inventory valuation
The "Current inventory valuation" report should only take the outgoing quants into account
to compute the inventory value.

opw:632358
2015-05-04 08:46:33 +02:00
David Monjoie 2d215db686 [FIX] stock_account: compute total inventory_value when no product is specified
Without this fix, the 'Total' line of the pivot view does not display any inventory value, because there is no __domain as we are not asking the inventory value for any specific product.
2015-01-13 15:04:46 +01:00
Josse Colpaert 5dea263e1b [FIX] Change two-one step wh, multi-comp wh, quantity field float, show product_uom_qty instead of product_qty in mrp production for moves 2014-08-12 13:37:27 +02:00
Josse Colpaert c1cab32402 [FIX] Correction of stock valuation report 2014-06-10 17:11:18 +02:00
Quentin (OpenERP) 78a7ae966f [REF] product: get_price_history refactored and moved in product.template object
bzr revid: qdp-launchpad@openerp.com-20140505120743-zjviksa7o1mpawuf
2014-05-05 14:07:43 +02:00
Quentin (OpenERP) 7ed26f1e07 [REF] product refactoring: prices.history model renamed into product.price.history + passed 'date' as real parameter instead of contextual one in get_history_price() because it makes more sense.
bzr revid: qdp-launchpad@openerp.com-20140428153355-vbuam1hfnah7m4wp
2014-04-28 17:33:55 +02:00
Quentin (OpenERP) 2d205bfa81 [FIX] stock: lazy parameter of read_group added. stock_account: valuation history fixed/improved
bzr revid: qdp-launchpad@openerp.com-20140417095547-3vsz20v0x95iy02t
2014-04-17 11:55:47 +02:00
Josse Colpaert b1f3a496c6 [IMP] Correct for new way of stock valuation, add source
bzr revid: jco@openerp.com-20140416151825-et2m2syyt7duaffi
2014-04-16 17:18:25 +02:00
Josse Colpaert 2d1d25b005 [WIP] Correct stock valuation report
bzr revid: jco@openerp.com-20140416084849-kr0c2h8xqf1bw9vn
2014-04-16 10:48:49 +02:00
Josse Colpaert 888e13d22e [FIX] Add parameter in readgroup
bzr revid: jco@openerp.com-20140415091923-r5ipe0bevxrutxxh
2014-04-15 11:19:23 +02:00
Quentin (OpenERP) 522f87f03f [MERGE] stock reports in Qweb
bzr revid: qdp-launchpad@openerp.com-20140327174228-6beohyphca58nb00
2014-03-27 18:42:28 +01:00
Josse Colpaert 56af6792b5 [MERGE] Merge from trunk-wms-loconopreport-jco
bzr revid: jco@openerp.com-20140326155041-rryzcotazkzjcq8j
2014-03-26 16:50:41 +01:00
Josse Colpaert 0645597438 [IMP] Optimize stock valuation report more
bzr revid: jco@openerp.com-20140314111632-59lzfrboz6kpd94y
2014-03-14 12:16:32 +01:00
Josse Colpaert 13566b866e [IMP] Fasten up stock valuation report
bzr revid: jco@openerp.com-20140313174244-c7dg2thz6r7d5fek
2014-03-13 18:42:44 +01:00
Josse Colpaert dcb12c7db8 [MERGE] Merge from trunk-wms-loconopmerge2 + only keep good optims
bzr revid: jco@openerp.com-20140313170620-fq25a32fdlo3xrxy
2014-03-13 18:06:20 +01:00
Josse Colpaert fd5f6e7ccd [IMP] Testing report
bzr revid: jco@openerp.com-20140313081904-jzf1oiixe0nz7v2g
2014-03-13 09:19:04 +01:00
Josse Colpaert 04115a42d3 [WIP] Inventory value in stock valuation report
bzr revid: jco@openerp.com-20140312204125-qolc6yisb0rw6zfr
2014-03-12 21:41:25 +01:00
Josse Colpaert 146f04cff0 [FIX] Match reserved package should be correct
bzr revid: jco@openerp.com-20140307092953-zg05xusw9xctol8b
2014-03-07 10:29:53 +01:00
Josse Colpaert 428d5e1af1 [FIX] Take case product in ops exist, but not in move
bzr revid: jco@openerp.com-20140306160106-ydz47uoh66d1nbip
2014-03-06 17:01:06 +01:00
Quentin (OpenERP) 9550c32409 [MERGE] usability improvements among several modules/screens
bzr revid: qdp-launchpad@openerp.com-20140214145712-j8dmf06wy49x9l50
2014-02-14 15:57:12 +01:00
Cedric Snauwaert b8826aaa30 [FIX]various usability thing
bzr revid: csn@openerp.com-20140212124646-301rfsr1712cdy18
2014-02-12 13:46:46 +01:00
Quentin (OpenERP) 1e4d89bf79 [IMP] stock_account: usability of stock value at date report
bzr revid: qdp-launchpad@openerp.com-20131206165956-75u2srxtb7mbusyq
2013-12-06 17:59:56 +01:00
Quentin (OpenERP) 823e945477 [FIX] stock_account: fixed the stock valuation at date report
bzr revid: qdp-launchpad@openerp.com-20131206165006-47db8kyuxjm8s0bo
2013-12-06 17:50:06 +01:00
Quentin (OpenERP) 3115161c29 [FIX] stock_account: fixed the stock valuation at date report
bzr revid: qdp-launchpad@openerp.com-20131206163307-zurim6dmg30pxnzl
2013-12-06 17:33:07 +01:00
Quentin (OpenERP) f8470c94ee [REF] stock: put some order in inventory psql reports (on quants) in labels, files and code
bzr revid: qdp-launchpad@openerp.com-20131205181052-gsnlps6ifvm016az
2013-12-05 19:10:52 +01:00
Quentin (OpenERP) cdf7f97389 [IMP] wizard to get the stock valuation for a past date
bzr revid: qdp-launchpad@openerp.com-20131204105920-565t0ijcyue6ydkx
2013-12-04 11:59:20 +01:00