Commit Graph
123616 Commits
Author SHA1 Message Date
Priyanka Kakadiya 2a7a6c096e [FIX] purchase: do not set currency_id to false
- currently, cuurency_id has default value as currency of user's company id. but, when there is no partner set then 'onchange_partner_id' will trigger and set currency_id to false.
- so, set user's currency_id instead of false if no partner set.

Related to Issue: 1948645

closes odoo/odoo#32415

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-04 10:30:55 +00:00
Lucas Perais (lpe) 0e85b5b132 [FIX] odoo: patch babel for "World" language territory
Following c844d66091
where generic Arabic (World) is coded ar_AA
but babel doesn't support this

Instead, babel understands xx_001 for World generic languages

http://www.unicode.org/reports/tr35/#unicode_region_subtag
http://www.unicode.org/reports/tr35/#unicode_region_subtag_validity
BCP47: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

OPW 1961396

closes odoo/odoo#32344

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-04-03 14:03:00 +00:00
Robot Odoo 251021796c [FIX] base, base_address_extended: optimisation of partners import
If bulk-importing clients with a parent_id set, there's a ton of extra /
post-processing work which is not batched and "de-optimises" the
batching added to import.

High-level comparison of performing a "Test Import" on a synthetic test
file of 10000 partners (all with a parent_id set to a pre-existing
record) went from ~30mn to ~8mn on my machine.

Fixes #31549

closes odoo/odoo#31876

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-04-04 09:28:12 +02:00
Christophe Simonis 27ea18a21b [FIX] website_sale: correctly convert currency
Oversight of previous forward-port.
2019-04-03 20:27:50 +02:00
Christophe Simonis f36175dd8f [MERGE] forward port branch saas-11.3 up to b3d4c2d178 2019-04-03 18:46:36 +02:00
Lucas Perais (lpe) 491deeb3d4 [FIX] account, account_check_printing: print all reconciled invoice on a payment
Make some invoices
Make a payment
Reconcile it with the invoices through the reconciliation widget
Print the payment receipt and the checks

Before this commit, neither the payment receipt nor the checks contained
the invoices
This was because the prints relied on only the field invoice_ids
filled specifically when registering a payment on an invoice

After this commit, the prints mention the invoices

OPW 1947002

closes odoo/odoo#32365

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-04-03 13:24:59 +00:00
Nicolas Lempereur 0539dde576 [FIX] point_of_sale: background layout header iframe
When a report with header is displayed in iframe with layout
"Background", part of the header maybe outside of the page.

For example on /my/invoices portal show of an invoice, the max width
report iframe can set at 210mm (+/- 793.7px normally), the header in
background layout has `min-width: 900px` so is wrongly centered and may
have content outside of shown page (eg. company tagline).

The same issue happen when using HTML rendering of the report in
backend, but depends on the viewport width.

This may be the expected configuration when printing (wkhtmltopdf should
unzoom if something was too large to fit) but not when displaying html
directly.

opw-1915807
closes #32373

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-04-03 10:05:53 +00:00
Christophe Simonis b3d4c2d178 [FIX] account: IndentationError
Oversight of previous forward-port.
2019-04-02 17:44:36 +02:00
Christophe Simonis 1122b62d00 [MERGE] forward port branch 11.0 up to 4df568549a 2019-04-02 16:35:17 +02:00
Christophe Simonis 4df568549a [MERGE] forward port branch saas-15 up to 180f105508 2019-04-02 13:58:03 +02:00
Christophe Simonis 180f105508 [MERGE] forward port branch saas-14 up to d158a8ffbf 2019-04-02 12:34:15 +02:00
Christophe Simonis d158a8ffbf [MERGE] forward port branch 10.0 up to 2d30bd9698 2019-04-02 12:28:19 +02:00
Xavier Morel 6c2b54ff9c [IMP] base_address_partner: optimise transfer betwen parent and child
Mostly a concern during bulk import of partners with parents.

First remove syncing extended fields, that seems completely
unnecessary since the street gets sync'd and will get split through the
normal process (updating the sub-fields), by also syncing the split
fields we're redundantly calling _set_steet and rewriting the address
we just sync'd.

