Commit Graph
111635 Commits
Author SHA1 Message Date
qdp-odoo b2f2006b7f [FIX] account: sequence_number_next fixes.
-changing the date_invoice field do not reset anymore the sequence_number_next (it now only affects the prefix)
-the date_invoice is now passed as ir_sequence_date AND ir_sequence_date_range in the context, for sequences that use the date_range feature in prefixes
2017-08-30 09:16:47 +02:00
Xavier Morel 1222422333 [FIX] p3: race condition when *reloading* an existing db
When re-launching Odoo on an existing database in Python 3.6[0] it's
possible that the scheduler will preempt the main thread
mid-module-import and run the cron thread which causes registry (and
module) initialisation with only a subset of the Python files loaded
and thus e.g. tries loading auth_crypt with a registry in which none
of res has been loaded makes for interesting situations.

Delay spawning the cron thread until *after* the registry preload at
least, though I don't think that actually entirely fixes the issue.

[0] and probably in any Python >= 3.3, I'm guessing it's related to
    the per-module import locks which replaced the old global lock:
    https://docs.python.org/3.3/whatsnew/3.3.html#a-finer-grained-import-lock

    though since ir.cron has little reason to import anything it could
    also just be Python 3 scheduler changes which allow/cause a
    context-switch during imports while the Python 2 scheduler would
    not allow that. IDK.
2017-08-29 16:54:32 +02:00
amoyaux 209fd529f8 [FIX] stock : check backorder compare apples and oranges.
The function that checks if we need a back oder or not compares
the initial demand and the quantity processed on the picking.

When unit of measure are activated the initial demand (product_qty)
uses the uom of the product. However the quantity processed on the move
(quantity_done) uses the uom of the move.

This commit uses product_uom_qty instead of product_qty. Product_uom_qty
represents the initial demand transformed with the uom of the move.
It also add a small test with a back order that ensure the quantities
are correct.

It also repairs the test stock flow where in some case immediate transfer
return the back order wizard instead of processing the move. In these cases
we catch the back order wizard and run it.
2017-08-29 15:22:07 +02:00
Christophe Simonis 5f37b8b315 Revert "[FIX] stock: delivery slip UOM"
Change unwanted in saas~17

This reverts commit b0d498c11d.
2017-08-29 10:50:16 +02:00
Christophe Simonis d0f132b297 [MERGE] forward port branch saas-16 up to 4ac347735d 2017-08-28 14:49:11 +02:00
Christophe Simonis 4ac347735d [MERGE] forward port branch saas-15 up to 063381e0f6 2017-08-28 14:02:35 +02:00
Pierre Masereel b3b6267cf0 [FIX] stock: add decoration muted on move cancel 2017-08-28 13:59:12 +02:00
Pierre Masereel b7a84cd997 [FIX] mrp: production_id on move lines
When the move lines were created manually, there were no production_id
set on them. So we pass it through the context in the 'Register Lots' view.
2017-08-28 13:53:28 +02:00
Christophe Simonis 063381e0f6 [MERGE] forward port branch saas-14 up to e18fe88751 2017-08-28 12:14:38 +02:00
Christophe Simonis e18fe88751 [MERGE] forward port branch 10.0 up to 22eb3ee971 2017-08-28 12:13:05 +02:00
Christophe Simonis 22eb3ee971 [MERGE] forward port branch saas-11 up to 428ad2dfe3 2017-08-28 11:30:46 +02:00
Christophe Simonis 428ad2dfe3 [MERGE] forward port branch 9.0 up to b5aaf0d527 2017-08-28 11:27:40 +02:00
Goffin Simon 9e74756e39 [FIX] project: "Activate a sample project" doesn't work
Typo error.

opw:765673
2017-08-28 11:20:23 +02:00
Nicolas Martinelli b0d498c11d [FIX] stock: delivery slip UOM
1. Create a product A, set to stockable product, set its UOM and
   purchase UOM to Unit(s)
2. Create SO with A, but use a different UOM than Unit(s) (e.g. Dozen)
3. Validate, go to delivery, validate, and print the delivery slip

Ordered quantity shown on delivery slip is in SO UOM but listed as
product UOM.

opw-766914
2017-08-28 08:42:50 +02:00
Odoo Translation Bot 32078bba33 [I18N] Update translation terms from Transifex 2017-08-27 07:14:46 +02:00
Odoo Translation Bot bb28a2d7f6 [I18N] Update translation terms from Transifex 2017-08-27 04:40:12 +02:00
Joren Van Onder b5aaf0d527 [FIX] point_of_sale: handle fiscal positions that remove taxes
A tax can be mapped to nothing, so first check if
_map_tax_fiscal_position actually returned something.

