Commit Graph
91653 Commits
Author SHA1 Message Date
Xavier Morel 1cec339092 [FIX] account: bug which blows up in P3
In P2, list comprehensions "leak" their variables to the surrounding
scope, in this case leading to "stl" from the first listcomp being
visible to the second one leading to code which does not break but
does not seem to make any sense.

/cc @csn-odoo
2017-08-23 14:34:50 +02:00
Xavier Morel 1b3ac016af [FIX] account: P3 invalid comparison
Python 3 removed "universal"
ordering. ``ResCompany.fiscalyear_lock_date`` is not required and thus
needs a fallback in case it's empty lest we try comparing a string and
None or False, which is an error.
2017-08-23 14:34:50 +02:00
Xavier Morel f315ea4b71 [FIX] resource: P3 rounding issue 2017-08-23 14:34:50 +02:00
Xavier Morel 9d0af3c72c [FIX] web_editor: P3 io error
Views archs (and sub-archs) should be serialized to and deserialized
from unicode, not bytes.
2017-08-23 14:34:50 +02:00
Pierre Masereel cde29c29eb [FIX] stock: compute location on quant package
The field 'location_id' on quant package is not computed anymore, as all
quants of a package are in the same location we take the location of the
first quant
2017-08-22 17:20:56 +02:00
Pierre Masereel 472384e658 [FIX] mrp: Only show lots of consumed product
When you use the produce wizard of mrp, you can select the lot_id of any
existing prosuct to set on the consumed product.

To avoid the seletion of a lot of another product, we set a domain
showing only the lots of the current product.
2017-08-22 16:44:29 +02:00
Pierre Masereel 56b0e29c4f [FIX] stock: auto complete serial number product quantity
When a serial number is set or changed on a move line during a picking,
we automatically set the quantity done to 1 because, you will always
process one quantity of the product having the serial number you've just
entered
2017-08-22 16:27:03 +02:00
Olivier Dony 66fffc96ca [FIX] P3: text regex patterns only work with text input
.. not bytes
2017-08-20 23:25:54 +02:00
Olivier Dony f0333285fa [FIX] P3: convert exception handlers to except..as
Those are possibly posterior or leftovers from 3979f6802e
2017-08-20 23:25:54 +02:00
Olivier Dony f5b7de0e6c [FIX] P3: correct more dict iterable builtins use
Some bits posterior or leftover from fffaf735f5

See also parent commit.
2017-08-20 23:25:54 +02:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Olivier Dony 92e8a342c9 [FIX] P3: crm: dead code removal + simplify
Merge wizard contained dead code with references to an unused lib for
validating emails. Removing everything is easier.

+ remove unnecessary pycompat wrapping for safe use of dict.items()
2017-08-20 23:25:54 +02:00
Xavier Morel c24ab97c52 [FIX] P3: bytes.startswith(bytes) 2017-08-20 23:25:54 +02:00
Xavier Morel 30a9e6602c [FIX] P3: url_for text model
Have url_for work entirely on text internally, especially since
Request.path is text and so are lang names.
2017-08-20 23:25:54 +02:00
Xavier Morel b93613066f [FIX] P3: JSON is an object<->text encoding
It doesn't load bytes, and it doesn't dump to bytes.
2017-08-20 23:25:54 +02:00
Xavier Morel bc7dce254d [FIX] P3: text model, base_url is a string but query_string is bytes 2017-08-20 23:25:54 +02:00
Xavier Morel e33a79c65b [FIX] P3: date parsing text model 2017-08-20 23:25:54 +02:00
Xavier Morel 200612ca1e [FIX] P3: text model in various mail bits
No formal decision there, and the stdlib API seems like a PITA as it's
based around native strings, not bytes and not text.

