Commit Graph
117778 Commits
Author SHA1 Message Date
Nicolas Martinelli 950d0f1849 [FIX] product, stock_account: cost currency
The cost of the product is a property field, meaning that:
- its value depends on the current company;
- its currency is the company currency

However, several views use the monetary widget to display its currency
with the default `currency_id` field. This can be incorrect, since the
latter is computed based on the product's company.

We introduce the new computed field `cost_currency_id` which has the
appropriate value and can be used in the views.

Closes #30616
opw-1934443
2019-02-25 13:58:02 +00:00
Arnold Moyaux 443b810e09 [FIX] stock: validate a picking with only scrap
Usecase:
- Create a planned transfer
- Add line with initial demand
- Create a scrap
- Click on button validate

The wizard asking for a backorder or not is diplayed. The UserError
that prevent to validate a picking without quantity done or reserved
should have been raised. The scrap moves are directly processed once
the user validates his scrap order. Validate a picking with only done
moves, will not have any effect.

closes odoo/odoo#31076
2019-02-20 09:17:10 +00:00
Arnold Moyaux 86cb78740b [FIX] stock: picking to scratch location with BO
Usecase to reproduce:
- Create an internal picking from stock to scrap
- Add some scrap move inside due to scrap button in header
- Add some move with initial demand for future
- Mark the picking as done and validate it
- The wizard asking for a backorder appear -> Validate or No backorder

The moves with initial demand are duplicated(one new move for each
without intial demand nor quantity done)
A note is logged in the chatter with backorder False has been created.

There is a problem since _action_done on a scrap move from scrap model
will process the scrap move individualy but will create a back order
(commit e088acbc0f try to fix this issue)
However when we create a picking that goes to scrap location, the back
order will not be created since all moves are scrapped.
With the current configuration we can't guess in _action_done if
it comes from scrap or picking validate that goes to a scrap location.

The current solution is to use a context key in order to indicate if the
call come from picking validate or scrap. If it comes from scrap do not
create a back order no matter the case. If it comes from picking, follow
the standard beahvior with a backorder or not.

opw-1934835
2019-02-18 10:02:06 +00:00
Odoo Translation Bot f7a976584b [I18N] Update translation terms from Transifex 2019-02-24 03:16:28 +01:00
Lucas Perais (lpe) 71a295a1d5 [FIX] base: qweb t-call propagates t-lang
Before this commit, the t-lang on a t-call was not
propagated into the context's of the callee template

It resulted into mismatch translation and formatting in the final
rendered template
i.e. having a t-esc with a qweb widget float would take the wrong float format

After this commit, the t-lang parameter alters the context of the template
and t-esc with widgets are translated

OPW 1939989

closes odoo/odoo#31291
2019-02-22 13:40:39 +00:00
Lucas Perais (lpe) 64a3d8f1d6 [FIX] portal: portal access management wizard for company
Have a partner which is a company, with some children
Click on the action "Portal Access Management"

Before this commit, only the children of the company is selectable in the wizard
but not the company itself

After this commit, the company is part of the list

OPW 1931920

closes odoo/odoo#31344
2019-02-22 08:51:46 +00:00
Moens Alexandre 21e44d472d [DOC] base: more explicit documentation
compute_sudo has no effects on non stored computed fields.
It was technically already said in the previous lines (REcomputed) but
it was not particularly explicit

closes odoo/odoo#31320
2019-02-21 13:00:47 +00:00
Moens Alexandre a874858981 [FIX] auth_signup: incorrect use of compute_sudo
compute_sudo does not do anything when the computed field is not stored.
This fixes an issue where user not part of base.group_erp_manager
couldn't modify res.partner

opw-1942803
2019-02-21 12:59:31 +00:00
Abu Zafar 82e526fc36 [CLA] signature for MjAbuz
closes odoo/odoo#31163
2019-02-20 13:13:46 +00:00
Luis 9f6fbca89b [CLA] add eilst to savoirfairelinux
closes odoo/odoo#31255
2019-02-20 13:03:44 +00:00
Lucas Perais (lpe) de8cefcef4 [FIX] web: pivot unload filter, reset, load another filter
On a pivot view with a default filter which has column and row groupbys
Remove the filter
Collapse all columns and rows
Activate another Filter from favorite which has a column groupby at least

Before this commit, the columns were not displayed in the DOM, though RPC's
and internal data were actually correct
This was because we considered the changes had been done "in place"
taking the old tree to build the new one for the columns
when really, we should have recomputed the column tree

After this commit, the columns display the group we want

OPW 1935155

