Commit Graph
127612 Commits
Author SHA1 Message Date
Thibault Delavallée bccfe8a418 [IMP] website_slides: display a flag for unpublished lessons in course list view
It helps course maintainers understanding the state of their lessons.

Commit linked to task ID 1941250 and PR #31708.
2019-03-08 14:51:25 +00:00
Thibault Delavallée 6b7eeac56d [FIX] website_slides: fix domain computation of a channel slide list
When displaying a channel content all its slides are displayed in a
list view or cards view. Even slides current user cannot read because
he is not member of the channel are displayed, even if there is no link
(and access rights prevent them for effectively accessing the slide).
Purpose is to display a channel content without giving access through
ACLS at its slides.

However this domain computation was not correctly matching real use case
 * publishers should see everything;
 * public users should not see unpublished slides;
 * members not publishers should not see unpublished slides unless they
   uploaded it;

Commit linked to task ID 1941250 and PR #31708.
2019-03-08 14:51:05 +00:00
Thibault Delavallée edf68bde6c [REF] website_slides: extract code to have slides per category
Purpose of this commit is to have a method allowing to fetch slides
and have them ordered by category with some info on the category. It
fully supports uncategorized slides.

This commit also fixes the lessons list view of a training course. When
having rights to edit the channel the category name was not editable.
We now use a real browse record allowing to edit the category names
directly in this reorderable list view.

Commit linked to task ID 1941250 and PR #31708 .
2019-03-08 14:46:32 +00:00
Antoine Guenet c9b1401a23 [FIX] web_editor: update the handle on click input node in website edit
When clicking on a snippet containing an input node on Firfeox, the
handle wouldn't appear as expected. This is due to trying JQuery (but
not only) trying to modify properties that are restricted on Firefox but
not on Chrome. The error message still appears from time to time due to
Summernote using `document.getSelection`, which is problematic with
Firefox. This will be fixed with the next version of the editor. In the
meantime the direct effect of that error (the handle issue) is fixed
with this commit.

The standard target (`Event.target`) is now looked for in first position
instead of non-standard 'Event.srcElement` (IE alias for `Event.target`)
then `Event.originalTarget` (Mozilla-specific) and finally
`Event.target` (standard). `Event.originalTarget` is restricted on
Firefox so it was giving the same cryptic error as mentioned above
("Error: Permission denied to access property", which generally points
to same-origin policy violations).

Ref:
- https://developer.mozilla.org/en-US/docs/Web/API/Event/srcElement
- https://developer.mozilla.org/en-US/docs/Web/API/Event/originalTarget
- https://developer.mozilla.org/en-US/docs/Web/API/Event/target
- https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects
- https://developer.mozilla.org/en-US/docs/web/javascript/reference/errors/property_access_denied

closes odoo/odoo#31710

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-03-08 14:41:49 +00:00
Thibault Delavallée 7afd23e56c [FIX] website_slides: various fixes
Display
 * improve color of trophy displayed on top of course main page (success if
   course done, warning while working on it);
 * correctly fetch and display karma/xp points on course lesson list. It is
   either gain of next try, either awarded points depending on slide
   completion;
 * fix control buttons in course main page (prev, next, set done,
   set completed, fullscren), notably correctly set them disabled;

Linting / Code
 * put demo in no update;
 * rename some parameter in website_slides_survey to avoid conflict between
   quiz (on a slide) and certification (a survey);

 Commit linked to task ID 1941250 and PR #31697.

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-03-08 11:15:07 +00:00
David Beguin 523c1276a1 [IMP] gamification : move rank demo data into data
In order to se the 'next rank card' and the user karma on user's profile page,
not only the first rank is needed but also higher ranks. Otherwise everyone
will be 'Newbie', even the admin.

Moreover it is easier to update existing data for things like rank than having
to figure out how it works.

Task ID : 1941250
PR #31697
2019-03-08 11:15:07 +00:00
David Beguin f38a81f981 [IMP] website_slide_survey : set slide completed when quizz_passed
This commit sets the completed flag to True for a slide of type certification
when this certification is succeeded (quizz_passed set to True).

Also, the Download certification button has been added to the fullscreen mode
if the certification is passed by the user.

Task ID : 1941250
PR #31697
2019-03-08 11:15:07 +00:00
David Beguin 6091062e66 [IMP] website_(profile, slides): add custom pager to show on all users / courses pages
If there are too much users to show on the page and to avoid performance
issues, a pager is now applied on the all users page.