Second if write()ing both the country and street, the override would
then go and re-write the street based on what had *just* been split
into sub-street fields, which could waste a lot of time during the
import post-process as address fields get moved back and forth between
parents and children leading to *lots* of writing both country and
address together, we're talking:

 ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10002/2    0.111    0.000  344.390  172.195 res_partner.py:181(write)
[...]
      2    0.455    0.228  165.264   82.632 base_address_extended.py:41(_set_street)

My initial instinct was to just add the country_id to _set_street and
remove the write override but it would break
88ff6beb01: if the country alone is
updated on a partner, we do want to re-format the "unified" address
based on individual fields and the new country's format.

Note: it might be that the logic would be more sensible by inversing
the entire thing, such that the split fields are the proper
source (regular stored fields) and street is converted to a computed
field instead, but that'd be a larger model change. Seems like it'd
make more sense though, at least given what the modules attempts to
do (OTOH the module probably fails
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/
in just about all the ways).
2019-04-02 09:57:49 +00:00
Xavier Morel b4ae543098 [IMP] base: batching of _compute_commercial_partner
Should correctly handle / fallback to regular code when processing
non-stored partners.

Perf difference according to cprofile on my machine:

original python:
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     1    0.134    0.134  205.380  205.380 res_partner.py:277(_compute_commercial_partner)
SQLized
     1    0.118    0.118   67.239   67.239 res_partner.py:280(_compute_commercial_partner)

most of the time leftover seems to be in modified_draft
2019-04-02 09:57:49 +00:00
Xavier Morel 1fb20fe304 [IMP] base: try to batch update of children address & commercial fields
With profiling enabled, importing 10k partners, with all of them
having the same parent (though not with all of them having the same
is_company setting) lowers sync / post-process time from ~550s to
~330s.

Put it in an override to _load_records_create so it's only active for
imports (which is the original report & test case), use a context key
to avoid going the post-processing work in create.
2019-04-02 09:57:49 +00:00
Nicolas Martinelli 180866fe1e [FIX] website_sale: discount
- Go to Sales > Configuration > Settings
- Enable "Multiple Sales Prices per Product" and select option "Prices
  computed from formulas (discounts, margins, roundings)"
- Go to Sales > Catalog / Pricelists
- Select "Public Pricelist" and set "Discount Policy: Show public price
  & discount to the customer"
- Go to the eCommerce, buy "iPad Retina Display" which as a 20 %
  discount

In the corresponding SO, the discount appears to be zero, and the
discount is included in the price unit. However, adding the product
directly to the SO in the backend displays the discount as expected.

There should not be a difference in behavior between the eCommerce and
the backend.

Fixes #31337
opw-1943989

closes odoo/odoo#31965

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-02 07:43:06 +00:00
Nicolas Martinelli 1fc0b08e14 [FIX] account: partners not shared
- Activate multi-company, but do not share contact book.
- Create 2 companies A & B
- Create a partner named 'PartnerA' in company A
- Switch to company B
- Import a bank statement with partner name set as 'PartnerA' (use the
  bank statement template if necessary)
- Reconcile the entries

An `AccessError` is raised.

The partner suggestion doesn't take into account the record rules,
therefore it might happen that the user doesn't have access to it.

opw-1958711

closes odoo/odoo#32239

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-02 07:40:58 +00:00
Martin Trigaux 23afec1b8d [FIX] l10n_multilang: avoid module conflicts
In case two modules are using the same local name for their external identifier,
a conflict may occure.
e.g. the templates
- l10n_generic_coa.a_salary_expense
- l10n_be.a_salary_expense

will generate
- l10n_generic_coa.1_a_salary_expense
- l10n_be.2_a_salary_expense

As the previous search for in_xml_ids was using a domain
   ('name', '=', 'a_salary_expense')
both records were returned, making in_ids to have one more record than out_ids

Followup of review made at odoo/odoo#31510

closes odoo/odoo#31604

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-04-03 11:24:35 +00:00
Lucas Lefèvre 663597b50f [FIX] web: Load correct form view for calendar popup
When creating a record from a calendar view,
the default form view is always used when using the popup mode,
ignoring the `form_view_id` attribute of the <calendar/> tag.

After this commit, the `form_view_id` is no longer ignored.

closes odoo/odoo#32379

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-04-03 10:40:34 +00:00
Nicolas Martinelli 1e558bc79a [FIX] tools: February 28th
- Set your fiscal year end date to 28th February
- Run the P&L a year before a leap year, e.g. anytime between March 1st
  and December 31st 2019.