closes odoo/odoo#31247
2019-02-19 15:12:28 +00:00
mgh-odoo 66392a9fff [FIX] pos: encode negative payment for refund
currently, if the user wants to refund amount to the customer
and enter negative payment form keyboard its throws an error. that will fixed.

Task: #1935602

closes odoo/odoo#31061
2019-02-20 07:01:52 +00:00
Nicolas Martinelli 09bf391f4d [FIX] stock: delivery slip address
After discussion with the Mighty Priestess, the address used in the
Delivery Slip should be the picking partner as a first priority, then
the move lines partner.

And we therefore remove the useless 'Assign Partner' button (but not the
associated method since it is public).

opw-1935039

closes odoo/odoo#31250
2019-02-19 14:48:20 +00:00
Hugo Adan ef618df9e9 [REF] account: Performance improve unreconcile process (_reverse_move):
_reverse_move presents a critical performance issue when
unreconcile moves with a lot of account_move_line.

The issue is that `account.move` and `account.move.line` models are triggering computed fields/methods for each new
`account.move.line` added, computing all lines again and again.

Making a factorial performance issue.

For each line the function try create cash basis entries for tax/base lines and this is combined with all the
fields compute that exists on the model so this introduce a performance problem

The issue is that `account.move` and `account.move.line` models are triggering
computed fields/methods for each new `account.move.line` created isolated,
computing all lines again and again.

e.g.
 _compute_matched_percentage at
https://github.com/odoo/odoo/blob/5e8289cfeaf52a1eac64bcc975b186f0b5f9594b/addons/account/models/account_move.py#L44-L62

Then for each line modified/created this compute is executed for all lines (not just the last one).

Now by using self.env.norecompute() and self.recompute() the problem was reduced.

Unreconciling an 'account.move' with 1576 lines with a payment takes almost 4
minutes when before this changes, the conciliation process seemed not to never
end.

Fix https://github.com/odoo/odoo/issues/30934

closes odoo/odoo#31014
2019-02-17 10:28:21 +00:00
Hugo Adan ce93a949a7 [REF] account: Performance improve for create_tax_cash_basis_entry
create_tax_cash_basis_entry presents a critical performance issue when
reconciling moves with a lot of account_move_line.

The issue is that `account.move` and `account.move.line` models are triggering computed fields/methods for each new
`account.move.line` added, computing all lines again and again.

Making a factorial performance issue.

For each line the function try create cash basis entries for tax/base lines and this is combined with all the
fields compute that exists on the model so this introduce a performance problem

The issue is that `account.move` and `account.move.line` models are triggering
computed fields/methods for each new `account.move.line` created isolated,
computing all lines again and again.

e.g.
 _compute_matched_percentage at
https://github.com/odoo/odoo/blob/5e8289cfeaf52a1eac64bcc975b186f0b5f9594b/addons/account/models/account_move.py#L44-L62

Then for each line created this compute is executed for all lines (not just the last created one).

Now by using self.env.norecompute() and self.recompute() the problem was reduced.

Reconciling an 'account.move' with 1576 lines with a payment takes almost 4
minutes when before this changes, the conciliation process seemed not to never
end.

Fix https://github.com/odoo/odoo/issues/30934
2019-02-17 10:27:50 +00:00
Christophe Simonis 1cb3e7c522 [MERGE] forward port branch saas-15 up to c6c3d73391 2019-02-19 19:14:16 +01:00
Christophe Simonis c6c3d73391 [MERGE] forward port branch saas-14 up to 9b735d0057 2019-02-19 17:09:59 +01:00
Christophe Simonis 9b735d0057 [MERGE] forward port branch 10.0 up to 6cf4f4924b 2019-02-19 17:08:56 +01:00
Nicolas Martinelli bddd53881c [FIX] hr_holidays: numerical error
In some exceptional circumstances, the computation of the remaining
leaves might lead to numerical errors, e.g. a very small but non-zero
number (e.g. 10^-17)

This value will be displayed in the name of the leave type because of
the `%g` used in the string format. To avoid breaking the translation,
we round the value.

opw-1935232

closes odoo/odoo#31245
2019-02-19 12:43:07 +00:00
Nicolas Martinelli 29a3634c1a [FIX] l10n_us: ABA/Routing
When defining an ABA routing number with leading zeros (which is
possible), the value will always be displayed without them.

This is because the field is an integer. Since the ABA routing transit
number must be a nine-digit code, we automatically fill it with leading
zeros.

opw-1940138

