Commit Graph
134 Commits
Author SHA1 Message Date
Josse Colpaert 8c64159b88 [FIX] stock_account: valuation report needs company_owned in context
When calculating the stock_value of a product,
the system will take into account all the locations
that have this company as company.  (that way if owner_id
is not set, the company_id on the location is the owner (virtual: not set))

The Qty on Hand field takes into account however
the quantities that are in the warehouses.

This could lead to weird situations where the Quantity On Hand is 0
and so the record is not shown, while the stock value is positive.
(e.g. stock in Transit)

In order to use the same logic for both fields, we pass company_owned=True
in the context.
2018-04-18 17:42:22 +02:00
Simon Lejeune 352875a5a0 [REF] stock_account: valuation at date wizard
We add the valuation at date wizard by re-using the quantity at date
wizard and adding a context key to separate the both.

The same view/action is used when openning the current or at date
valuation, only the `to_date` context key is changed.
2018-04-16 11:26:49 +02:00
Simon Lejeune ce4da0531d [REF] stock, stock_account: inventory and valuation report
Kind of switches the behavior for inventory and valuation report,
meaning allows the user to see the quantity at date and disallow him to
see the valuation at date.
2017-09-25 15:34:55 +02:00
Simon Lejeune af43b0c3fc [REF] stock_account: valuation wizard: run _fifo_vacuum if needed 2017-08-25 16:10:20 +02:00
Simon Lejeune 9e861febd5 [FIX] stock_account: valuation wizard
The invisible attrs was not working anymore since the new view, where 0
is different than False.
2017-08-25 16:10:20 +02:00
Pierre Masereel 0867c3c09b [FIX] stock, stock_account: move, move_lines and quant view
Set views and menu items for quant, moves, move_lines and inventory
valuation.
2017-07-28 13:43:51 +02:00
Josse Colpaert 5e5cd08123 [REF] stock_account,etc: FIFO and average costing method
The new implementation of stock moves the cost of products from quants to
moves. So we have implemented the FIFO and average cost method based on
those moves instead of using quants.
 - When average price is choosed, a field average_price is set on the
   product.
 - The tests have been completed with an example of how fifo work with
   negative stock.

As the use of real price method is really rare, because of the rigor
required on traceability for such method, we removed this functionnality.
 - The tests purchase/test/fifo_price.yml have been adapted to use the
   FIFO costing method instead of real price.

The old report stock history doesn't exist anymore, and is replaced by
the move view that contains all the cost information.

The methods `get_price_unit` have been moved from the stock to
stock_account.

The methods `_set_default_price_moves` and
`set_default_price_unit_from_product` have been removed from stock.

Explaination of FIFO and average:
 - In action_done for an out move in average and fifo, the price_unit and
   stock_value are updated.
 - For FIFO, it will use the qty_remaining on the in moves to check from
   which in moves to take the stock values for the out.
 - In case of negative stock in FIFO, it puts also qty_remaining on OUTs.
 - In the case of average, it will take the cumulated value of the last
   move and divide it by the quantity in stock.  

This commit is pretty much a 'work in progress':
 - Edit 'done' moves when the costing method is FIFO doesn't trigger the
   replay the FIFO stack.
 - The landed_costs feature doesn't work.
2017-07-14 17:08:22 +02:00
Aaron Bohy 787daee41f [FIX] stock_account: inventory valuation: default value
... for 'compute_at_date' field (default 0, 'Current Inventory').

Before the new views, this value was selected by default by the
FieldRadio, but it was a mere coincidence. Indeed, as the field
had no default value, no value was specified in the default_get,
and for no reason, the widget selected 0 as value.

Anyway, as this behavior was wanted, we simply specify a default
value in the action.
2017-05-18 13:55:46 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Christophe Simonis fded0065ae [MERGE] forward port branch saas-14 up to 6c4389df41 2017-01-23 14:51:11 +01:00
Christophe Simonis 6c4389df41 [MERGE] forward port branch 10.0 up to 6804085b8c 2017-01-23 14:33:53 +01:00
Nicolas Martinelli 79bd2f3062 [FIX] stock_account: inventory at date
The "Inventory at Date" has several issues:
- graph and pivot views are not available despite their existence
- the views are not linked to an action, thus it is impossible to save
  it on the dashboard.

opw-703649
2017-01-23 09:19:23 +01:00
Nicolas Martinelli dfd5cf9563 [IMP] stock_account: Counter-Part Account
In commit 40bd4a2f05, the counter-part account is made selectable and
required when changing the price of a product.

However, the same wizard is reused for the "Compute from BOM" feature,
in module `product_extended`. This forces the user to set an account
even if the product valuation is not "Perpetual (automated)".

In this commit, the field becomes required only if the product valuation
is "Perpetual (automated)".

opw-697866
2017-01-16 08:35:35 +01:00
Christophe Simonis 7eb8ed2769 [MERGE] forward port branch 10.0 up to 3d085f6 2016-11-08 15:13:05 +01:00
Nicolas Martinelli 143c998bba [FIX] stock_account: default new price
When modules `product_extended` is installed, click on "Compute from
BOM" on the product view. It opens a wizard with a default new price of
zero, even if the components of the product have a price defined.

This is an oversight of 191994577. When calling `default_get`, the
default values set thanks to context keys `default_*` have already been
replaced.

opw-693053
2016-11-08 08:32:35 +01:00
Mitali Patel 81acd4dee2 [IMP] stock_account: merge inventory reports menus
Previously we had 'Inventory at Date' (debug mode) and 'Inventory Valuation'
Both have been merged into 'Inventory Valuation' that pops up a wizard asking
whether you want the current one or the one from a specific date.