Fixes #17963
2017-08-26 15:25:35 -07:00
Aaron Bohy dc07fc8bac [FIX] barcodes: tests: don't add undefined widget to registry
Resetting the key 'test_barcode_handler' to its value before the
test was technically the best solution, as a test should leave the
environment unchanged. However, in this case, the widget is
undefined (there is obviously no 'test_barcode_handler').
Whereas this should not be a problem (the fields in the registry
are supposed to be accessed using get(), and the presence of a
key mapping undefined is equivalent to the absence of the key in
this case), this breaks a test in Studio if the latter one is
executed after the barcode test. This is because Studio browses the
map of the field registry to access each field's prototype. When it
encounters an undefined value, it crashes.
2017-08-25 18:55:50 +02:00
Christophe Simonis feb97a9d7d [FIX] web: bump test timeout 2017-08-25 18:03:14 +02:00
Richard Mathot 0c1c93002c [FIX] base_automation: race condition on time-based automated action
When used on a large db with lots of records to process, `last_run`
date that was written on the base.automation could be a few seconds
later than `now` that was used to check whether to run the automated
action. This caused some small time frames to be never checked, and some
records to be missed. We fix this by using exactly the same timestamp.

opw-766182
2017-08-25 16:40:22 +02:00
Aaron Bohy 6df482eb99 [FIX] barcodes: barcode handlers should return a deferred
This was the case about 15minutes ago. But before pushing we
decided to change the Barcode override of FormController to
directly use handlers of the FormController when it could (e.g.
to handle 'Edit', 'Discard' actions). This wasn't a good idea as
those handlers don't return anything, and the barcode mechanism
requires its handlers to return a deferred. So basically, it
crashed when such a barcode was scanned. Having a test suite is
nice, but you should not forget to relaunch it before pushing...
2017-08-25 16:13:57 +02:00
Simon Lejeune 757758624f [REF] purchase: adapt tests
avergae price is now merged back in standard_price
negative stock are only corrected by the vacuum, so call it
2017-08-25 16:10:20 +02:00
Simon Lejeune 3ed024e898 [REF] stock_account: make standard price readonly if perpetual
This was the case in saas-16.
2017-08-25 16:10:20 +02:00
Simon Lejeune 11dc6d2702 [REF] stock_account: valuation wizard
display available quantity in the valuation now

FIXME: what to do with valuation at date? also with price history thing
2017-08-25 16:10:20 +02:00
Simon Lejeune e735e4f6bb [REF] product, stock_account: valuation related tooltips 2017-08-25 16:10:20 +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 12934f1b0c [FIX] stock_account: valuation wizard: _compute_stock_value
Adapt to latest changes, and find all valued stock moves in fifo to
display even a negative total value if present.
2017-08-25 16:10:20 +02:00
Simon Lejeune 7208af72dd [REF] stock_account: valuation wizard: at date list
Organize the displayed fields to help users understand more what's going
on behind the scenes, especially with the remaining_qty and
remaining_value things.
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
Simon Lejeune 9439f6aa55 [REF] stock_account: move away from the replay everything strategy
The approach we tried with the current implementation lead to a replay
of all the next moves since a move had to be corrected, and posting an
account entry with the valuation difference.

This proved to be slow and complicated, and moreover the resulting
account entry could be very difficult to understand and justify.

So we moved away from this strategy and implemented the following points:

For FIFO
* If a move goes into negative (sent more than availabale, we do not
  counterpart directly at the next in move: we valued it at the last
  fifo price and only when running `_fifo_vacuum` (which is called at
  every openning of the valuation report), we use some units currently
  in stock and post an account entry with the difference between the
  fake value and the real one used.
* When editing a done move and increasing its quantity, the new quantity
  is available now and will be used at the next move out. We do not try
  to replay the history to make the new values go away directly.
* When editing a done move and decreasing its quantity, it acts as a
  return to the supplier at the price unit of the move.

On average price:
* Don't replay anything, if we fall under the negative stock usecase,
  value at the last average price.
We restore the previous code that set the average price on the standard
price and we slightly patch it to continue to update the average price
if quantity in stock is negative.

We also add a link between stock moves and account moves. A stat button
on the stock move's form redirect directly to them. It's therefore a
little easier to understand what happened.

We remove the separate fifo and average price fields that were added in
saas17, we keep the single standard price (that should be renamed
cost_price for consistency). In the same idea, remove the cumulated
value that was stored on the move. If we need it, just recompute it
(it's not a frequent operation). We remove last_done_move_id,
last_done_remaining_qty and last_done_qty that were added in saas17 to
help in the replay method, as we just got rid of it. We also remove the
code that compensate the negative stock directy at the next in.

What the fifo vacuum does is essentially the same thing as what an out
move do: find a candidate and take units from it. In this case, the
candidates are newer than its concerned stock move. We stored on the
concerned stock move the value at which we sent it (remaining_value) and
post the difference with the real value on a real product.
2017-08-25 16:10:19 +02:00
Simon Lejeune afff55e809 [FIX] stock_account: average and negative stock
Do not inline the average price calculation in `action_done`, as there's
a computed field that handle correctly the negative stock (does not
trigger division by 0). Also, complete this compute method by also
looking on transit locations and implement two fallbacks if the quantity
in stock is null: return the latest cost, if not found return the
standard price.

Also, make sure that `remaining_qty` is only set on fifo moves.
2017-08-25 16:10:19 +02:00
Simon Lejeune 57e85e88b9 [REM] stock_account: unused onchanges 2017-08-25 16:10:19 +02:00
Simon Lejeune 91d6957849 [FIX] stock_account: fifo and negative stock
rename `_get_candidates_out_move` to `_get_fifo_candidates_out_move`
and `_get_candidates_move` to `_get_fifo_candidates_in_move` as it's
more explicit that they're only used in FIFO costing.

Fix `_update_future_cumulated_value` to filter only on internal moves
and to remove the value added in the past (self is always an out move to
which we added some value) and rename into
`update_fifo_future_cumulated_value`.

In `action_done`, rename `qty_taken_for_candidate` to
`qty_taken_for_candidate` as it's the qty we take to compensate the
candidate and not a quantity we take on the candidate (in this case,
some old out moves that we could not valuate in time because the stock
was negative). We fix the write on the value and cumulated value to
decrease the qty_taken_for_candidate*move.price_unit, because an out
move has always a negative value and we actually substract the value of
`move` which is always an in move and has always a positive value.

We fix the purchase test where negative out moves were valued positively
and add `test_fifo_negative_1` that tests the sending of goods we do not
have and the receipt encoded afterwards.
2017-08-25 16:10:19 +02:00
Simon Lejeune acce1d115a [FIX] stock_account: do not consider transit moves as out moves
We expose a serie of functions that return domains to find in and out
moves and, as opposed as before, the transit locations who have a
company id set (i.e. the inter warehouse transit) do not impact the
valuation of a company.

We rename the `not_move` argument of `_get_latest_cumulated_value` to
`exclude_move`, which is more explicit.
2017-08-25 16:10:19 +02:00
Simon Lejeune 72ff51f565 [REF] stock: product: _compute_quantities
This method is used to set `qty_available`, `virtual_available`,
`incoming_qty` and `outgoing_qty`.

We change the depends because only looking on stock.move is enough (all
changes on quants are made through stock moves, and we de not support to
edit directly quants anyway).

This method will call `_get_domain_locations` and we make sure that,
when the `company_owned` key is present in the context, we also return
domains to find products that are in a location that belongs to the
current user's company. This is done in order to include transit
location.

Also, remove the comment from tde. As these fields are displayed in
view, only using the context could alter the behavior.
2017-08-25 16:10:19 +02:00
Aaron Bohy 802dde31f3 [FIX] web,barcodes: pager: FIRST and LAST actions
The barcode mechanism is supposed to handle commands PAGER-FIRST
(go to first record referenced in the pager) and PAGER-LAST (go
to last record). Before this rev., it wasn't the case.

We needed to add an option 'notifyChange' to the updateState
function of the pager, to ensure that the form is correctly
reloaded when the pager cursor is manually set (by the barcode
handler) on the first or last element.
2017-08-25 15:54:56 +02:00
Aaron Bohy 8019eacb47 [FIX] barcodes: generate correct update command
The barcode mechanism is optimized to (in certain conditions),
directly increment the quantity of a numerical field inside an
x2many, without performing any RPC, and then re-rendering the
x2many to display the new value.

Before this rev., it seemed to work fine, but when the view was
saved, those changes of quantity were lost. This was because the
changes weren't correctly notified to the model (the quantity
field being inside an x2many, the correct update command for the
x2many should be generated).
2017-08-25 15:54:56 +02:00
Aaron Bohy 5f40f21adc [FIX] barcodes: barcode_handler widget should be generic
When a barcode field with widget="barcode_handler" is in a form
view, an onchange RPC should be done each time a barcode is
scanned.

Before this rev., it worked by chance because the views using it
don't define a 'pack_operation_product_ids' field.

Anyway, this widget is meant to be generic, so it shouldn't
hardcode a fieldname.
2017-08-25 15:54:56 +02:00
Aaron Bohy c73233d248 [FIX] barcodes: don't warn if action unavailable
Before this rev. a warning was displayed when a barcode mapping an
invisible button was scanned. It shouldn't, for the following
reason. In the stock.picking form view, two buttons with
barcode_trigger='validate' are in the page ('Start Inventory' and
'Validate'), and there is always at least one of them that is
invisible. So when scanning the 'validate' barcode, we don't want
a warning to be displayed, as there is potentially another button
that is able to handle the request.
2017-08-25 15:54:56 +02:00
Aaron Bohy dec1bdb44d [FIX] barcodes: don't redraw form twice
When scanning a command barcode, the view shouldn't be redrawn
after the operation corresponding to the command is executed,
for two reasons: first, it is useless as the view has already
been reloaded, and second, it may cause issues if it has been
destroyed meanwhile.

For example, when scanning barcode O-CMD.MAIN-MENU from a
picking form view: a do_action is performed to go back to the
main barcode client action (so the current form view is destroyed),
but an handler tried to redrawn the destroyed form view, which
produced a crash because the session was required by Date fields,
and it couldn't be provided (there were no more parent listening
to provide it).
2017-08-25 15:54:56 +02:00
Aaron Bohy 3d5b283675 [FIX] barcodes: don't trigger onchange at each keypress
When a keypress event is triggered in a 'field_float_scannable'
widget, the event is first catched by the barcodes mechanism, and
then manually re-triggered. However, the way it was done implied
that the environment was notified of each keypress event, so if
there was an onchange on that particular field, an onchange RPC
was done at each keypress.