closes odoo/odoo#31223
2019-02-19 07:59:25 +00:00
Nicolas Martinelli 3e147220fd [FIX] account_voucher: round globally
- Enable multi-currency. Company currency = USD, another currency = SGD
- Update the exchange rate
- Create a purchase journal. Assign SGD to this journal
- Create a purchase tax of 7.00 %
- Enable tax rounding globally
- Create a purchase receipt with the following values
  62.04 @ 7% tax
  7.29 @ 7% tax

An error occurs: 'Cannot create unbalanced journal entry.'

Each line of the receipt creates its own tax line, which is therefore
rounded => the total of the receipt is computed with a 'round globally'
configuration, while the taxes are computed with a 'round per line'
configuration.

This is because `apply_taxes=True` is set in the context. This creates
the tax line by forcing the rounding. Therefore, we call the method
`_apply_taxes` explicitly in this specific case, and manually round the
taxes once they are merged.

opw-1938623

closes odoo/odoo#31194
2019-02-18 12:55:35 +00:00
Nicolas Martinelli cece8834f9 [IMP] account: apply taxes
We extract the tax creation from the AML creation in an external method,
in order to be able to call it separately.

This is necessary for the subsequent commit.

opw-1938623
2019-02-18 12:53:58 +00:00
Nicolas Martinelli 3a5c50e5c6 [FIX] account: TaxCloud multi-company
The TaxCloud settings are not company-specific.

opw-1933774

closes odoo/odoo#31198
2019-02-18 13:10:22 +00:00
Alexandre Kühn fa2a5055e7 [FIX] im_livechat: instantly receive messages from new livechat
Before this commit, when new messages were posted in a new
livechat, the operator received them after a delay. This
may take up to a minute before receiving the notification.

This behaviour was causing a bigger issue: those notifications
may never be received by the operator. This case happened when
the operator was receiving more recent notifications while
notifications from new livechats were pending.

The delay was caused by the operator not yet subscribed to
notifications on the newly created livechat. It is only on
the next poll of longpolling that the subscription occurred,
then followed by dispatching the notifications to the operator.

This commit fixes the issue by dispatching new messages of new
livechats directly to the operator. This is done by enforcing
the operator to make another polling when a new livechat is created,
so that he is always subscribed to those livechats. As a result,
new messages are received instantaneously.

opw-1933951

closes odoo/odoo#31191
2019-02-18 12:20:40 +00:00
Christophe Simonis 6cf4f4924b [FIX] stock: remove domain on stock.location of picking types
There is no `company_id` field on `stock.picking.type`.