- Select 'Last Financial Year'

The dates are set from 2019-03-01 to 2019-02-28.

There are actually 2 bugs. The one solved here is the following
inconsistency:

```
current_date = type(date)(2019, 4, 3)
date_utils.get_fiscal_year(current_date, day=28, month=2)
'date_from': datetime.date(2019, 3, 1), 'date_to': datetime.date(2020, 2, 28)

current_date = type(date)(2020, 2, 28)
date_utils.get_fiscal_year(current_date, day=28, month=2)
{'date_from': datetime.date(2019, 3, 1), 'date_to': datetime.date(2020, 2, 29)}
```

Both should return `'date_to': datetime.date(2020, 2, 29)`. This implies
that the period is recognized as `custom`, which is affected by the bug
solved in PR https://github.com/odoo/enterprise/pull/4006

opw-1949628

closes odoo/odoo#32366

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-03 09:29:57 +00:00
Goffin Simon 2c702108b8 [FIX] purchase_stock: Wrong journal entry created from vendor bill
Steps to reproduce:

- Create a storable product P with a vendor V and a purchase price = 100€
- Set the category of the prodcut to automated and AVCO and set a price diff account on it
- Create PO for V with 10 P with a price_unit = 110€
- Confirm the PO and deliver 7 P with no backorder
- Change the ordered quantity of P to 9 on PO (and the unit_price will be set to 100€)
- Go on the delivery order and deliver 2 remainig P
- Create the invoice and validate it

Bug:

The amount due on the invoice was 900.02€ instead of 900.00€

PS: The debit and credit of an aml are computed with the price (defined in function
_anglo_saxon_purchase_move_lines) with the function _convert_prepared_anglosaxon_line
defined on model account.invoice. So rounding the price unit after the computation
of the price allows to keep the same total as the one computed for the PO.

opw:1951465

closes odoo/odoo#32345

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-04-03 08:49:57 +00:00
Nicolas Lempereur 5d1661e6f4 [FIX] mail: send mail.mail ->nofail updating notif
When we go on a failed mail.mail and do "Retry" -> "Send Now", if there
is an existing notification that is not to the current user, we may get
an error or get the email in error.

This is because on a notification only:

- the superuser
- the targetted user of the notification

have write permission by default in Odoo.

So with existing notifications resending (by the mail.mail views, the
alternative mail.resend.message wizard works as expected) only worked
if they were current user's notifications or if user is superuser.

opw-1957730
closes #32346

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-04-02 15:03:18 +00:00
Xavier Morel 2430e28e83 [FIX] mrp: test_product_produce_3
Test was relying on qty_to_consume getting saved when the produce form
is saved, a behaviour of the SSF which diverged from the actual
client.

After fixing the SSF to behave more in-line with the actual
client (don't save o2m sub-fields unless they're flagged as
force_save) the test is now visibly broken.

Fix it so qty_done is properly updated during wizard configuration /
edition instead of updating the in-database object directly.

closes odoo/odoo#32047

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-04-03 09:42:04 +00:00
Xavier Morel ef8df8fb4e [FIX] core: don't send readonly fields in o2m in SSF
The SSF would correctly filter out readonly fields when saving a
toplevel form, however it could not remove readonly values when saving
o2m pseudo-records to the parent form (as these would be expected to
remain available for reading upon the next edition and whatnot), so
these values would get sent in 0/1 commands.

Filter out these fields during the parent / toplevel save call.

Complexity notes:

* evaluating readonly modifiers requires the entire record, so
  unchanged fields still have to be written back to the parent form
  and be filtered out when *it* is set up for save, an alternative
  would be to store the `changed` and `readonly` flags alongside the
  record dict, and have the post-process only override the
  pre-computed readonly flag using force_save
* had to fix a test to match the new behaviour, the post-edition
  states turns out to be in line with the client's behaviour (or how
  it looks anyway)

Fixes #32019
2019-04-03 08:44:22 +00:00
Xavier Morel 922d77a291 [FIX] core: infinite recursion in SSF on self-recursive models
The extra setup probably affects any o2m whose edition view itself
contains an o2m, but most likely to blow up entirely on models with
some sort of tree structure (parent/child relationship): the SSF
eagerly loads and setups the o2m's view, and the o2m's o2m's, ... ad
infinitam.

