Commit Graph
127290 Commits
Author SHA1 Message Date
Ankita Raval 5a34d64a44 [FIX] mrp: bom structure report
The "BoM Structure report" should not include the cost of the products
as it is often shared with third parties. We now only display the cost
on the "BoM Structure and Cost report" and remove the "BoM Cost report"
as it is redundant with the former.

Task Id: 1969709

closes odoo/odoo#33323

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-11 12:39:15 +00:00
Romain Derie 2ed1a5bef8 [IMP] website: remove noupdate for debug page's arch
Before this commit, those pages would be flag as noupdate.
If not modified, those view would not get modification on module update, which
is not logic.

Now, those view will benefit from any update. It makes even more sense since
multi-website as those views will never get modified directly (it will COW).

closes odoo/odoo#33920

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-11 09:07:17 +00:00
William Henrotin 8e62c63a73 [FIX] mrp: increase tolerance date tests
The tests relative to workcenters planning takes (sometimes) long time
to be executed. Before investigation more deeply, this commit relax a
bit more the tolerance delta in the test comparison

closes odoo/odoo#33939

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-11 08:32:30 +00:00
Dhaval Panchal f5ccd36b29 [IMP] purchase_stock: propagation of cancel
This commit aims to propagate the cancellation of a purchase order or a
request for quotation to the relative stock moves. And thus respect the
configuration of the stock rule.

Task 1913297

closes odoo/odoo#33803

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-11 07:57:04 +00:00
Dhaval Panchal a580538e98 [IMP] stock, mrp, purchase: default value for cancel propagation
cancelling propagation in a move chain was True be default. That means,
without any configuration, a cancel move will always cancel its next ones

This commit change the default to allow only cancelation of move chain
until the stock location. Here are 2 examples :
 1. Reception and delivery in 3 steps. The moves chain is the following:
    Vendor -> Input -> Quality -> Stock -> Pack -> Output -> Customer
  In case the Purchase order is cancelled, we want to move from Vendor to
  Stock are cancelled but not the ones from Stock.

  2. pbm + sam. The manufacturing process is the following;
    Stock -> Pre-prod -> Production -> Post-prod -> Stock
  cancelling the first move should cancelled until Production and not after

Task : 1913297
2019-06-11 07:56:11 +00:00
Dhaval Panchal 1ccca8d267 [IMP] stock, mrp, purchase: rename propagate into propagate_cancel
This commit rename propagate field into propagate_cancel to be
more consistent with c514e8ae6a (introducing
propagate_date)

Task : 1913297
2019-06-11 07:56:11 +00:00
Dhaval Panchal a24fe59d3c [FIX] purchase_stock: fix typo
Task-1913297
2019-06-11 07:56:11 +00:00
Romain Derie 1419b21aec [FIX] website_sale_comparison: tests should be in correct folder
Since d6847bacb1, test-tours should be in a specific folder and asset.

Closes #33961

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-06-10 21:42:26 +00:00
Romain Derie 873fd422be [FIX] web, web_editor: use isDebug rather than debug on config
Since 72f7139f52, config.debug does not exist anymore, config.isDebug()
should be used.

Two commits merged at the same time were still using config.debug, 87a35d4263
and 88a26235ca

Closes #33961
2019-06-10 20:13:23 +00:00
Robot Odoo 1cc92e1de2 [MERGE] stock_account, related addons: stock valuation layer
task-1875873

closes odoo/odoo#33935

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-11 11:37:38 +02:00
Thomas Werland 515fb62fc4 [IMP] base_geolocalize,web_editor,doc: create map_view
In order for the map view to work properly:
- I moved scss property to a  file only scoped to website module.
- moved the definiton of "partner_latitude" and "partner_longitude" from
base_geolocalise to base/res.partner

closes odoo/odoo#32487

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-11 07:36:53 +00:00
Pierre Masereel 3a7b4b424a [FIX] point_of_sale: currency based on company set on the config
Since recent changes in multi company of odoo, the self.env.company is
only the preffered company and not the only selected anymore. So the
currency of a pos config is based on the pos config one and has nothing
to do with the one choosen by the current user.

closes odoo/odoo#33947

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-06-11 07:20:39 +00:00
Pierre Masereel 2cb0ec1cad [FIX] pos_restaurant: shop doesn't exist anymore in pos
The variable 'shop' that was set for POS receipt, was actually the stock
location and has been removed. But we forgot to remove its use in
pos_retaurant.

related commit: 8e30349fd1
2019-06-11 07:20:39 +00:00
Simon Lejeune 74a7291242 [FIX] purchase_stock: fix tests
Sale adds valued products in the default category, some tests change the
valuation of the default category and input_aml is hence wrong since it
contains aml of other products. Create a new product and category to
avoid side efffects.