* try to use cross-model API instead of random encode/decode
* unicode all the mail_template things
* formataddr *requires* a text tuple now

  In P2, formataddr((False, False)) "worked" (generated "False
  <False>"), in P3 it will fail and blow up.
* attachments are quite definitely bytes
* remove try_coerce_ascii because it's garbage
2017-08-20 23:25:54 +02:00
Xavier Morel 43dedda9eb [FIX] P3: cross-version binary data is bytes, not str 2017-08-20 23:25:54 +02:00
Xavier Morel a5e21f69e7 [FIX] P3: view arch should be text-'encoded' XML 2017-08-20 23:25:54 +02:00
Xavier Morel b8f0ed664c [FIX] P3: arch should be unicode 2017-08-20 23:25:54 +02:00
Xavier Morel c11ac13417 [FIX] P3: import file content needs to be *bytes* 2017-08-20 23:25:54 +02:00
Xavier Morel 481a00dc4b [FIX] P3: hash/hmac payload must be bytes 2017-08-20 23:25:54 +02:00
Xavier Morel be7c5aefdf [FIX] P3: CSV reading & writing 2017-08-20 23:25:54 +02:00
Xavier Morel 7dd062f835 [FIX] P3: text model types
* remove references to basestring & unicode (use relevant pycompat
  helpers)
* remove some str calls (either entirely or replaced by relevant
  helper, either text or native)
* use better API to avoid unnecessary conversions
* remove some XML declarations in views
2017-08-20 23:25:54 +02:00
Xavier Morel 3824b5dcc1 [FIX] P3: fix base64 and StringIO uses
* StringIO removed from stdlib, replace with io
* try to correctly handle BytesIO/StringIO (one is for bytes the other
  is for text)
* fix base64: Python 3 removed bytes-encoding and bytes-bytes
  codecs (via #encode) so replace all calls to str.encode('base64'),
  also b64encode is a bytes->bytes conversion so attempt to properly
  handle that

issue #8530
2017-08-20 23:25:54 +02:00
Xavier Morel 1edc84dfdf [FIX] P3: surprise, time.time() isn't falsy
https://bugs.python.org/issue13936

That's a pretty sensible change, but it turns out we did have some
bits of resource which implicitly depended on the old behaviour.
2017-08-19 02:34:23 +02:00
Xavier Morel 25df2352f5 [FIX] P3: / has become 'real division' in all cases 2017-08-19 02:34:22 +02:00
Xavier Morel a4ada695e1 [FIX] P3: absolute ordering removed 2017-08-19 02:34:21 +02:00
Xavier Morel 70599807a1 [FIX] P3: round() compatibility shim
In Python 3 round:

* rounds half to even (banker's rounding) rather than up
* returns an int if not given a precision (or given a precision of
  None)
* discards the negative sign when rounding to 0

Add a compatibility shim which implements P2 behaviour and at least
allows passing float_utils's tests.

Implementing float_round on top of Decimal was attempted but did not
work: although Decimal.quantize takes a non-integral
Decimal (e.g. ``d.quantize(D('0.001'))``) it only supports integral
powers of 10 and does not support quantizing to e.g. 0.05: while that
will not fail it will just use the exponent for quantization and 0.05
is thus equivalent to 0.01, which is not what we want if e.g. need to
round a value to 5 cents.

This is hinted at but maybe not clearly spelled out by the official
documentation:

> Return a value equal to the first operand after rounding
> and **having the exponent of** the second operand.

Also convert a bunch of hand-rolled currency rounding to just using
the round() method on res.currency.
2017-08-19 02:34:20 +02:00
amoyaux b970bf865a [FIX] stock: unable to return SN in chained moves
Use case to reproduce the bug:
- Set multi location in settings
- Set warehouse's deliery method as pick/pack/ship
- Deliver a product to customer
- Process a return from customer to output.
- Create a return from output to pack ->
Unable to reserver product.

It happens because return moves where not linked together but have
the picking that created the return as origin.
Thus action_assign does not detect the return moves and can't
guess the real quantity available.

This commit add a behavior that will create links between
return move. It can be guess from parent move(the picking's move from which
the return is created) and its move dest/orig that have already
created other return. It also correct action assign because
the group by could retourn same line with return moves.
It add a test that check returns and links between them.
2017-08-17 17:49:09 +02:00
amoyaux 13f0615b80 [IMP] purchase : Decrease order quantity should not delete picking and moves
When deacreasing a quantity on a PO it will decrease the quantity
of an associated move. When the move's quantity reach 0, previously the
move was unlinked and aslo the picking if all moves inside were unlinked.

However the destination move(s) still exist with the quantity that has been
removed in the original move. It can confuse the end user which have a move without
origin.

This commit cancel the move/picking instead of unlink them. Thanks to this
the end user still have the link with the original moves and can guess from where
their destinations moves come from. It also remove the filter on PO in order
to display the canceled picking.
2017-08-17 17:49:03 +02:00
amoyaux 9054d082be [IMP] stock: picking and ml views improvements.
commit 0a960c08757a8ba5e1dc1dd36c17a35de8913975 introduced change about
reserved quantity that set it to 0 once the move is done.

This commit add views improvement. If the move lines are done
reserved quantity does not really matter and thus it is better
to not display it.

Modify the decorator on stock picking that change the font to red
if the quantity processed is greater than the reserved quantity.
This decorator does not trigger if the picking is in state done since
reserved quantity is always 0.
2017-08-17 17:16:34 +02:00
amoyaux 2a160329bb [FIX] stock : no more automatic backorder
When validating a stock picking there were 2 different cases:
(1) If all qty are equal to 0 it will display a wizard asking
if the user want to set the quantity done to the reserved quantity
for all moves. If the user accept it will automatically perform the
moves after setting the quantity done.
(2) If the user set a quantity on a move, it will check if there is
a need for a back order. If yes it will display a wizard asking if
a back order is needed or not.

However the check if a back order was needed or not was never perform
in case 1. If the quantity reserved was lower than the initial demand
a back order was automatically created.

This commit add the step 2 in the procedure of step 1 (after setting the
quantity done).
2017-08-17 17:16:21 +02:00
amoyaux 3c135d3123 [IMP] stock : reserved quantity should be 0 for done move
The quantity reserved for move was never modified once the move
is done. It is a nonsense to have a reserved quantity for a done
move.

This commit add a constraint that ensure the quantity of
move line to be 0 if it is in state done. Also it add a write
on move_line's 'action_done' function that set the reserved quantity
to 0 for all move line processed.

It does not introduce any change on the stock move itself since the
reserved quantity is the sum of all its move lines's reserved quantity.
2017-08-17 17:16:00 +02:00
amoyaux fafb0ed8c5 [IMP] mrp : Improve error message on cancel MO with consumed qty
Adding the step to do when the user want to delete the MO.
2017-08-17 16:18:18 +02:00
amoyaux 105ece056d [IMP] stock : improve immediate transfer message.
Improve the message for the end user.
2017-08-17 16:18:05 +02:00
dbh-odoo a032c6c056 [FIX] website_sale: fix issue when displaying transaction error at checkout 2017-08-17 13:52:31 +02:00
tbe-odoo 2df9c22d80 [IMP] Payments & subscriptions: Improved Payments
- When registering a payment token, validating it using a payment of a small amount (~1.50€) followed by a refund allows ensuring
    that the payment method is valid (i.e. checksumming the card number simple ensure the number is valid but not that the card exists).
    This commit introduces a generic approach that must be implemented for each acquirer that has tokenization support.
    This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need.
- Introducing a new payment form that handles payment, deletion and adding payment method (only for server2server for the moment).
- On /my/payment_method, changed strings 'Payment Acquirers' to 'Payment Methods' which is more clear.
- Stripe can now be used to pay subscriptions.
2017-08-14 08:30:59 +02:00
amoyaux c089d39a66 [FIX] stock : traceback filter 'Available Products'
It happens because the function still use the old fields
utilized before refactoring introduced by commit b3180c8411

This commit adapt the function by using quantity instead of qty.
2017-08-11 09:43:07 +02:00
Christophe Simonis 48b2ce60ed [MERGE] forward port branch saas-16 up to 85571bb78c 2017-08-10 17:01:05 +02:00
Christophe Simonis 85571bb78c [MERGE] forward port branch saas-15 up to dde62073ba 2017-08-10 16:22:36 +02:00
Christophe Simonis dde62073ba [MERGE] forward port branch saas-14 up to a2361e23ea 2017-08-10 16:17:28 +02:00
Christophe Simonis a2361e23ea [MERGE] forward port branch 10.0 up to 544aa9b04a 2017-08-10 15:45:07 +02:00
Christophe Simonis 544aa9b04a [MERGE] forward port branch saas-11 up to cfbac106b4 2017-08-10 15:00:33 +02:00
Christophe Simonis cfbac106b4 [MERGE] forward port branch 9.0 up to 1aed433f54 2017-08-10 14:58:24 +02:00
Aaron Bohy deba788b4c [FIX] web_editor: html_frame: saving in readonly
A form view record may be saved even if the record is displayed in
readonly (e.g. when a button in the form view is clicked). When
this happened, if there were an html field with html_frame widget
in the form, it crashed (e.g. in Email Marketing > Mass Mailings >
open one > click on Test Mailing).
2017-08-10 13:56:22 +02:00
Aaron Bohy 87133a8235 [FIX] web: BasicModel: correctly reload new records
Commit 7cd2f6370 (in 10.0) recently added attribute special='cancel'
on the 'Cancel' buttons of the Settings views in Odoo. The attribute
wasn't really supported in this case by the old web framework, so
this commit also slightly adapted it, and made it reload the whole
webclient when such a button is clicked.

This commit now needs to be forwardported in saas-16, so we have to
handle the case in the new views as well. Before this rev., it
crashed, because the BasicModel tried to reload a new record (the
one of the Settings form view), so basically it performed a 'read'
RPC on a virtual ID like 'virtual_123', and the server didn't really
appreciate.

This rev. handles the case where a new record is reloaded, and
simply performs a 'default_get' instead of a read. Bonus point:
with the new views, we don't have to reload the whole webclient.
2017-08-10 13:56:22 +02:00
Nicolas Lempereur 354539942d [FIX] website_sale: no-cache IE11 cached cart XHR
IE11 seems to be always using cache when doin an XHR request with the
same GET request.

It can be changed in several ways:

- returning a header: "Cache-Control: no-cache"
- altering the GET request with a nonce
- using the POST method instead of GET

to solve it, in this change the HTTP header is added on the response.

opw-752270
closes #18787
2017-08-10 13:41:37 +02:00
Jérome Maes 9b4c8a4e31 [IMP] hr_timesheet: default employee
'default_get' should return a value for employee
 when asked, even if it is not a timesheet.
2017-08-10 11:29:36 +02:00