A new pager based on website_pager is added in order to ease the navigation
through the potential high number of pages. 'Go to first page' and 'Go to last
page' buttons have been added and the design of the pager have been adapted
to be more integrated into the new eLearning platform.

Also add the pager on the slide page if search category is applied. The pager
was already computed in the controller but not displayed.

Task ID : 1946160
PR #31697
2019-03-08 11:14:45 +00:00
Aurélien Warnon db53057528 [IMP] survey: add a stat button on survey to show the certified count
Purpose
=======

This commit adds a stat button on the survey form view showing the amount
of answers with the quizz_passed field set to True.
It allows to quickly see people that have been granted the certification.

On click, the stat button redirects to the answers list view with the "Quizz passed"
filter defaulted to True.
2019-03-08 11:00:06 +00:00
Aurélien Warnon 1932e25f68 [IMP] survey: show the quizz_passed field in the answers views
Purpose
=======

The quizz_passed field is now more important because it determines whether
a certification has been successfully taken or not.

This commit adds the quizz_passed field in:
- The search view of user_input
- The list view of user_input
- The form view of user_input (along with the score)
2019-03-08 11:00:06 +00:00
Thibault Delavallée 20e68b3297 [REF] website_slides: rework standard lesson page view
Purpose of this commit is to perform a cleaning and upgrade of the lesson
view in front-end when not using the fullscreen mode. This page had not
been updated since eLearning addition.

A method is added on slide model to have a protected method computing quiz
related information on a given set of slides, notably potential karma gain,
gained karma and number of attempts. It is mainly a code move from controllers
now working in batch.

Some linting is also done, notably a badly-named file.

See original eLearning task for main specifications [1].

Commit linked to task ID 1941250 and PR #31657.

[1] See task ID 1902304

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-03-07 19:51:33 +00:00
Suganthi Karunanithi eb62cd2c2b [FIX] gamification: badge auth for badge no error
To avoid exception:
  TypeError: Mixing apples and oranges: gamification.badge() - gamification.badge.user(1,)

when rule_auth of a badge is set to `having`.

opw-1945440
closes #31436
closes #31595

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-03-06 18:00:53 +00:00
Nicolas Lempereur ee5f1e277d [FIX] web: pivot no result no remove groupbys
Since f8b38f64d dictionaries "groupbys" are the same object between the
pivot model instance and the headers menu.

But this causes an issue in 12.0 since when there is no results, the
headers menu groupbys is truncated and now being the same object, the
pivot model instance is also truncated.

So succedding search that find results would possibly have lost the
groupbys which is unexpected and breaks some 12.0 tests not expecting
it.

With this changeset, the groupbys are not truncated anymore.

Without the change, the added test fails with:

 Column groupby not lost after reload after empty results
  expected: { "pivot_column_groupby": [ "customer" ],
              "pivot_measures": [ "__count" ], "pivot_row_groupby": [] }
  result:   { "pivot_column_groupby": [], "pivot_measures":
              [ "__count" ], "pivot_row_groupby": [] }
closes #31644

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-03-06 17:02:35 +00:00
Luis González 7ef6557902 [FIX] l10n_mx: Add sequence to taxes for IVA 8%
Since those taxes are missing a sequence and they're at the bottom of
the data, they're being taken as the default ones for the mexican chart
of accounts. However, the default taxes for sales and purchases should
be IVA 16%.

closes odoo/odoo#31651

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-07 02:28:39 +00:00
Nathan de Pryck 10964a230c [IMP] account_asset,account: Performance improvements
The generation of the deffered revenues took initially 471s.This
improvement permit to reduce the time to 72s (behave Cprofiler).
The issue was related to the fact that all the message post and logs
invalids the cache. It results that several read requests were
repeated multiple times.

closes odoo/odoo#31750

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-03-14 09:36:41 +00:00
xmo-odoo 5ec4da2ee2 [IMP] base_module_import: ignore garbage directories
If the zipfile contains some garbage directories (e.g. leftover empty
directories from git, `__MACOSX` metadata folder, …) it seems
unnecessary to log an error, just skip the directory and don't mark it
as a proper / successful module.

closes odoo/odoo#31639

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-03-06 15:02:38 +00:00
David d3c980e92e [FIX] point_of_sale: put PoS picking sequence in noupdate
The default PoS picking sequence should not be reset.
Losing custom configuration can lead to errors.

For instance:
- A customer initially uses the default sequence until POS09999
- he changes it to another one of his own taste starting the
  sequence over, like: WH/POS/00001