Also, copying a product template and accessing its variant doesn't seem
to work anymore, i don't know why yet.

task-1875873
2019-06-11 05:18:50 +00:00
Simon Lejeune b058f1bd18 [FIX] purchase_stock: key <built-in function id> is not a string
stems from 3936d655c4
why the urnbot isn't red before this branch is beyond me at the moment.

task-1875873
2019-06-10 20:43:30 +00:00
Simon Lejeune 8b965ba294 [REF] stock_landed_costs: add a cost method change test
task-1875873
2019-06-10 20:43:30 +00:00
Simon Lejeune ad911da1ff [REF] stock_account: more fifo tests
task-1875873
2019-06-10 20:43:30 +00:00
Simon Lejeune f12a616c29 [REF] stock_account: cost method change with valuation layers
The examples are implemented at TestStockValuationChangeCostMethod.

The idea is that we want to keep some trace of cost method change and
keep the consistency of the data (eg what about a fifo stack when
changing to standard, that sort of things). We thus implement a simple
logic: when changing the cost method, empty the current valued stock
with the old cost method and refill the stock with the new one.

Some cost method changes are neutral accounting wise, others not.

The rationale is that cost method changes are a hard configuration changes
and databases where users changed cost method are undebuggable because
it is not possible to understand the resulting accounting entries.

The change of valuation (auto to manual and conversely) is not well
defined at the moment.

task-1875873
2019-06-10 20:43:27 +00:00
Simon Lejeune 68d8e49f2f [REF] stock_landed_costs: adapt to valuation layers
We need to increment the value of another layer. We don't  want to write
on this layer in place as we used to do for multiple reasons:
- valuation at date: before the application of an lc, the value should
  not change
- if the layer was consumed, we would need to adapt the consumers and
  if one day we would have needed to understand what happened in the
  fifo stack it would be hell

So we allow to create a valuation layer linked to another valuation
layer through a simple M2O O2M. At the time it is only used on the
landed costs to add value and no quantity so the code expects it would
be the case and it is not enforced. We adapt `_run_fifo` to use the full
value.

We also add a stat button on the landed cost to access the valuation
layers, like what is done for the picking and manufacturing orders.

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 1e5624ba68 [REF] sale_mrp: tests: adapt to valuation layers
- always use the wizard to change the standard price

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 72715f2320 [REF] purchase_mrp_subcontracting: tests: adapt to valuation layers
- read the value of a move on its linked valuation layer

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 3b032287c2 [REF] purchase_stock: tests: adapt to valuation layers
- the price unit used is set on the layer
- the stock valued field is now named `value_svl`
- the vacuum is ran at each receipt

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 7dd7ba86a0 [FIX] account: action_invoice_open
Marking the invoice as open before creating the account moves breaks the
anglo saxon code as the invoice is considered openned before the account
moves are even created, see _get_anglo_saxon_price_unit of sale_stock
and the computation of qty_done (which should be renamed invoiced qty).

We did not test all the implications of this commit since the invoice
model will be removed anyway.

related to rev 299f9f1eb0

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 4c47061326 [REF] stock_dropshipping: adapt to stock valuation layers
The tests of this module showed multiple issues with the anglos axon
accounting entries creation so we fix them by getting the value on the
valuation layer and not directly on the stock moves.

About the changes in
test_crossdock.py
> To change a standard price, we need to open the wizard
test_lifo_price.py
> To change a standard price, we need to open the wizard + read the
  valuation on the layers.
test_stockvaluation.py
> Now that we create a layer in and out for a dropshipped move, the
accounting entries are similar to an in followed by an out, thus we need
to increment the number of generated AML. Not that the balance of the
accounts stay the same.

There's a slight change in fifo_perpetual_anglosaxon_ordered though.
Let's say for a start that this config doesn't make sense. Ordered means
we don't read the value on the stock move to create the accounting
entries but only the standard price. We had to change 8 by 10 in this
test because, before this task, the standard price was updated when
running fifo, even in dropshipped. As the PO line was valued at 8, the
anglos axon in stock out was at 8 because the standard price was changed
to 8 after the delivery.

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 7c12322802 [REF] stock_account: journal entry creation
No more hijacking _account_entry_move with context keys.

_get_accounting_data_for_valuation
> no changes
_prepare_account_move_line
> only use the cost, not the value in context
> take description as arg to pass it to _generate_valuation_lines_data
_generate_valuation_lines_data
> use the description received in arg
> remove forced ref in context
_create_account_move_line
> add a qty, descritpion, cost, svl_id as arguments
> remove forced_quantity fron context
_account_entry_move
> add a qty, descritpion, cost, svl_id as arguments