Moreover, the focus was lost at each keypress as well.
2017-08-25 15:54:56 +02:00
Martin Geubelle b2e1b1356b [FIX] stock: correctly save the operation in picking
When creating a new picking and adding a new product operation, the operation was
disappearing. As the field `product_id` is readonly in some conditions, its value
wasn't sent by the client on the picking write rpc.

This behaviour of not sending readonly fields in x2many has been correctly
implemented with the new views but some views (like this one) was basing their
behaviour on this breach.

See rev. https://github.com/odoo/odoo/commit/3b3f6f04af79d7dcc4461262e14e05096d76180b for more details.
2017-08-25 15:54:56 +02:00
Martin Geubelle ebcf35b66c [FIX] web: restore form_view_initial_mode support
The key `form_view_initial_mode` can be set in the action context, to
open the action in edit mode, mainly.

This key wasn't supported since the new view refactoring so this commit
restores its support.
2017-08-25 15:54:56 +02:00
Martin Geubelle 5b968ad371 [FIX] web, barcodes: restore disableAutofocus option
This option has been removed with the new views but was used in barcode.

The form renderer was also dealing with some part of the autofocus
but this should only be handled by the controller.

The logic is now only in the controller and a test case has been added.
2017-08-25 15:54:56 +02:00
Akash Bhavsar b131e9b0ef [FIX] barcodes: fix several issues when scanning barcodes
Since the new views, most of the barcodes feature was
broken. This commit re-enables the support of commands like
'edit', 'save', 'cancel', 'previous' and 'next'.

Also changed javascript event handler to jquery event handler to
make barcodes testable in phantomjs.
2017-08-25 15:54:56 +02:00
Aaron Bohy 7095c32f1c [FIX] web: tests: correctly destroy view 2017-08-25 15:54:56 +02:00
Jeremy Kersten 71bb9a09ff [FIX] sale_timesheet: don't block th edition of timesheet if prepaid.
In case where the product is of invoice_type 'order' and not 'delivery',
we allow the user to edit the anlaytics lines / timesheet.

Previously, an employee was unable to edit an timesheet line once saved.
When you work on prepaid pack / long task, it is frequent to edit
existing timesheet line.
2017-08-25 15:51:41 +02:00
Jeremy Kersten 193707632d [FIX] sale_timesheet: apply correct discount in revenue computation
Related to https://github.com/odoo/odoo/commit/aec6248bb379c1ece02f5d4f718566c770fc2c6f
2017-08-25 15:51:19 +02:00
amoyaux 0ec73fa9c5 [FIX] stock_picking_batch: scheduled_date field
Stock picking batch was introduced in saas-17 instead of
master as planned. However I missed one field that has been renamed on
stock picking called scheduled_date inseatd of min_date.

This commit make the inverse change in order to be compatible with saas-17
2017-08-25 15:32:14 +02:00
Kirti Choudhary 04b81d37ac [IMP] .tx: module stock_picking_wave renamed to stock_picking_batch
Adapt tx to module rename hence it's entry in config file
2017-08-25 15:13:51 +02:00