[FIX] account: chart of account opening period selection

If a special period is present, it must be selected fist
Fixes #3946
[FIX] stock: compute average price on action_done

The average price computation is now deduplicated and moved to
a separate function called in stock_move action_done.
This makes sure it is always called when a stock.move is
processed, even without going through the partial picking wizard.

Fixes #2991
Closes #3949
OPW-615491
[ADD] purchase: average price computation test
[IMP] mrp: add prepare method for manufacturing orders to allow override

Fixes #3973
[IMP] web: do not fully hide pager in grouped view

When the list view is grouped, the page count should be hidden as irrelevant.
However if it's fully hidden, the limit can no longer be changed.
Instead of hidding the pager, this commit hides the arrows and replaces
the content by the current limit to allow to be changed.
[FIX] delivery: display the label of the field number_of_packages

Fixes #4011
[FIX] Correct floating number handling for _procure_orderpoint_confirm

Fixes comparison with min_quantity orderpoint in scheduler - basic floating
point math issue in procurement scheduler when comparing current quantity
with orderpoint minimum quantity. In certain cases floating point comparison
could result in e.g 400.0 < 400.0 == True due to typical floating point
comparison issues, as Odoo doesn't use Decimal types where the issue
doesn't exist.

Fixes early exiting out of the loop cycle, in case qty is already near zero.
Fixes the new procurement creation check, to not do that if it's close
enough to zero already, to be considered a floating point math error, not
really non-zero.

These combined (or at least the last one) avoid each supply_method == buy
pending in draft PO's getting a zero quantity extra procurement order each
time the scheduler runs. Otherwise there could be hundreds of zero quantity
procurement orders pending, which makes the confirming of the PO take hours,
due to creating hundreds of stock moves for each order line.

Use float_compare helper to solve all these with floating point type for now,
instead of the more evasion possibility of converting to Decimal module.
Two potential bad comparisons remain, add FIXME notes for now until further
analysis.

Also: Float rounding on reste when comparing and on the procurement qty
[FIX] Fix floating point handling in purchase _prepare_order_line_move

Without this better floating point handling, an extra stock move might
be created for zero quantity for some order lines upon PO confirmation,
because qty is equal to something closer to e.g 1.14e-13, but this is
larger than 0, so it creates a stock.move, which gets rounded too late
to 0.0

Closes #3346
[FIX] Fix wrong unit price on invoice genereted by stock picking when uos is used

[IMP] Rounding not necessary
[FIX] product: add store=dict to field name_template

Recompute the name_template field if the template changes.

backport of 41628fc + f25c5d8 to 7.0 plus some optimisations in triggers
Fixes #3277
[FIX] mrp: keep traceability of procurement.group

Pass group_id information when a manufacturing order is created from
a procurement to keep a better traceability and know the reason of stock.move
creation.
Fixes #4019
[MERGE] forward port of branch 7.0 up to d6daf5f
Fixes #3851 Create invoice from picking copies some parameters from the order to the invoice
[FIX] purchase: do not use deprecated api
[MERGE] forward port of branch 8.0 up to 31a01ea
Revert "[ADD] purchase: average price computation test"

This reverts commit 5f9280e854ac435bdcf903128d5e9d5d0b592070.

These tests have been introduced in 7.0/saas-3, but can no longer be applied in 8.0, as they uses models that do not exist anymore in the new wms.

if such tests do not exist yet in Odoo 8.0, then these tests needs re-work, they cannot be applied like that

Conflicts:
	addons/purchase/tests/test_average_price.py
[FIX] res.currency: correctly compute the number of decimal places for currencies formatting in 'get_format_currencies_js_function'.
[FIX] account_analytic_analysis: tree fields access rights

Add invoicing related fields on anlytic account tree view for the invoicing group only
Otherwise, when a user not having the invoicing access rights displays the analytic account list, he gets an access right error.

opw-619485
[FIX] translate: allow common english 2 chars terms

Before, all isolated (between xml/html tags) two chars words coming from views were not translated (by choice).
But, for some words, allowing them is useful. For instance, the word 'or' located between two buttons.

opw-616716
Raise error on read of a browse object with bad id

Check if id is valid by searching record columns when a key error is raised
If the record has the column, the key error is actually an error on a
missing or inaccessible id.

Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>

Closes #3658