task-1875873
2019-06-10 20:43:00 +00:00
Simon Lejeune 6fd05759e7 [REF] stock_account: remove old valuation code
The new code was sitting next to the old one, now that everything is
adapted (minus the cost method changes), we can remove the old one.

We also adapt the valuation wizard to use the stock valuation layer
action, now that the others are removed.

task-1875873
2019-06-10 20:42:59 +00:00
Simon Lejeune e93ede220d [REF] mrp_account: adapt to valuation layers
A finished move is considered as an incoming move and will pass by
_create_in_svl. We thus compute the price_unit that will be set on the
valuation layer.

We also set a stat button on the MO displaying the valuation
layers, similar to the one on the picking.

task-1875873
2019-06-10 20:42:59 +00:00
Simon Lejeune 5c62700698 [REF] stock_account: dropshipping valuation
We standardize the dropshipping by handling it as it was an receipt
directly followed by an out.

We also follow the same logic whatever the cost method, ie we don't run
fifo or update the AVCO.

task-1875873
2019-06-10 20:42:59 +00:00
Simon Lejeune 36f701e9d7 [REF] stock_account: add a small test for standard negative
task-1875873
2019-06-10 20:42:59 +00:00
Simon Lejeune c4f25ac615 [REF] stock_account: AVCO "negative" tests
Now that the vacuum is implemented and ran in AVCO, we can unskip the
old avco negative tests and implement new ones in
test_stockvaluationlayer to explain why we wanted to run the vacuum in
AVCO (see test_negative_1).

task-1875873
2019-06-10 20:42:59 +00:00
Simon Lejeune 54d1adf31a [REF] stock_account: fifo "negative" cost method with valuation layers
Re-implement _run_fifo_vacuum on the product this time with
float_is_zero and without remaining_value.

Trigger the vacuum at each receipt. Before it was done in the scheduler
each night, meaning the valuation on the move was not really
understandable nor consistent (the estimated value could be fixed by
some other move than the next receipt).

task-1875873
2019-06-10 20:42:59 +00:00
Simon Lejeune 8d21d0f888 [REF] stock_account: fifo "normal" cost method with valuation layers
We don't implement fifo negative handling in this commit.
We make sure we run fifo in average mode to get a proper remaining_qty
field.
`_run_fifo` is now a method on product (since it could be user outside
of a stock move context). It is really similar to its ancestor on the
stock move, with a few float_is_zero and compare more and a missing
remaing_value.

We move the valuation sanity check into a proper helper,
_sanity_check_for_valuation.

We complete the _create_correction_svl method with accounting entries.

task-1875873
2019-06-10 20:42:56 +00:00
Simon Lejeune 168f4d75ef [REF] stock_account: average cost method with valuation layers
One of the goal of this refactoring is also to run the vacuum when the
cost method is AVCO. This will be used allow already out landed cost
on AVCO and also to have a consistent value when going into negative.

We update `_prepare_in_svl_vals` to set the remaining_qty field that
will be used when fifo is implemented. On the stock move, we create the
layer in with the real price unit of the move and adapt
product_price_update_before_done. This method will now compute the AVCO
according to the quantity valued in stock (quantity_svl) instead of all
the quantities in stock (qty_available), which was wrong (qty_available
could contain consigned quants).

We also make sure to recompute the avco when editing a done move.

We don't implement yet the negative handling as we'll need fifo for
that.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 6127608cae [REF] stock_account: standard cost method with valuation layers
Valuation of standard move: We introduce _create_in_svl and
_create_out_svl and call these method in _action_done only on the
standard move, the other valuation methods still use the old code. We
hijack _account_entry_move to create journal entries anyway for the
valuation layer with a minimal diff. Helpers for the valuation layers
creation are added on the product because we will need to create similar
layer without stock move later on when we'll implement changes of cost
method. We also make a first implementation of the edition in the past
to make some tests pass, it will be completed with other cost method
implementation

Change of standard price: Before this commit, the wizard to change the
standard price was only displayed in perpetual, because it was used to
create accountign entries. We also use this wizard in manual now,
because we want to create a stock valuation layer. Fortunetaly, the
accounting fields of this wizard are not required if the product has a
manual valuation. And the new method is private.

We adapt the existing tests as well as we can and include the start of a
new battery of tests: test_stockvaluationlayer.py

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune fb65f8c916 [REF] stock_account: minor lint in account_move.py
task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 2c77efb05c [ADD] stock_account: stock valuation layer
This commit brings the model, views and compute method for the value and
the quantity valued. An ir rule prevents to read the value of another
company. Stat button are added on done picking to access the generated
layers.