- In a module update, the sequence is reset and then we get the POS
  prefix again.
- In the next picking, we could have a duplicated name, and an error
  would raise in the Point of Sale.

opw 1962302
closes #32299

closes odoo/odoo#32842

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-04-19 11:40:07 +00:00
Lucas Perais (lpe) f9ce7d1fc8 [FIX] account: report overdue: name of company duplicated
Have a partner which is only a company
Print "Due Payments" report

Before this commit, the name of the company was shown in double
this was because both `name` and `contact_address` are shown in that report
but in the case of a company, or child of a company, the company's name
is included in contact_address

After this commit, the name appears only once

OPW 1970581

closes odoo/odoo#32838

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-04-19 12:48:07 +00:00
Lucas Perais (lpe) 0106fcd59c [FIX] website_quote: change website_description when the template id changes
Have a SO with a partner in another language
Apply a quote template to a SO
Customize the portal view to show website_description of a product on the template
Translate it
Show the SO on the portal

Before this commit, the description of the product was not translated
This was because the field was not included in the onchange of template_id
causing that field to never have changed, that is, it kept the description
done injected with the first write

After this commit, the description is changed according to the partner's lang

OPW 1960977

closes odoo/odoo#32825

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-04-19 09:08:14 +00:00
Joseph Caburnay 0229ef4c4a [FIX] auth_signup: portal user redirect to /web after signup
To reproduce:
0. Start an odoo v10 instance with --load=saas_worker,web
1. Install ecommerce.
2. Enable "Allow external users to sign up" and "Enable password
reset from Login page" from General Settings.
3. Open different session then signup a new user.
4. After successfull signup, the new user will be redirected
to the backend (/web).

Facts to consider:
1. odoo.addons.auth_signup.controllers.main.AuthSignupHome and
odoo.addons.website.controllers.main.Website both inherit
odoo.addons.web.controllers.main.Home
2. When instantiating an odoo instance *without* saas_worker,web,
the mro is the following:

( <class 'odoo.http.Home (extended by Website, AuthSignupHome)'>
, <class 'odoo.addons.auth_signup.controllers.main.AuthSignupHome'>
, <class 'odoo.addons.website.controllers.main.Website'>
, <class 'odoo.addons.web.controllers.main.Home'>
, <class 'odoo.http.Controller'>
, <type 'object'>
)

while the mro *with* saas_worker,web loaded is:

( <class 'odoo.http.Home (extended by AuthSignupHome, Website)'>
, <class 'odoo.addons.website.controllers.main.Website'>
, <class 'odoo.addons.auth_signup.controllers.main.AuthSignupHome'>
, <class 'odoo.addons.web.controllers.main.Home'>
, <class 'odoo.http.Controller'>
, <type 'object'>
)

You can notice that depending on how the instance is instantiated,
the order of inheritance is different.

The problem occurs when saas_worker is loaded, so this bug can be
experienced by saas clients.

Explanation of the fix:
Notice that the original code calls web_login of its super in its
web_auth_signup method. This is technique is used normally during
optimization (according to RCO). If website is installed, the
portal user should be redirected to '/' instead of '/web' and this
is defined in web_login of website. However, the web_login of
"website" is not called after signup because "website" is not super
of "auth_signup" when saas_worker is loaded (see the mro above).

Calling self.web_login will make sure that web_login is called from
top to bottom, and regardless of the order of website and auth_signup,
web_login of "website" will be called and makes sure that the
new portal user is redirected to the '/' and not to '/web'.

opw-1956980

closes odoo/odoo#32741

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-19 07:06:37 +00:00
Julien Castiaux 10b342ca6e [FIX] website_event_sale: free event
`price_reduce` is a computed field that depends on `price`.

opw-1961576

closes odoo/odoo#32800

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-18 12:39:16 +00:00
Nicolas Martinelli 1ab61efeb6 [FIX] l10n_fr_pos_cert: fpos settings
The computation of hash integrity depends on the field
`tax_ids_after_fiscal_position`. However, this field is computed, but
not stored.

It means that if one modifies a fiscal position used in the POS, the
computation of `tax_ids_after_fiscal_position` will change.
Consequently, the hash computation of the order will be modified, and
the hash integrity of the journal will be corrupted.

We prevent the modification of the taxes implied in a fiscal position if
any POS order use it.

Closes #32665
opw-1969009

closes odoo/odoo#32701

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-16 07:16:29 +00:00
Martin Geubelle 1793d6d138 [FIX] web: update breadcrumbs when switching view
To reproduce:
 1. go on list view
 2. open record in form view
 3. come back on list view
 4. switch to kanban
 5. open record in form view
 6. click on breadcrumb

