Commit Graph
12 Commits
Author SHA1 Message Date
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
Christophe Simonis 99c34c4119 [MERGE] forward port branch saas-16 up to 6f3eada2c3 2017-06-06 19:38:29 +02:00
Christophe Simonis 6f3eada2c3 [MERGE] forward port branch saas-15 up to f687a27b79 2017-06-06 19:23:03 +02:00
Christophe Simonis 460cb3ba9e [MERGE] forward port branch saas-11 up to 7d7a45a921 2017-06-06 17:28:59 +02:00
xmo-odoo fffaf735f5 [FIX] P3: list -> iterable builtins (#16811)
In Python 3:

* various builtins and dict methods were changed to return
  view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
  removed altogether

This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).

Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.

issue #8530
2017-05-10 09:39:55 +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
Goffin Simon 8c55e57c7f [FIX] product_margin: _compute_product_margin_fields_values
All the fields defined in model "product.product" from module product_margin
are computed and not stored with the same function which is _compute_product_margin_fields_values.
This function has a deprecated argument which is field_names and this agrument is only used in
function read_group overwritten in this module in model "product.product. This overwrite of
read_group uses a variable "fields_list" with almost all the fields defined in "product.product"
in this module (excepted: date_from, date_to and invoice_state which are read from the context).

Each time, the fields total_margin, expected_margin, total_margin_rate, expected_margin_rate,
date_from, date_to, invoice_state were needed, nothing was returned due to the empty argument
field_names passed to this method. For example, when opening product.margin.form.inherit form
view.

In old API, it works because the compute was called with the list of the fields and in new API, it is not the case.

Closes #15604
opw:709962
2017-03-01 15:50:56 +01:00
amoyaux d37b7b5780 [FIX] product_margin: "group by" in product margins report
Trying to use "group by" in the product margins menu creates a traceback with a keyError.

The problem is that the function stores a recordset in the dictionary and then tries to
get it back with an integer.

This commit solves the problem by storing the product id in the dictionary instead of
the product itself.
2017-02-13 14:37:04 +01:00
Nicolas Martinelli 1e22870d26 [FIX] product_margin: crash of read_group
Introduced by 9a479e6572
2016-12-29 14:55:31 +01:00
Nicolas Martinelli 3667516a74 [FIX] product_margin: computed values
After commit 9a479e6572, all values in the report are 0.0.

opw-695649
2016-12-29 14:54:06 +01:00
Yannick Tivisse 9a479e6572 [MIG] product_margin: Migrate to new API 2016-08-09 10:29:06 +02:00
Yannick Tivisse 04039a1061 [MOV] product_margin: move and rename files according to guidelines 2016-08-09 10:29:06 +02:00