Partially revert f221936f8b (#30952)

closes odoo/odoo#31121
2019-02-14 20:25:55 +00:00
Christophe Simonis c0f24d54cf [MERGE] forward port branch saas-14 up to c1fe9f18d5 2019-02-14 18:14:08 +01:00
Christophe Simonis c1fe9f18d5 [MERGE] forward port branch 10.0 up to 69719f598a 2019-02-14 18:09:24 +01:00
Denis Ledoux 69719f598a [FIX] google_calendar: case insensitive attendee sync
In Odoo, create a user John@example.com (the cap is on purpose)
In Google Calendar, create an event and invite john@example.com

Sync your Google calendar.

Before this revision,
the event created in Odoo did not add John@example.com,
but created a new attendee, john@example.com, because
of the sensitive casing.

Besides, give the priority to partners having
users, so if there are two partners with the same email,
one of them having a user,
e.g. John@example.com (with user) & john@example.com (without user),
set the partner having the user as attendee,
as its the one with the user who use the Odoo calendar,
and potentially the Google sync as well.

opw-1925592

closes odoo/odoo#31111
2019-02-14 11:07:25 +00:00
Nathan de Pryck db691dbebf [FIX] account: reverse entry when account move line contains 0 in credit or debit
In some case, when the user enter by mistake an account move line
 with an amount of 0,the reverse operation does not works properly.
The issue happenned during the reverse operation because it tries to
reconcile a 0 account move line with no matches (credit or debit).

See opw-1931961
2019-02-14 09:13:24 +01:00
Raphael Collet cd3790c4ea [FIX] models: check groups on inverse fields
Before this, groups on non-stored inverse fields were not checked upon write.
The impact on existing fields is pretty small, since the inverse methods of
those fields are subject to access rights on the records they use.

closes odoo/odoo#30356
2019-02-13 10:35:09 +00:00
Lucas Perais (lpe) 61623bd17c [FIX] fields: read/write company-dependent fields without ir.property access
This is the first step to a more comprehensive handling of company-dependent
fields which are ir_properties.

With model-specific access rights, users should be able to read/update a
company-dependent field no matter their access rights on ir_property.

Before this commit, a user having access to res.partner, but not to ir.property
couldn't write on property_account_receivable/payable just because he couldn't
write the corresponding ir.property.  After this commit, he can.

OPW 1923345
2019-02-13 09:34:08 +00:00
Lucas Perais (lpe) b62d720c85 [FIX] l10n_it: change website in manifest
openerp-italia.org or odoo-italia.org are not valid websites

changing it to odoo.com

OPW 1940848

closes odoo/odoo#31110
2019-02-14 10:55:36 +00:00
Nicolas Lempereur 0857737f8c [FIX] web_editor: focus lost with inline editor
When an inline editor is eg. in a form view, the focus is always stolen
by it.

This is because we trigger a mouseup on the editor to update its
toolbars values and informations.

note: backport of 11.0's 7a453b0b7a

In 10.0 this trigger could cause a "blur" which in some instance is not
wanted (eg. inside a newline of a list view).

opw-1906581
closes #31078
2019-02-13 17:21:19 +00:00
Nicolas Lempereur 1e43c73a99 [FIX] web_editor: html widget empty value stay empty
The html widget automatically replace an empty field value by
`<p><br></p>` to be able to add content.

But this may cause unintended "onchange", since the value has "changed"
and the onchange themself could cause error when triggered at the wrong
time (eg. inside a list view with required fields).

With this changeset, the onchange is averted when the value was false
and is now `<p><br></p>`.

opw-1906581
closes #31078
2019-02-13 17:11:13 +00:00
Lucas Perais (lpe) 5b37c40cac [FIX] point_of_sale: reconcile cash returns rather than freight returns
Revert commit 296c5a2106
which was half-right: the accounting logic is correct but it overlooked
that it broke the reconciliation of cash returns
i.e. the client gives more money, and you return the change

Given that this latter use case may occur more frequently we focus on that
while we break freight returns
i.e. the client returns a product, and you give the money back

It is not possible to support both use cases because
ultimately we don't know from which order an account.move.line comes

the related PR #23356 should support both use cases
but adds a field on account.move.line

OPW 1925607

closes odoo/odoo#31037
2019-02-12 16:27:51 +00:00
Moens Alexandre 7dea5c418b [IMP] base_import_module: tell user what they actually can import
This commits adds a message to the module import wizard to make it more
clear what kind of modules can be imported through the front end.

project : RD feedback
task : [base_import_module] what it is not for.
opw-1939967

closes odoo/odoo#31057
2019-02-13 11:50:51 +00:00
Denis Ledoux 5ebcd188f3 [FIX] stock: improve performance of product quantity search
Calling `search` on `product.product` without specifying an order
will sort the products by name.

As the product name is a translatable field,
it requires to make a join on the translation table to sort
the product by their translated name.

This join is costly, and in this case it was completely
irelevant to do it, as the goal was simply to compute
a domain with only a list of product ids, for which
the order simply did not matter.

By forcing the order on the id,
we avoid the sort on the product name,
and therefore the join on the translation.
The performance is therefore improved.

opw-1930010

closes odoo/odoo#31066
2019-02-13 12:52:48 +00:00
Nicolas Martinelli f221936f8b [FIX] stock: location company
Force the location and destination location's company to match with the
picking and picking type company. This is to prevent users to move
products between companies without using a transit location, since stock
valuation is not supported.

The record rule `stock_location_comp_rule` gives access to children
companies. The domain added in the view is more restrictive, and allows,
for a company A, transfers from locations:
Company A -> Company A
Company A -> No Company
No Company -> Company A

opw-1893276

closes odoo/odoo#30952
2019-02-11 11:14:26 +00:00
Naglis Jonaitis af95efcfd6 [CLA] signature for naglis
closes odoo/odoo#30978
2019-02-11 07:05:59 +00:00
Christophe Simonis 9773be345e [MERGE] forward port branch saas-14 up to 18228f9c4e 2019-02-08 13:28:46 +01:00
Christophe Simonis 18228f9c4e [MERGE] forward port branch 10.0 up to be689c53c1 2019-02-08 11:40:01 +01:00
qsm-odoo be689c53c1 [FIX] web_editor: review drag and drop in the editor
When dropping a snippet into a page, it is dropped in the drop-zone
which is the nearest of the user cursor. When moving a snippet, that
condition did not apply and the user was required to put the cursor at
the exact location of the drop-zone.

Also, for both drag and drop features, the drop zones which appeared
were not displayed correctly for full width columns, which made dropping
sometimes impossible when multiple col-*-12 were below each other.

task-1937758

closes odoo/odoo#30899
2019-02-07 11:12:36 +00:00
RomainLibert 0757ba3c63 [FIX] fleet: fix _get_default_state method
If fleet.vehicle_state_active is not found in the system then the method
will raise an error, hence it won't allow creating any fleet.vehicle

closes odoo/odoo#30925
2019-02-07 15:25:13 +00:00
Nicolas Martinelli fa97d6ab15 [FIX] purchase: supplier on parent company
- Create a product and set a contact as the vendor (for instance, Arthur
  Gomez from Asustek in the runbot)
- Set a specific name and code for the supplier
- Create a RFQ for this vendor (Arthur Gomez - the contact person)
- Add the product, confirm the RFQ

On the product, the company (Asustek) is automatically added as vendor,
but there is no vendor name and code.

opw-1929745

closes odoo/odoo#30891
2019-02-06 14:17:45 +00:00
Josse Colpaert 845a6a9e08 [FIX] stock: lot in multiple locations
- Activate:
  'Track lots or serial numbers'
  'Manage several Warehouses, each one composed by several stock locations'
  'Advanced routing of products using rules'
- In the main warehouse, activate Pick + Ship
- In Stock Locations, create 'WH/Stock/Shelf 3' and 'WH/Stock/Shelf 4'
  (1 and 2 already exist, use the same config)
- Create a new product 'Foo', activate Tracking By Lots
- On Foo, use 4 times the "Update Qty on Hand" (order is important):
  Add 1 on Shelf 2, create a lot
  Add 1 on Shelf 1, use the same lot
  Add 3 on Shelf 4, use the same lot
  Add 1 on Shelf 3, use the same lot
- Create a SO, set a partner
- Ensure that YourCompany is used as warehouse
- Add several SO lines (order is important)
  a line with 1 product Foo
  a second line with 1 product Foo
  a third line with 4 products Foo
- Confirm the SO, you now have 2 deliveries, 1 Pick, 1 Out
- Open the Pick, all moves should be available, you should have:
  4 operations:
    Shelf 2, quantity 1
    Shelf 4, quantity 3
    Shelf 1, quantity 1
    Shelf 3, quantity 1
  3 moves:
    A, quantity 1
    B, quantity 1
    C, quantity 4
- On each operation, select the lot created before and set the quantity
  to be fully done
- Validate the Pick

The moves end up like this:
- Move A with qty 1: is done and linked with a quant of 1
- Move B with qty 1: is done and linked with no quant
- Move C with qty 4: is done and linked with a quant of 1, a quant of 3,
  a quant of 1 (sum is 5)

In the Out picking, the move linked with the source move (B) with no
quant stays in "Waiting another move" even if the source move is done.
This outgoing move will never be available.

In the method `recompute_remaining_qty`, we loop on operations, and
match them wih the moves. However, the operation with the largest
quantity (Shelf 4, quantity 3) is processed before the move with the
highest quantity (C, quantity 4). Therefore, when we later loop on move
C, `qty_assign_cmp` is larger than zero, which sets `need_rereserve` and
ultimately triggers `rereserve_quants` in `do_transfer`.

A first part of the fix is to check for the location of the quants when
matching moves and operations. This fixes the original issue, but
inconsistencies can still arise since a quant which is taken partially.
therefore, we make sure to never take more than the quantity on the
link.

opw-1932624

closes odoo/odoo#30857
2019-02-06 08:55:56 +00:00
Nicolas Martinelli c7c938996f [FIX] account: analytic cost
- Set a cost of 12.34 for product P
- Create manually a new analytic entry
- Choose product P
- Set desired quantity

The analytic amount is set to 12.00.

This is because `move_id` is empty, therefore `currency_id` is empty as
well and `decimal_places` is zero

opw-1924184

closes odoo/odoo#30869
2019-02-06 10:27:59 +00:00
Atchuthan, Sodexis d89f4d6ec2 [FIX] stock: set picking_type_id to readonly except in draft state
Before this commit, the customer is allowed to change picking type after the
stock.picking record is moved from draft.
But it doesn't make the changes in the stock moves and operations as the
procurements are already created for initial demand.

To avoid confusing the user, it can now only be modified in draft state.

Authored by SodexisTeam

opw 1848252
opw-1934814

closes odoo/odoo#30865
2019-02-06 09:50:35 +00:00
Christophe Simonis 66efbf2b5b [MERGE] forward port branch saas-14 up to 53ba83579b 2019-02-05 12:36:15 +01:00
Christophe Simonis 53ba83579b [MERGE] forward port branch 10.0 up to 8cb2965e23 2019-02-05 11:41:23 +01:00
Yenthe666 2ba6be2004 [DOC] reports: add documentation for custom fonts
closes odoo/odoo#30813
2019-02-04 13:27:01 +00:00