A better / cleaner fix would be to set up the subview on-demand (and
possibly cache it), but the rest of the o2m stuff is unlikely to work
correctly recursively so just don't recurse the o2m view setup at all
for now.

fixes #31458
2019-04-03 08:44:21 +00:00
Nicolas Martinelli fb48e49779 [FIX] account: deprecated accounts
Deprecated accounts are available in the reconciliation widget, while
they shouldn't be.

opw-1949667
opw-1945585

closes odoo/odoo#32304

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-01 13:37:04 +00:00
Nicolas Martinelli ef4aaeb4e7 [FIX] base: res.partner.bank sequence
`res.partner.bank` is ordered by sequence, but:
- there is no default value
- there is no widget handle to set it

Therefore, methods such as `_get_partner_bank_id` might retrieve an
unexpected value.

To avoid this:
- we fallback to sort by ID
- we add a default value
- we add the widget handle

opw-1948964

closes odoo/odoo#32300

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-01 12:48:04 +00:00
Nicolas Martinelli 67ea26460f [FIX] stock_account: inventory with company
- Set a company on the inventory location
- Create a stockable product, FIFO, real-time, with a cost
- Receive a unit

The product stock value remains zero.

The fact that the inventory location has a company set should not impact
the product cost. This is useful when a scrap location as a company set.

The domain of move selection is incomplete. It should be, for the 'in'
moves:
- coming from a location without company, or an inventory location
  within the same company
- going to a location within the same company

For the 'out' moves:
- coming from to a location within the same company
- going to a location without company, or an inventory location within
  the same company

opw-1943384

closes odoo/odoo#31485

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-01 11:00:29 +00:00
Xavier Morel 7e0b29cbcd [FIX] core: backport changes in 12.1/master to 12.0
PRs #28645 and #31494 were not applied to 12.0, but there's no reason
not to, they should only fix things (make behaviours more in-line with
the regular client), and since o2m is an area where more fixes are
needed and it would be nice to have them in 12.0...
2019-04-01 10:34:47 +00:00
Nans Lefebvre 295690ce70 [IMP] mrp: start work orders in the right state
To be able to override the initialisation of the work orders states,
we put that in a function.

opw 1943674

closes odoo/odoo#31774

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-04-03 08:11:30 +00:00
Odoo Translation Bot 2d30bd9698 [I18N] Update translation terms from Transifex 2019-04-01 02:44:26 +02:00
Nicolas Martinelli f7301a8eef [FIX] website_quote: redirect quotes only
- Create 2 identical SO: one with a quotation template set, the other
  without
- Validate them
- Go to the portal at `/my/orders`, access both orders

The order without template redirects to `/my/orders/<ID>`, while the
order with template redirects to `/quote/<ID>`.

Once the SO is validated, there is no reason to show a different page.
The redirection should only apply to non-validated SO.

opw-1925131

closes odoo/odoo#32262

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-29 15:51:59 +00:00
Odoo Translation Bot 48d88b6e6d [I18N] Update translation terms from Transifex 2019-03-31 03:16:57 +02:00
Olivier Colson b344c3c601 [FIX] l10n_jp: fix tax accounts
Forward port of commit https://github.com/odoo/odoo/commit/084246a54ed68e2898e9c713345192b2a33ddd81 (10.0) into https://github.com/odoo/odoo/commit/5e9ebe86bae53f019981361bbcc2f03a5d49e0cb (11.0) had wrongly replaced account code A21809 by its old version, A21807, in tax templates. It made the module uninstallable, as A21807 does not exist anymore.

closes odoo/odoo#32252

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-29 14:01:19 +00:00
Nans Lefebvre 6b9b9d8997 [FIX] base_geolocalize: raise a helpful error to configure the Google account
Google maps used to be free, but became a paid API.
Technically, the usage could be part of the free offer,
but to benefit from it the account needs to have billing enabled.
Since it's a paid feature security had to be ramped up,
so now APIs have to be explicitly enabled (here geolocating/geocoding).
All this makes it so that the Google account has to be properly configured
before the calls to the Maps API can work.
As a result we add an explicit UserError if the request fails,
to help the user configure the Google account
(before the error was entirely hidden as to give the user no chance at all).

Also exports transaltions, including for commit e6ca846c65
which raised a similar error message if no API key was found.