Before this rev. we were back on the list view, and not the kanban view.

This is due to the fact that the breadcrumb was not updated when switching view,
(if a controller was already existing) so the form view control panel breadcrumb
was still referencing the wrong (list) controller.

This bug appeared with the control panel refactoring, which is now managed by
the view itself (and not the action manager as previously).

Task 1932646

closes odoo/odoo#31598

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-06 10:28:01 +00:00
Toufik Ben Jaa 5805c032a4 [FIX] analytic: name_search return no results
- Since the commit 5fcf891e07 an issue has
  been introduced in the `analytic.account.analytic` name_search method.

  In some cases searching through analytic accounts will return no
  results when it should.

  The issue is due to a bug in `expression.py` that doesn't correctly
  handle the fields in `auto_join`.

  The issue is described here https://github.com/odoo/odoo/issues/25175
  and will be fixed by the ORM team.

closes odoo/odoo#31628

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-06 12:15:35 +00:00
Julien (juc) Castiaux e0bd7b9932 [FIX] mass_mailing: inline image not supported
Inline (base64) embedded images are not supported by most mail
clients (gmail on top of them), this fix save those images as
attachments and replace the src tag with the url of the
generated image so the image correctly renders.

opw-1929940

closes odoo/odoo#31532

Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2019-03-06 09:04:29 +00:00
Toufik Ben Jaa e4c434c6ff [FIX] hr_holidays: inconsistency in leave record rules
- `hr.leave` and `hr.leave.allocation` should have the same record
  rules, otherwise leave approval behavior can be unpredictable.

  As a Holidays Team Leader:
    For example you could see the approve button on a leave but cannot
    approve it because the `_check_holidays` fails

closes odoo/odoo#31620

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
2019-03-06 09:03:28 +00:00
Christophe Simonis 3e54704e66 [MERGE] forward port branch 11.0 up to 27081bf6f5 2019-03-05 17:26:04 +01:00
Christophe Simonis 27081bf6f5 [MERGE] forward port branch saas-15 up to c03f6db6ea 2019-03-05 16:45:22 +01:00
Christophe Simonis c03f6db6ea [MERGE] forward port branch saas-14 up to fdb9f8273b 2019-03-05 16:23:55 +01:00
Jorge Pinna Puissant 7698f18ddd [FIX] event_sale: result returned by super not propagated
Issue introduced in commit : 7c63f39db086f68fdce5b7d97bdcded74c125178

opw-1947735

closes odoo/odoo#31600

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-03-05 14:14:49 +00:00
Toufik Ben Jaa 2bebbdefc2 [FIX] hr_holidays: allow employee's manager to approve employee's leaves
- Allow users with the "Holidays Team Leader rights" to approve the
  leaves of the employees they manage.

closes odoo/odoo#31586

Signed-off-by: "Christophe Simonis (chs)" <chs@odoo.com>
2019-03-05 10:45:00 +00:00
Martin Trigaux 1748b46718 [REV] orm: revert d855e3911f
This commit introduced a regression in web_studio, discovered at opw-1947380

A fix in web_studio will be integrated too but the regression is the proof this
commit should not have been integrated in 11.0.
While the new behaviour introduced at d855e3911f makes more sense, it is still
a change of behaviour that should not target a stable version.

For the problem raised at opw-1887162 that d855e3911f was trying to fix, a
workaround should be used instead.
For instance, setting a widget='html_frame' allows to translate in the website
editor that handles this correctly.

In master, the new behaviour can be maintained and eventual regressions will be
investigated there.

closes odoo/odoo#31585

Signed-off-by: "Martin Trigaux (mat)" <mat@odoo.com>
2019-03-05 10:18:11 +00:00
Yannick Tivisse 9cbf7cd464 [FIX] hr_payroll: Display fields correctly on settings
closes odoo/odoo#31362

Signed-off-by: "Yannick Tivisse (yti)" <yti@odoo.com>
2019-03-05 08:46:42 +00:00
Thibault Delavallée 273fc4af6e [IMP] guidelines: remove actually wanted PEP8 options
Task-1817988

