Commit Graph
107478 Commits
Author SHA1 Message Date
Nicolas Lempereur cc1c15327c [FIX] expression: improve o2m with m2o integer
We sometimes use in Odoo a One2many field with an inverse Integer
field instead of a usual Many2one.

This allow for example in several instances to have a "Many2one" which
can be reference from several models, eg:

Model Ranking:
	name = String field
	res_id = Integer field
	res_model = String field

Model Toy:
	rank = One2many [inverse: Ranking -> res_id]
                        [domain: res_model == Toy]

Model Tool:
	rank = One2many [inverse: Ranking -> res_id]
                        [domain: res_model == Tool]

This enable us to have a shared feature between otherwise unrelated models.

But there was several issue when searching on these One2many:

1) if the Integer Many2one was not stored (eg. it came from an inherits) on
   the searched model, this could lead to an error.

2) when we searched:

   - by IDs (rank in ['55']) with at least one id not respecting the domain
   - by IDs with a negative operator
   - with a negative operator on unfound string (rank != "no rank has this")
   - with a false value (rank = False)

   we would not apply the One2many domain (eg. res_model == Toy) and thus
   possibly getting Toy 3 errenously because a Tool 3 was found without
   the domain being applied.

This fix modify the search on One2many and for:

1. if the inverse is an Integer not stored field instead of Many2one
   manage it.

2. if the field is an Integer field instead of Many2one and there is a
   domain on the One2many: apply the domain on the inverse model found.

So only some search on One2many with a domain whose inverse field is an
Integer could be impacted.

This would also be nice to have for all One2many with a domain but the
probability of it being useful versus risk for performance is not judged
high enough.

opw-710508
2017-03-16 11:57:04 +01:00
Nicolas Martinelli 27f656a23e [FIX] mrp: duplicated raw materials
- Create Product A with a BOM which depends on a product with tracking
  "By Unique Serial Number" (Product B).
- Create a MO for Product A
- In the "Register lots" wizard, add two lines for "Product B", with the
  same serial number.

Nothing prevents the user to do it, even when the inventory is posted.

opw-709888
2017-03-15 14:01:04 +01:00
Goffin Simon 73de39150a [FIX] crm: Translation in crm.opportunity.report
The opportunity analyses displayed the stages always in English.

opw:708380
2017-03-15 10:50:12 +01:00
Goffin Simon 9f9657c04b [FIX] base: unlinking ir.model.constraint
When unlinking an ir.model, all the ir.model.constraint linked to this
ir.model must be removed to avoid to call unexisting model.

In stable version, the right fix would be to put an attribute ondelete=cascade
on the field model of ir.model.constraint.

In 10.0, the ir.model.constraint are created with module = the module where the related field
has been declared. But when unlinking the ir.model in function _module_data_uninstall, the related
ir.model.constraint to remove were chosen according to the removed modules. So with models
declaring constraints on inherited fields, some problems occured because the model could be removed
and not all the related constraints.

opw:716032
2017-03-15 09:17:53 +01:00
Martin Trigaux 8adc2ef440 [FIX] stock: do not write on picking type
When creating a stock.picking, the related fields picking_type_entire_packs and
picking_type_code were both updated.
This was an issue was required write access on stock.picking.type (warehouse
manager) to create a stock.picking (warehouse user).

The fields were updated as they were present in the view and filled with the
related value. Even if the value was unchanged, it was triggering a write
anyway.

The two fields were in invisible="1" and used only in attrs for other fields.

Making these two fields in readonly does not prevent to use it in the attrs but
avoid to send a value to the server and trigger a useless write.

Fixes #15769
2017-03-14 15:58:42 +01:00
Moisés López 93bb6f322d [FIX] base: avoid variable referenced before assignment error
If the company currency is not active (that should not happen but nothing
prevents it, probably happening with some CoA installation), the variable
company_currency_format is undefined and an error is raised.

Closes #15799
2017-03-14 10:44:12 +01:00
Christophe Simonis 2ef43281c2 [MERGE] forward port branch saas-11 up to 2e972578b9 2017-03-13 15:53:55 +01:00
Christophe Simonis 2e972578b9 [MERGE] forward port branch 9.0 up to 73d6f9023a 2017-03-13 14:49:12 +01:00
Yenthe V.G e88bb57a1e [FIX] l10n_cn: load correct file for chinese accounting
The manifest loaded l10n_chart_china_standard_business_chart_data.xml but this file no longer exists in Odoo.
Changed to the new XML file.