Depending on which one you choose you will get either report from the previous
menus. (stock.quant or stock.history model)
2016-11-02 13:59:54 +01:00
Thibault Delavallée 665d1ec146 [FIX] various: fix digits_compute attribute changed to digits in new API 2016-08-09 11:03:12 +02:00
Divyesh Makwana 1919945770 [MIG] stock_account: new API 2016-07-12 17:53:07 +02:00
mdi-odoo 6a824e4a5e [MOV] stock_account: reorganize module 2016-07-12 17:52:29 +02:00
Thibault Delavallée 168807a255 [IMP] product: get_history_price multi to ease migration
This method is used only in stock_account that is about to be migrated
into the new API. To ease the migration the method is converted into
a multi method, using a decorator.
2016-07-12 17:51:28 +02:00
Christophe Simonis 05e0bf3f1b [MERGE] forward port of branch saas-11 up to e7190cb 2016-07-06 00:03:49 +02:00
Nicolas Martinelli 51cdffcb9e [FIX] stock_account: default new price if compute from BoM
When the new standard price is computed from the BoM (thanks to module
`product_extended`), the price suggested is still the standard price of
the product.
2016-07-05 09:43:29 +02:00
Martin Trigaux af25dfd278 [IMP] stock_account: less ambiguous name
In stock_account, move may refer as accounting or stock move.
Fixes Transifex issue.
2016-07-04 17:21:02 +02:00
Nicolas Martinelli d743870920 [FIX] stock_account: change standard price in perpetual valuation
When the standard price is changed for a product in perpetual valuation,
the account used is the expense account on the product, while it should
be the Counter-Part Account specified in the wizard.

This adapts the commit 935e61bab5 to work with 40bd4a2f05.

opw-681846
2016-07-04 14:49:22 +02:00
Jainik Patel 919bee4058 [IMP] stock: Lot/Serial Numbers label uniformization
In master , some places the string "Lot" is used and at some places
"Serial Numbers" is used , which is very confusing for the user.

Make a common string "Lots / Serial Numbers" everywhere for the uniformity.
2016-06-10 15:03:44 +02:00
Christophe Simonis 4d337f72ed [MERGE] forward port of branch 9.0 up to ac7beb3 2016-04-25 13:33:01 +02:00
Christophe Simonis ac16454965 [MERGE] forward port of branch saas-6 up to ba34df1 2016-04-25 12:40:13 +02:00
Christophe Simonis ba34df1ead [MERGE] forward port of branch 8.0 up to 0410d11 2016-04-25 11:56:52 +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
qdp-odoo 7a3d63b377 [MERGE] forward port of branch saas-7 up to revision 71d16a369e 2016-03-16 10:27:19 +01:00
Christophe Simonis d1067cf83f [FIX] stock_account: avoid duplicate ids in stock.history
Since 27a7cab52b, it may happen that the
stock.history view contains duplicated id (mutliple quants with
different lots for a single move).

Regroup serial numbers in order to keep a unique id per row.

opw-669349
2016-03-09 12:51:33 +01:00
Christophe Simonis 87a01c75ef [MERGE] forward port of branch saas-7 up to 5be43b8 2016-02-17 18:01:11 +01:00
Christophe Simonis d1a79ec704 [MERGE] forward port of branch saas-6 up to 9363372 2016-02-17 16:28:56 +01:00
Christophe Simonis 9363372efe [MERGE] forward port of branch 8.0 up to 0f46e6a 2016-02-17 16:20:23 +01: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
Goffin Simon 935e61bab5 [FIX] stock_account: "Set standard price" button
When a product with costing method = standard price and inventory valuation = perpetual (automated),
the button "Set standard price" in General information in  "product.template" is shown if the
product template has only one variant. In the other case, the button is displayed in the variant
view form.

opw:668568
2016-02-11 15:02:41 +01:00
Christophe Simonis 78d20b552b [MERGE] forward port of branch saas-8 up to 7e44ddc 2016-01-27 12:24:04 +01:00
Christophe Simonis 2ce9311cfe [MERGE] forward port of branch saas-6 up to a576f2b 2016-01-26 19:13:41 +01:00
Christophe Simonis 50b0b075a9 [MERGE] forward port of branch 8.0 up to ab245fc 2016-01-26 14:04:55 +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
qdp-odoo 40bd4a2f05 [IMP] stock_account: let the user choose the counterpart account used in price adjustment wizard for products in perpetual inventory. Fixes #9856 2015-12-02 17:26:47 +01:00
Denis Ledoux f9efc14440 [MERGE] forward port of branch saas-6 up to cea0a80252 2015-11-02 17:24:30 +01:00
Denis Ledoux 3db7cc4673 [MERGE] forward port of branch 8.0 up to f2bc45f 2015-10-23 11:33:24 +02: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
Christophe Simonis 57168a9e90 [MERGE] forward port of branch saas-6 up to a669433 2015-09-23 14:34:26 +02:00
Denis Ledoux a3648fd23a [MERGE] forward port of branch 8.0 up to aabbdc7 2015-09-21 16:01:58 +02:00
Josse Colpaert 9ac8d9830e [FIX] Change price history and stock valuation report to standard_price on variant
As the standard price on the product template changed towards the product variant,
we should also change the product price history to be by variant.

Also the inventory value calculated in the Stock Valuation report should be by variant.
2015-09-16 15:25:03 +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
Nicolas Martinelli 1017b0b952 [IMP] stock*: adaptation due to the new Sale module
Major changes:
- No use of UoS anymore
- Remove invoicing process

Reason: complete rewrite of the Sale module.

Responsible: fp, dbo, nim
2015-08-27 19:21:37 +02:00