closes odoo/odoo#28714

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-03-05 08:43:31 +00:00
Thibault Delavallée d256350f34 [IMP] guidelines: improve xml ids naming section
* rewording of XML naming section
* remove the convention of suffixing inherited XML ids
  with `_inherit_my_module, as the information is in the
  complete XML id name (prefixed by module name). This will
  avoid too long XML ids.
* extend convention for the name of groups, views, ...

Task-1817988
2019-03-05 08:41:23 +00:00
Thibault Delavallée 64662cc2a9 [IMP] doc: add guidelines for window actions naming
Rewording of "action" naming section.

Task-1817988
2019-03-05 08:40:37 +00:00
jem-odoo dadec538bc [IMP] doc: rewrite part of module structure and js references guidelines
This commit
 * removes deprecated guidelines for static file and assets struture;
 * fixes some typo and mistakes;
 * correctly links JS guidelines section;
 * adds a running example to ease understanding;
 * adds missing section about security files;
 * adds text blocks for each directory to show directly the
   expected result of each section;
 * perform some rewording;

Thanks to @pedrobaeza for its review.

Task-1817988
2019-03-05 08:38:30 +00:00
Nans Lefebvre fc1389f8d8 [FIX] payment: provide missing return_url in values
Render from payment//payment_acquirer.py promises:
All templates will receive:
    'feedback_url', 'return_url', 'cancel_url', 'error_url'
However they are all in -> FIXME.
After 6 years in FIXME, this promise is still a lie.

It is unfortunate since the Adyen payment provider requires 'return_url' to work.
Before, this function was called by _get_shop_payment_values,
which provided a value for it.
We copy the value that was given there directly as a default in render,
so that it doesn't crash no matter what method calls it.

opw 1928918
opw 1944142

closes odoo/odoo#31814

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-03-15 14:56:19 +00:00
Nicolas Lempereur d7ca0357f3 [FIX] point_of_sale: numpad left-to-right in arabic
A numpad in right-to-left language is not right-to-left.

So with this change we keep numbers in the order:

1 2 3
4 5 6
7 8 9

and not how it was currently with RTL support:

3 2 1
6 5 4
9 8 7

We used the directive `/*rtl:ignore*/` that prevent rtlcss to mirror a
rule but this also could have done with eg.

  .o_rtl .pos .numpad button { direction: right; }
  .o_rtl .pos .popup-numpad { direction: rtl; }

so when the reversed is reversed (only in rtl) we get back the original.

opw-1950001
closes #31888

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-03-15 16:44:27 +00:00
Nicolas Martinelli 547e6e37f4 [FIX] purchase: canceled bill in suggestion
- Install `account_cancel`
- Create a vendor bill for Partner A, cancel it
- Create a new vendor bill for A

The 'Auto-Complete' suggest a bill with an empty name, and only an
amount. It corresponds to the canceled bill.

On a canceled bill, the `number` field is empty, and consequently the
`name` is empty as well.

Whatever is the state of the bill, displaying a bill is useless is only
the amount is shown. Therefore, we make sure to only display the bills
with a number set.

opw-1950846

closes odoo/odoo#31863

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-15 09:32:34 +00:00
Romain Derie f8efc9a957 [FIX] website_sale: fix _get_pl_partner_order
1. Encapsulate `show_visible` to avoid duplicate same code in filtered and to
   make it more easy to read.
2. When GEOIP is enabled, `_get_pl_partner_order` would retrive the available
   pricelists for that country group.
   We should also ensure the returned pricelists are also available on that
   website
3. Rewrite the `country_code` condition in one line thanks to 1.
4. !! Do not use `property_product_pricelist` in the method as it is not cached
   and now it depends website. Anyway it was useless as it was a duplicate of
   `partner_pl`.
5. Add `is_public` to the if condition as it was actually implicit as if not
   public it and no pricelists it would go in previous condition and set the
   pricelist from `property_product_pricelist`.
6. The last if condition (`not country_code`) has always been subject to fixes
   and always broke a flow to fix another one (see 60300fc2 and e11908d42, both
   were wrong).
   This condition refactoring should still preserves the beavior fixes
   mentionned in both commits and fix the flow where a logged in user would not
   get selectable pricelists if he has a partner_pl (property_product_pricelist)
   before entering the all_pl filtered.

closes odoo/odoo#28301

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-14 10:28:02 +00:00
Romain Derie 9608d4551d [FIX] website_sale: prevent compute search to be run in sudo
Before this commit, when accessing an user's pricelist, it would raise a 500
error in multi-company environment.
Indeed, when doing `self.env.user.partner_id.property_product_pricelist`, even
if self.env is not un sudo mode, the compute from `property_product_pricelist`
is executed as sudo. Since this method is then doing a `search()`, it won't use
the multi-company pricelist ir.rule. It will return all the pricelist,
including the ones from other companies.
Then, when trying to read that pricelist, it will raise an access error.

Now, we correctly execute the compute (and so the search) in the user env, it
won't get pricelists from other companies.
2019-03-14 10:28:02 +00:00
Romain Derie a5a5a57e48 [FIX] website(_sale): allow to use and access website pricelist
Before this commit, if the website's company was different than the user
company, the ecommerce would use the user's company instead of its own
pricelists.

Step to reproduce:
  - Set company2 to website1
  - Create a pricelist1 for company1 and a pricelist2 for company2
  - With an user from company1, visit the website1.
  - The pricelist used will be the one from the user, pricelist1 and not the
    pricelist2 from company2 which is the website1 company.
2019-03-14 10:28:02 +00:00
Romain Derie 2d970942ba [FIX] website_sale: limit pricelist to it's website if set
Before this commit:
1. Non Public User would get the main company pricelist returned when calling
   `get_current_pricelist`. As this is saved in an `ir.property`
   (`property_product_pricelist`) that is not website dependant, that pricelist
   would always be returned on every website.
   This is a problem if that pricelist is website limited, you should not be
   able to use it on other websites.
2. Public User would not have a valid pricelist on other website than the
   default one. Indeed, every pricelists are restricted that default website.
   It would result in prices shown as "0" (without currency symbol) on the shop
3. Pricelists set as selectable without a website_id set would not be
   selectable
4. Public User would not get a fallback pricelist when reading its
   `property_product_pricelist`. Indeed, the public user's partner is not
   active and since the refactoring of this field compute method to be a multi,
   it would end up doing a search() instead of a browse(). Thus, it would find
   a pricelist for the public user but it would not set it.

This commit:
1. We override and check that pricelists returnes by the `ir.property` are
   indeed available on the current website.
2. Remove the website restriction on `Public Pricelist` so other websites have
   at least one pricelist available.
3. `pricelist_ids` on `website` now return all available pricelists including
   the ones that are generic (no website set)
4. We search for inactive partners too.

Part of this commit fixes part of 27861
Github-25109
2019-03-14 10:28:02 +00:00
Romain Derie 08a17b6883 [FIX] product, website_sale: clean dead code
The `_get_pl()` method introduced with bcb395616 was replaced by
`_get_pl_partner_order()` in afe1d20dac.
After that, it looks like this method was never called again.

Plus, add a missing ensure_one() (not critical).
2019-03-14 10:28:02 +00:00
Romain Derie 25a8b507b1 [FIX] website, website_sale: create utility method to check if frontend
Before this commit, at multiple places to check if we were in a frontend
context we would check if `request and hasattr(request, 'website')` and
then access `request.website`.

Now, we call an utility method to get that website if we are in a frontend
context. If not the method will return False.

This method will be usefull for incoming pricelist fixes & tests.
Indeed, we will have more check of that kind and this will be easier to mock as
mocking this method will be enough, instead of mocking every method doing that
if condition to simulate a frontend context (to do website tests in python
wihout having to go frontend with a tour).
2019-03-14 10:28:02 +00:00
Odoo Translation Bot 29423872b1 [I18N] Update translation terms from Transifex 2019-03-17 01:22:27 +01:00
Nans Lefebvre 411603f4e3 [FIX] fields: safe check on ondelete cascade
In the case of attachment_ids, comodel._fields[inverse] can be res_id,
an integer field. Such fields do not have a default ondelete attribute.

opw 1945926

closes odoo/odoo#31864

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-03-15 09:49:13 +00:00
Nicolas Martinelli 72bc566ad8 [FIX] sale_timesheet: project template
- Create 2 companies A & B
- Set the superuser in A
- Create a product P:
  Product Type: 'Service'
  Service Tracking: 'Create a task in a new project'
  Project Template: set one for both companies
- Switch to company B
- Create a SO with P, validate
- Access the project through the stat button 'Project(s) Overview'

An `AccessError` is raised.

In case no 'Project Template' has been set for company A, the project is
created without the specified template.

This is because the new project is created as `sudo`, and the
`project_template_id` field is a company-dependant field. Therefore, a
project template from company A is used to create a project in company
B.

opw-1953011

closes odoo/odoo#31883

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-03-15 14:11:04 +00:00
Jeremy Kersten a710a86993 [FIX] website_blog: fix layouting bs4 in view grid
courtesy of @Moto017

closes odoo/odoo#31870

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-15 10:10:34 +00:00