Closes #15841
Fixes #15840
2017-03-13 14:47:18 +01:00
Christophe Simonis 73d6f9023a [MERGE] forward port branch saas-6 up to 31474efec2 2017-03-13 13:53:54 +01:00
Christophe Simonis 31474efec2 [MERGE] forward port branch 8.0 up to 7a15e52cea 2017-03-13 13:38:04 +01:00
Florent de Labarre 0ac303d12f [FIX] base_import : add xlrd to requirements.txt
Needed to import xlsx files

Closes #15644
2017-03-13 13:27:56 +01:00
Christophe Simonis 7a15e52cea [FIX] base: check ir.ui.view recursion 2017-03-13 13:27:53 +01:00
Laurent Mignon (ACSONE) 6339a68db0 [FIX] purchase: add method _prepare_stock_moves
During the refactoring of Purchase, the method '_prepare_order_line'
available in Odoo 8.0 has been lost. It's therefore no more possible to
extend this method to covers use cases where we need to provide
additional data to the stock moves created from a purchase_order_line.

This restores the functionality thanks to the method
`_prepare_stock_moves`.

Closes #15842
2017-03-13 12:05:11 +01:00
Nicolas Martinelli cab436819f [FIX] hr_expense: expense of zero
- Create an expense of 0.00, validate
- The expense can never be set as paid since it's not possible to create
  a payment of 0.00.

An expense of 0.00 still makes sense in the following use case.

An expense is paid by salary before the expense is actually made, i.e.
I get 1000 EUR to redecorate my homeoffice, I get the money beginning of
the year. After that I want to book expenses against the initial payment
until the 1000 EUR is gone and I would like to make use of the expense
workflow to approve the costs.

opw-710695
2017-03-13 08:15:26 +01:00
Odoo Translation Bot 00435d6384 [I18N] Update translation terms from Transifex 2017-03-12 04:31:45 +01:00
Odoo Translation Bot 70cac4d474 [I18N] Update translation terms from Transifex 2017-03-12 02:54:51 +01:00
Odoo Translation Bot dcd78c2c39 [I18N] Update translation terms from Transifex 2017-03-12 00:30:59 +01:00
Christophe Simonis c9e3d93ad0 [FIX] website: correct redirect with correct lang
When forcing another language that the current one (the cookie one) in an
url, the requested lang wasn't set correctly in redirect url, but the
cookie was, resulting in multiple redirect which ends with initial lang.

A side effect of this error was the inability to edit website page when
default lang is not en_US and user not in default lang.

The request context must be reset before being used by
`request.redirect` (in `url_for` method).
2017-03-10 18:31:21 +01:00
Denis Ledoux 4e95474ca1 [FIX] website_event_track: Tracks in the wrong room in the agenda
When setting an event tracks like this:
- Track 1, 10:00 to 10:30 Room A
- Track 2, 10:30 to 11:00 Room B
- Track 3, 11:00 to 11:30 Room A

In the agenda of the event, on the website, the Track 2
was displayed as in the Room A, while it should be in the Room B

opw-715480
2017-03-10 17:09:11 +01:00
Denis Ledoux 466e2b8c9f [FIX] mail: URL regex to make links clickable in chatter messages
The former URL took way too many steps to resolve
`www.odoo.com(odoo-odoo-odoo)`, more than 1 minute
according to the case, and it stucked the web client
(the entire browser actually),
and it ended matching the whole sentence as a link,
included `(odoo-odoo-odoo)`

This new regex is much simpler, resolve the above case,
and does not match `odoo-odoo-odoo` as part of the link

opw-715797
2017-03-10 17:09:11 +01:00
Nicolas Martinelli beaea311e6 [FIX] stock: typo
In method `_check_delivery_resupply`, `new_location` is used in a
`write` call. This expects an integer (id).

However, `new_location` is the result of `_get_input_output_locations`,
which returns a recordset.

opw-716141
2017-03-10 10:39:20 +01:00
Nicolas Martinelli e6e6a8889f [FIX] account: typo
The context is created as a set, not a dict.

opw-716141
2017-03-10 10:28:23 +01:00
Nicolas Martinelli abf946086d [FIX] mrp_repair: fees
- Create a repair order
- In the "Fees" list, select a product

The default information is not loaded (description, price).

opw-709368
2017-03-10 09:21:49 +01:00
Goffin Simon 8be16e7a1c [FIX] product: group_product_variant on product kanban view
The number of variants doesn't have to be displayed if variant not enable on product.