Further commits will adapt one by one the cost method to actually use
the stock valuation layer when

As the goal is to move the valuation fields away from the stock move, we
set the necessary fields on the layer. Note the absence of `remaining_value`.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 7a27d52d71 [REF] stock_account: refactor _is_* helpers
Before this commit, there were the `_is_in`, `_is_out`, `_is_dropshipped`
and `_is_dropshipped_returned` helpers on stock move. These methods were
called on the stock moves upon their validation to know if they should
be valued.

But the valuation of a stock move actually depends on its move lines[0].

These helpers weren't convenient enough since every cost method should
implement the logic to get the valud quantity (see _run_valuation and
_run_fifo).

We add helpers returning in and out move lines and `_is_in` and
`_is_out` to use these helpers to decide their return value.

We also expose a list of valued type (`_get_valued_types`) that will be
used in the move validation to check every `_is_*`helper without calling
them explicitely. Once we'll know the valued type of each move to
validate, we'll be able to call the methods actually doing something
with the valuation in batch. We prepare this in _action_done to lay the
foundation of the batch calls when the stock valuation layer will be
implemented.

We took the opportunity to fix an edge case of the consignment: if the
owner of a move is the company of the move, it should be valued.

[0] 48f4ce4afa

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 977169feeb [REF] stock_account: unit price of rereturn
`_get_price_unit` is used to get the price to value a stock move and
returns `unit_price` if present (most of the times it is set by purchase_stock
to copy the price unit of po line) or the standard price.

Note that a return copies the original move and `price_unit` is set as
copy False.

Before this patch, a return of a return used the standard price (due to
the copy False), which doens't bring any issue but could be confusing
as explained in the following receipt scenario.

On a receipt, return and rereturn. The original and rereturn move may
not have the same price if the standard price has changed between the
operations, which is weird since there's a unit price on a potentially
linked po line.

On an delivery, there won't be any effect since the valuation methods do
not use the result of `_get_price_unit` but force it to the standard
price (standard and avco) or run fifo.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 0477bdb75a [REF] product, stock_account, etc: remove product.price.history table
This table tracked standard price changes.
It was used to compute the valuation at date in AVCO and standard
through `get_history_price`.

The next commits will introduce the stock valuation layers, separating
the valuation from the stock move. As a valuation layer will be created
when a standard price is updated on the product or when a stock move
impacts the valuation, the information from this table will be
duplicated.

We don't plan to adapt `get_history_price` to work with the valuation
layer since the valuation report at date and today will be the same: a
grouped list on the valuation layers with eventually a domain on the
date.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 72693c1d0a [REF] stock_account: make property_stock_journal required in the view
As journal_id is required on an account move, this field should not be
treated differently as the other accounting fields on this view.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune f30ca1687d [FIX] purchase_stock: don't call _is_dropshipped on an empty recordset
We will enforce an `ensure_one` in a further commit.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune f81eb396e9 [REF] stock_account: stock move to its own file
No changes on the code. Actually a rename of `stock.py`.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune e9ca33de8d [REF] stock_account: stock picking return to its own file
No changes on the code.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune d6b3536119 [REF] stock_account: procurement group to its own file
No changes on the code.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune da983190c8 [REF] stock_account: stock move line to its own file
No changes on the code.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 95b4fd1a25 [REF] stock_account: stock location to its own file
No changes on the code.

task-1875873
2019-06-09 14:11:36 +00:00
Simon Lejeune 806d0a52a1 [REF] stock_account: stock inventory to is own file
No changes on the code.

task-1875873
2019-06-09 14:11:36 +00:00
Robot Odoo 5c0f4e8122 [MERGE] sale_rental: new renting application
New Rental App (sale_rental) : community side.

1. Product configurator:
Refactoring to ease product configurator extension (e.g. rental configurator)
Closes #33371

2. Event_sale
Fix tests of event configurator s.t. they still work when sale_rental is installed (with its extension of the product configurator).

3. Sale
XML names for XPath in rental extension
Minor UI changes

[Enterprise PR](https://github.com/odoo/enterprise/pull/3939)

Related to #30855
Task 1909410

closes odoo/odoo#32210

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-06-09 01:43:44 +02:00
Victor Feyens 9cfe599973 [FIX] event_sale_product_configurator: remove files brought back by conflict 2019-06-07 11:33:42 +00:00
Victor Feyens 1f0721acf0 [FIX] Purchase description string 2019-06-06 06:52:26 +00:00