opw 1946485
opw 1947292
opw 1947337

closes odoo/odoo#32162

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-03-29 11:33:00 +00:00
Martin Trigaux 14f893752a [I18N] *: export 11.0 source terms
Some were missing or lost during forward port

Fixes odoo/odoo#32217

closes odoo/odoo#32232

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-03-29 09:13:25 +00:00
Christophe Simonis ec29b4d364 [MERGE] forward port branch 11.0 up to 4231103cc9 2019-03-28 18:17:20 +01:00
Christophe Simonis 4231103cc9 [MERGE] forward port branch saas-15 up to 23650d5217 2019-03-28 16:54:21 +01:00
Christophe Simonis 23650d5217 [MERGE] forward port branch saas-14 up to 7dd2a642ed 2019-03-28 16:53:18 +01:00
Christophe Simonis 7dd2a642ed [MERGE] forward port branch 10.0 up to 14a8148e8d 2019-03-28 16:52:53 +01:00
Christophe Simonis 14a8148e8d [FIX] hw_escpos: define used variable
Oversight of #32079
2019-03-28 16:50:16 +01:00
Christophe Simonis a039d657e4 [MERGE] forward port branch saas-15 up to 6b54bd88a9 2019-03-28 16:05:06 +01:00
Christophe Simonis 6b54bd88a9 [MERGE] forward port branch saas-14 up to 78f01e3609 2019-03-28 15:46:55 +01:00
Christophe Simonis 78f01e3609 [MERGE] forward port branch 10.0 up to 6814f27bbc 2019-03-28 15:46:04 +01:00
Gabriela Mogollón 88f4cfe1a5 [IMP] l10n_mx: add new tag for non-creditable tax (8%)
closes odoo/odoo#32224

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-26 23:19:34 +00:00
Nicolas Lempereur 03d74f4f76 [FIX] web: drag & drop month calendar->keep time
In fullcalendar, we have in f5b7ad80f fake moments date with UTC time
that are the local time, thus when we move an event to another day, we
need to set it as:

- the selected year-month-day
- the original utc hours (real local hours) -> local hours
- the original utc minutes (real local minutes) -> local minutes
- the original utc seconds (real local seconds) -> local seconds

When it is sent to server, timezone offset will be removed so we will
transfer to server the expected datetime in UTC.

With this changeset we send server the correct time when a fullcalendar
event is "all_day" but the original event was not (eg. drag and dropping
event on the month view).

Added test without change failed with:

 - 4. event moved to 27th nov 16h00 +40 hours timezone
      (expected "2016-11-29 08:00:00", result: "2016-11-27 16:00:00")
 - 5. expected: "event|6|11/27/2016|16:00:00"
      result: "event|1|12/09/2016|08:00:00"
 - 6. expected: "event|1|12/09/2016|08:00:00"
      result: "event|3|12/10/2016|23:55:05"

opw-1955281
closes #32136

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-03-26 17:49:40 +00:00
Xavier Dubuc 8b13f21679 [FIX] product: template kanban view perf
When displaying product template list in kanban mode, all the variants
of the product template are loaded but aren't used at all. This causes a
perf issue when loaded product templates have a lot of variants.

This commit removes the field `product_variant_ids` from view
`product_template_kanban_view` to avoid that perf issue.

opw 1951369

closes odoo/odoo#32048

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>

closes odoo/odoo#32185

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-28 07:25:06 +00:00
Nicolas Martinelli ad11910040 [FIX] mass_mailing: default value
Do not raise if data have been deleted. Since the fields are not
required, do not fallback.

opw-1959184

closes odoo/odoo#32163

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-27 13:29:48 +00:00
Nicolas Martinelli fa42cebdc9 [FIX] account_payment: pay credit note
Complement of commit 9a450ac162

opw-1958997

closes odoo/odoo#32115

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-26 08:41:12 +00:00
Nicolas Martinelli 24961b9e2f [FIX] website_sale_options: striked price
- Set the 'Public Pricelist' with 'Discount Policy: Discount included
  in the price'.
- Go to the shop and search the product 'iPad Retina Display'
- Add product to cart by using the quick add to cart button

The 'Add to Cart' modal show public price & discount to the customer.

Closes #31378
opw-1944362

closes odoo/odoo#32114

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-26 08:00:56 +00:00