opw:711034
2017-03-09 23:52:38 +01:00
Goffin Simon e6d790e340 [FIX] account: _onchange_partner_id not matching fiscal position
When changing partner_id on an invoice, the fiscal positions with auto_apply=True,
must be checked to apply the right one.

To have the same behavior as in 10.0

Backport of this commit: 4b11e3e3a5

opw:715511
2017-03-09 16:21:37 +01:00
Nicolas Martinelli 1d0d74bd89 [FIX] payment: transaction form
The transaction form has readability issues. It is improved by taking as
a example the partner form.

opw-711162
2017-03-09 14:43:01 +01:00
Alexis de Lattre f5722e5076 [FIX] l10n_fr: add missing account 649 (CICE)
Switch account 120  to 'current year earning' type

Closes #15717
2017-03-09 14:20:36 +01:00
Laurent Mignon (ACSONE) 1dea8a53fb [FIX] resource: correct also microsecond information
A lot of methods are designed to work with pure datetime objects as args. If
the value comes from the database it will be rounded at the level of seconds
(0 microsecond). If it comes from a call do datetime.now() / datetime.utcnow()
the datetime object has a value != 0 for its mircroseconds attribute. Therefore
some methods have unpredictable results depending of the origin of the values
manipulated since the microsecond argument is missing into all the calls to
datetime.replace

Closes #15768
2017-03-09 14:07:58 +01:00
Goffin Simon bb0b4cb8f2 [FIX] fleet: return_action_to_open
The 'group_by' must be poped from the context in function return_action_to_open
because the act_window can call another model.

opw:710363
2017-03-09 13:54:33 +01:00
Denis Roussel (ACSONE) e4a0a300cb [FIX] stock_calendar : correctly schedule calendar
Bad call to api.multi method.
Introduced at 4cb09653

Closes #15763
2017-03-09 09:10:23 +01:00
Jeffery CHEN Fan 2ad0a5a906 [FIX] l10n_cn: correct China accounts
Correct the list of accounts using wrong type
Better manifest with copyright and english description

Fixes #14999
Closes #15021
2017-03-09 09:03:31 +01:00
Denis Ledoux a8efeffbf2 [FIX] pos_mercury: support for Inernet Explorer / Edge
In the method `xml_node_to_string` in `qweb2.js`,
which is used when extending XML templates,
such as this extend of the template `PaymentScreen-Paymentlines`

the method `(new XMLSerializer()).serializeToString(node)`
magically escapes the double quotes `"` in Internet Explorer and Edge,
while this is not the case in other browsers,
therefore converting, for instance,
`this.removeAttr("class");`
to
`this.removeAttr(&quote;class&quote;);`
whhich made the rendering of the template fails.

As this method is quite critical, we do not dare
editing it to use an alternative to `XMLSerializer.serializeToString`
in a stable release

Instead, as a workaround, we just avoid the use of the double
quotes.

opw-708296
2017-03-08 18:07:07 +01:00
Christophe Simonis f9fa39a8c0 [FIX] board: correctly handle invalid actions
This may happen when a dashboard contain references to deleted actions.
2017-03-08 16:31:03 +01:00
Nicolas Martinelli 6bb63edb98 [FIX] base: save ir.values
- Install accounting module
- Create new tax, keep note of its ID
- Go to Settings > Technical > User-Defined Defaults
- Change the value of 'taxes_id' to the ID of the tax created
- Create a new product => crash

The issue is that the value of 'taxes_id' is saved as a string, not as a
list. Therefore, once retrieved, it crashes.

opw-709906
2017-03-08 15:28:33 +01:00
Nicolas Martinelli bfef35774d [FIX] sale, purchase: currency in subtotal
The "Subtotal" field of a SO/PO line is not rounding following the
currency rules.

opw-710701
2017-03-08 15:26:25 +01:00
Florent de Labarre 681625ea56 [FIX] account: correct domain evaluation
'is set' filter is the equivalent to != False
A many2one has not the value True but an ID

Closes #15749
2017-03-08 13:46:46 +01:00
Martin Trigaux 9732c3049a [FIX] hr_timesheet_sheet: keep timesheets linked to a task
When deleting an hr_timesheet_sheet.sheet, the linked analytic lines are
dropped too.
This was introduced in 8.0 at 5f45e7ca

The initial bug, reported at #5326, was targeting the analytic lines created
independantly, directly from the timesheet encoding.

In version 8, the timesheets were encoded via project.task.work and the unlink
on the hr_timesheet_sheet.sheet had no effect on the works.

In version 10, this model no longer exists and it needs to be filtered to avoid
removing independant timesheets.

Fixes #15741
2017-03-08 13:38:55 +01:00
Denis Ledoux 4d440caafd [FIX] mass_mailing: mailing users requires write on utm.source
Since revision
731356a155

and the fact `mail.mass_mailing.campaign` inherits (with s)
from `utm.source`, and the name of the mass mailing
is took from this `utm.source` linked to the mass mailing,
a mass mailing user requires the write access on the model `utm.source`
to be able to change the subject of a mass mailing.

As a side node, I notice there is no group applied on the
base `access_utm_source` access rule of the module UTM,
meaning a portal user can create `utm.source`.
I am not sure if this is wanted or not.

opw-710525
2017-03-08 12:52:10 +01:00
Denis Ledoux 8428910a74 [FIX] mail: format_date with falsy date
If the date passed is falsy, return
an empty string instead of crashing.

opw-704260
2017-03-08 12:52:10 +01:00
Nicolas Martinelli b0321b1474 [FIX] sale: do not run procurement twice
When procurements are created, they are automatically run. Avoid this
behavior, to run all procurements at the end of the process and used the
optimized JIT behavior.

opw-710007
2017-03-08 11:44:56 +01:00
Nicolas Martinelli 218a21a37e [FIX] sale: do not run procurement twice
When procurements are created, they are automatically run. Avoid this
behavior, to run all procurements at the end of the process and used the
optimized JIT behavior.

opw-710007
2017-03-08 10:47:19 +01:00
Nicolas Martinelli fb1b9baeb1 [FIX] stock: prevent location creation
Prevent location creation in pack operation view to avoid location
inconsistencies.

opw-707439
2017-03-08 09:28:24 +01:00
Goffin Simon 8c2db9a9a2 [FIX] account: Duplicates a customer invoice
Fine tuning of this commit: a7cd820
When clicking on button "Duplicates" it printed "Duplicate + number". Now it prints
" Duplicate invoice + number" if the customer invoice is of type out_invoice.

opw:708440
2017-03-07 23:45:33 +01:00
Nicolas Lempereur 629d80c3c2 [FIX] mail: fix typo in attachment managment
Fix some dead code. This is a fallback for linking mail attachment with
its data. The issue was not reported since a long time since this just
disable a fallback which in my tests was not used anyway.

opw-710502
2017-03-07 18:05:53 +01:00
Christophe Simonis 0a2b99f985 [FIX] product_visible_discount: use defined variable
Oversight of a previous forward-port
2017-03-07 16:55:05 +01:00
Martin Trigaux 76b724294a [FIX] calendar: correct search in recurrent event
Add a 3 use cases with tests that were failing before.

datetime filters were not working correctly on stop filters
The `_get_recurrent_date_by_event` was only computing recurrency on the start
field of an event which can make a difference. A recurring event
  start=2017-01-01 09:00:00; stop=2017-01-01 10:00:0
was not matched in a search ('stop', '>', '2017-01-01 09:30:00')

The filter != was not handled in the recurring use cases.
e.g. making the search 'start is set' in the web client is equal to
  ('start', '!=', False)

Searching with only a start filter matching recurring events but not the
first ("real") occurence, was returning no result if no stop filter was present.
  start=2017-01-01 09:00:00; count=5
had no result in a search ('start', '>', '2017-01-02')
2017-03-07 15:57:37 +01:00
Goffin Simon 8eb759dcff [FIX] hr_expense: Multi company rule for hr.expense.sheet
To apply to multi company rule on hr.expense.sheet
Inspired from Expense multi company rule

opw:709834
2017-03-07 13:51:02 +01:00
Denis Ledoux 04bb06fcb3 [FIX] mrp: Do not ask for to provide a lot if there is no finished product.
If `product_move` is an empty browse record
`produce_move.product_id.tracking` is `False`, not `none`,
and therefore
`produce_move.product_id.tracking != 'none'` returns True,
and it therefore asked to provide a lot for no reason.

opw-710748
2017-03-07 12:50:34 +01:00
Nicolas Martinelli c0f1f27dbd [FIX] crm: translation in merge message
- Install a language different from English, set it to your user
- Merge two opportunities

The merge message which summarizes the operation contains the name of
the fields in English.

opw-708381
2017-03-07 12:09:45 +01:00