Commit Graph
133730 Commits
Author SHA1 Message Date
Damien Bouvy 541dc03f22 [FIX] pos_sale: sales team report without POS access rights
Steps to reproduce the bug:

- Give 'Administrator' rights for the Sales app and no rights for the Point of Sales app to the demo user
- Try to access CRM > Sales > Team Pipelines as Marc Demo

Bug:

Access Rights error on pos.session

opw:2184032

closes odoo/odoo#44637

X-original-commit: 77f0d6280e64074a3188dfb85d688ab758400128
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-02-05 10:17:03 +00:00
Victor FeyensandAntoine Vandevenne 6d0c8788e4 [REF] doc: views documentation rework
closes odoo/odoo#44530

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: Antoine Vandevenne (anv) <anv@odoo.com>
2020-02-05 14:00:39 +00:00
Victor Feyens 59a7738be2 [IMP] doc: orm page missing information + UI
* Some fields types were missing
* Add information on multi-record field access
* UI finetuning
2020-02-05 14:00:15 +00:00
Victor Feyens a53f42edf5 [IMP] doc: add information on group_expand field attribute 2020-02-05 14:00:01 +00:00
wan dfd01b8c5c [IMP] account: rework name sequences
Task 2146469

Rework the name computation:
* It doesn't use ir.sequence anymore
* It is an editable computed field
* Add a renaming tool

This allows the user to tweak the sequences more easily than having to
get through the ir.sequence settings.

The sequence depends on a parameter of the journal: continuous, montly
and yearly restart of the sequence. Everytime a new period is started,
try to make a pattern form another period.

The incrementing is done by taking the previous name, ordered
lexicographically, splitting it by taking the digits at the end, adding
1 and re contstruct with the prefix.

** This means there could be cases where the prefix has a big importance
on the next number. For instance, if you have
INVOICE/2019/0001
INVOICE/2019/0002
and then rename the last one to INV/2019/0002, don't expect the next
number to be INV/2019/0003. It will be INVOICE/2019/0002 (again) because
the highest number was INVOICE/2019/0001.
You will then end up with
INVOICE/2019/0001
INV/2019/0002
INVOICE/2019/0002

closes odoo/odoo#41485

Related: odoo/enterprise#7189
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-02-05 13:59:43 +00:00
Jigar Vaghela a6d7c7b04a [IMP] l10n_latam_invoice_document: remove non use context from view
pass move type to journal for filtration but it is removed by this commit https://github.com/odoo/odoo/commit/a9b762870651e607b244d8fd5681a9f3557cc0e9#diff-59b30a3c3997659843dcc916225f508a so no more in use

closes odoo/odoo#44636

X-original-commit: 06bcfa8f946485ca2979511144bc5f22a3ca118c
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-02-05 10:12:03 +00:00
qsm-odoo 6f4c60fe1b [FIX] website, *: lazy load widget assets of the correct website
*: web

Before this commit, when a widget declared assets to lazy load through
the assetLibs key, the asset was loaded through a context-less call to
the server through the base `rpc` function. This caused problems in
website: the website ID was not given to the called route and the loaded
assets were then stripped of their specific-website parts.

This commit solves the problem by allowing the `loadLibs` and
`loadAsset` functions to receive an extra argument: an extra `context`
to use for the actual call to the server. The method is now available
in the ajax service, so that website can add its custom context
automatically, the same way it does it for normal `_rpc` calls.

Part of https://github.com/odoo/odoo/pull/44596

closes odoo/odoo#44596

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-05 10:48:44 +00:00
qsm-odoo d04ca05b2e [FIX] web, *: add lazy loaded libs in the test assets
*: partner_autocomplete

Those cannot be properly lazy loaded by test widgets, so they are loaded
directly through test assets. Testing lazy loading should be part of
a dedicated test system.

Part of https://github.com/odoo/odoo/pull/44596
2020-02-05 10:48:38 +00:00
Alexandre Kühn cdc5ad3230 [FIX] mail: fix concurrent rendering thread with message fadeout
Follow up on 4f5334a081

Before this commit, thread was not re-rendered correctly in Discuss
App when user clicked on "Mark as Read" from Inbox and then changed
conversation in a narrow time frame.

This issue was discovered from a test that failed undeterministically
on rare occasions (once every hundreds of builds on Runbot):

```
QUnit test failed: "mail > Discuss > all messages in "Inbox" in "History" after marked all as read"
[message: "there should be 30 messages in History", actual: "0", expected: "30"]
```

This test crashed due to the rendering of Inbox after message fadeout
animation that overwrote the rendering of History. As a result,
thread widget indefinitely displays Inbox content, which is empty.
The HTML content of Discuss during the crash shows that breadcrumb
and discuss sidebar correctly have "History" as the active thread,
but thread widget still shows "Inbox" as content:
http://runbot.odoo.com/runbot/build/1092504

This commit fixes the issue by re-rendering of the thread with
message fadeout animation only if the active thread has not changed.

closes odoo/odoo#44585

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-02-04 12:05:56 +00:00
Jason Van Malder 34b091fc93 [FIX] rating: delete rating & message when deleting rating
Issue

    - Install eLearning
    - Delete a rating
    - Go to the course page, review tab

    Only the stars disappeared.

Cause

    Review = rating + message, the rating is the stars and
             publisher_comment

    So this is normal if the review is not completely deleted

Solution

    Seen with SBU and he said that the message should be deleted
    too.

OPW-2181568

closes odoo/odoo#44529

X-original-commit: 1f41c7ae9de061ec861a3a3db9c403510861cc76
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-05 07:00:53 +00:00
oco-odoo 31e1322b40 [IMP] account: don't always allow modifying the decimal places of a currency
If accounting entries have already been generated by this currency, we now forbid setting it a lesser number of decimal places (so, higher rounding factor). We also display a warning when increasing the number of decimal places, to make sure the user is aware of the impact it'll have.

closes odoo/odoo#42017

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-02-05 11:53:45 +00:00
mgh-odoo 4da64b3f3c [IMP] mail: email channels duplicated notifications
This commit prevents sending a notification within Odoo when a
message is posted from a mailing channel to a user whose notification
management preference is set to "Handle by Emails".

Task-ID 2033302

closes odoo/odoo#36000

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-02-05 09:59:52 +00:00
Odoo's Mergebot 474643b1c1 [MERGE] base: use ir.model.access on TransientModels
Before this commit, models with the `_transient` flag were ignored in
ir.model.access verifications. Only an implicit ir.rule with the
domain (create_uid=user.id) was applied to avoid most side effects.

The problem is that, often, the security does not lie in side-effects
of abusing of somebody else's wizard record but in the fact that the
wizard methods blindly trust only the right users are creating these
records. Too often, too many sudo were used and creating wizard with
chosen values could lead to an abuse scenario.

Instead, explicitly require the developer to declare security rules
the same way as on any other model.

closes odoo/odoo#43306

Task-id: 1863044
Pad: https://pad.odoo.com/p/r.c1befa51103ed3b955a427971eb19719
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-05 13:12:46 +01:00
Nicolas Martinelli ec2b5b4bc7 [FIX] account: do not subscribe commercial partner
- Create a partner which is a company
- Add a contact
- Create an invoice for the contact, post it

Both the contact and the company are set as followers of the invoice.

Only the contact should be, there is no reason to make the company
follower too.

opw-2179084

closes odoo/odoo#44624

X-original-commit: daedd9eb402e5dd3c6a700a93ee58022266ec95b
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-05 08:30:03 +00:00
Martin Trigaux 65530dfd6a [ADD] *: add ir.model.access on all transient models
Following changes needing ir.model.access on transient models too.
Remove groups declaration on the action to move it to ir.model.access
when possible.
Rules are strict by default with no unlink access by default and high
priviledge asked. Adaptations may be needed later.
Write access is given as a wizard may need to be modified in case the
action triggers an error and the user has to correct a value

account*: use account.group_account_user for all transient by default
	  remove account.print.journal relic
stock*: use stock.group_stock_user by default
survey: survey user can send invitations
mail: allow any employee to execute wizards
      additional verifications are made to ensure they are executed
      only on the documents the user has access to you
      give portal access to mail.compose.message as portal still does
      some actions like posting messages on the forum
      add ir.rule to avoid reading somebody else messages
      increase the query count because of undeterminist count
crm: saleman for lead2opp, manager for massmailing
     partner manager for actions linked to partners
     avoid a write in test_lead_lost
sms: any employee can send sms
mrp: mrp user can execute wizards
     give unlink access as making write during do_produce operation
base_import: employees can import files
delivery: stock user can deliver
event_sale: sale user can configure the wizards
	    event user inherit from  sale rights
gamification: employee can give badge
google_service: resolve FIXME
hr: add specific rights
    manager can set a plan according to group on button
    anyone who can write on an employee can register a departure
hr_expense: set rights based on buttons
hr_holidays: an approver can make a summary report
hr_recruitment: recruiter can refuse a candidate
hr_timesheet: can use the wizard if can create a timesheet
l10n_eu_service: managers can create fiscal positions
mass_mailing: same group as on mass.mailing.list
membership: accountant can create invoice from membership
payment: accountant can create a link
	 as the source is an account.move
	 keep the payment.acquirer.onboarding.wizard to system user
	 only as it is called during company configuration
point_of_sale: PoS manager only can use wizards
	       never create closing_balance_confirm_wizard records
product_expiry: stock user has rights on stock.picking
product_margin: access from accounting menus
repair: same rules as for above models
sale: set ir.rule for self wizard only
      add rule from model introduced in payment to add salesman group
sale_crm: saleman can create a quotation from a lead
sale_coupon: any saleman can generate coupon
	     add self ir.rule
sale_product_configurator: salesman can select product variants
snailmail: employee can send letters
website: designers can write on website
website_crm_partner_assign: same rule as group on action
website_sale: sale ACL as for payment.acquirer.onboarding.wizard
website_slides: anyone can send invitation

base: base.language.*: allow employee (cf lang_install)
      change.password.user: can not read change password wizard of
      other users
      test.*: no access is needed

Courtesy of Damien Bouvy, William Andre and Antoine Prieëls for review
of acl
2020-02-04 17:54:18 +01:00
Martin Trigaux c6f24da3f2 [IMP] base: do not load actions when can not read target models
As neither fields_view_get, nor default_get actually verify you have
access to a specific model (this is likely to be changed in the
future), it was possible to execute an action to a model, even if the
user does not have access to the corresponding model.
Before this commit, launching an action to a wizard with no access was
opening a new record view with all fields in readonly and clicking on
any button raised an access error.

To avoid the frustrating of seeing an action but getting an unusable
screen when clicking on it, just hide the action in the first place.
2020-02-04 17:53:48 +01:00
Martin Trigaux 6d8688bb12 [IMP] base: use ir.model.access on transient models
Before this commit models with the `_transient` flag were ignored in
ir.model.access verifications. Only an implicit ir.rule with the
domain (create_uid=user.id) was applied to avoid most side effects.

The problem is that, often, the security does not lie in side-effects
of abusing of somebody else's wizard record but in the fact that the
wizard methods blindly trust only the right users are creating these
records. Too often, too many sudo were used and creating wizard with
chosen values could lead to an abuse scenario.

Instead, explicitly require the developer to declare security rules
the same way as on any other model.
2020-02-04 17:53:48 +01:00
Laurent Smet f71bc8ca5d [FIX] account: Set the commercial partner on journal items from payments
Since you can only reconcile entries from the same partner, you must always use
the commercial partner when creating some journal items.

closes odoo/odoo#44614

X-original-commit: 1ba501d18bc151eb8c5f04fcd23a87d46690010e
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-02-04 16:36:57 +00:00
qsm-odoo eccf6ed458 [FIX] website_links: properly attach graph widgets to the hierarchy
Simple `this` instead of `self` mistake which prevents the widgets to
trigger up events.

closes odoo/odoo#44617

X-original-commit: 033ad6680794e037566720f35b0285e18f3d2130
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-04 17:09:32 +00:00
Pierre Masereel 56f2a70346 [FIX] point_of_sale: flush order timeout
When an order is synchronized to the server, there is a timeout of 7.5
seconds that is left before considering that the order has not been
synchronized, and should be re-syncronised.

Since syncronization of order in pos_restaurant have been made, there
are more operations than before that are performed, and the
synchronization of an order can take more than that.

The validation of a picking can also take a lot of time, almost when
products are kits and compose of multiple products.

The problem, is that if it takes more than 7.5, the same order will be
pushed again to the server, even if the previous sychro still running,
which will lead to wait the previous request that has the lok on the
same records, all this blocked request can lead to block all workers of
the server because all requests are trying to modify same objects.

So we've increased the timout for flushed orders.

closes odoo/odoo#44615

X-original-commit: 9452c3f873c86a4c8502695720be942a76d4d25d
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-02-04 16:39:13 +00:00
Yannick Tivisse d2c8be3220 [FIX] mail: Harmonize _mail_find_partner_from_emails returned values
Purpose
=======

Before this commit, the method _mail_find_partner_from_emails could
return a list mixing partner ids and partner recordset, that could
lead to issue when trying to read the different elements.

With this commit, we ensure that we return a list of records only.

closes odoo/odoo#44608

X-original-commit: 2fbbbd8609fd2e08545ddb1ab8e2d7d22ee4d292
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-04 15:50:56 +00:00
Sébastien Theys ce7cc63b58 [FIX] website_sale: prevent issue with test shop_list_view_b2c
It very rarely happens that the test is failing due to the following error:

`Tour shop_list_view_b2c failed at step
.oe_product_cart .oe_currency_value:contains("825.00")`

The value found in that case is 750 instead of 825, which indicates that the b2c
setting was not correctly activated.

To exclude the RPC themselves from the equation, it is decided here to move the
setting change directly in the Python.

closes odoo/odoo#44599

X-original-commit: 735807cefb7ccf3232f7492b825ce8c42bacbed4
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-02-04 14:04:45 +00:00
Odoo's Mergebot 06d22deb59 [FIX] *: leftover deprecation warnings
@Julien00859 already made a pass on this at some point but there's a bunch of warnings either dynamic or from not the stdlib left over.

Some of them can't really be fixed in-code and have been explicitly ignored instead:

* `setuptools` uses the deprecated `imp` module until v41.6.0
* `zeep` uses defusedxml.lxml which was never intended to be a public / production API, not sure what to do there (cf  mvantellingen/python-zeep#956)
* there are a ton of invalid escapes in non-raw string literals, they're unlikely to ever be relevant so ignore them

closes odoo/odoo#44164

Related: odoo/enterprise#8130
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-02-04 16:21:10 +01:00
Xavier Morel b1e58ab6c6 [FIX] product: deprecation warning triggered by assertion
Replace an assertRaises(StopIteration) by a next() with a default
value.

Following PEP 479, *any* StopIteration reaching the toplevel of a
generator triggers a DeprecationWarning. And while the assertRaises
looks innocuous, both _assertRaises and the underlying
clear_upon_failure are implemented with functools.contextmanager,
which wraps a generator.

As a result, exceptions raised in the assertRaises "body" get
reinjected inside the wrapped context manager[0] and if the exception
is a StopIteration it triggers the warning.

By not using assertRaises we side-step the issue.

[0] https://github.com/python/cpython/blob/b6999e5690c7006b0ba4049cfd638513c982a90c/Lib/contextlib.py#L131
2020-02-04 12:42:35 +00:00
Xavier Morel 672709c125 [FIX] core, base: CryptContext.encrypt is deprecated
However encrypt was marked as deprecated in the same version hash
was added, so we need a conditional check to support <= 1.6.
2020-02-04 12:42:35 +00:00
Xavier Morel de590816d8 [FIX] *: deprecated access to url_ utilities through werkzeug root
In 0.15 accessing werkzeug.urls functions directly through werkzeug
is deprecated, the shortcut will be removed in the eventual werkzeug
1.0.

Fix existing uses of these shortcuts. Also cleanup some imports when
they're not far from a werkzeug* import being altered.
2020-02-04 12:42:35 +00:00
Xavier Morel eae19fc2cd [FIX] core: int() deprecation warning
__int__ should always return an integer, not a bool and not a
completely unrelated type either.
2020-02-04 12:42:35 +00:00
Xavier Morel 7ad955d5b1 [FIX] test_documentation_examples: deprecation warning
assertDictContainsSubset has been deprecated since 3.2 and is not
documented anymore, apparently because the order of its parameters is
less than obvious.

Consequently, remove the call to said dict & replace it with
assertions on item sets.

Note: the odd formatting is because these bits are literal-include-ed
in the documentation as sub-slices (just the relevant code lines), so
ideally they shouldn't be moved around and no additional content
should be added to those specific lines.
2020-02-04 12:42:35 +00:00
Xavier Morel 3bdf930743 [FIX] core: remove import of deprecated imp module
Was already not used, it's just that the import was not
removed. Remove a bunch of other unused imports while at it.
2020-02-04 12:42:35 +00:00
Xavier Morel fab1183907 [IMP] enable deprecation warnings 2020-02-04 12:42:35 +00:00
jbw 7b5664660f [IMP] hr_expense enable attachment preview in journal view
Adding preview of expenses attachment to journal view.

When creating an expense, files can be attached (e.g. scanned receipts).
Those attachment files where not displayed in "Accounting > Accounting > Journals > Purchases" move_line list.
They now appear in the document preview.

Task = 2176443

closes odoo/odoo#44161

Related: odoo/enterprise#8002
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-02-03 15:35:08 +00:00
Cedric Snauwaert 80c67aa26f [FIX] account: outstanding credit widget should be displayed in state in_payment
closes odoo/odoo#44595

Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2020-02-04 13:35:34 +00:00
Xavier-Do 9c26d4d870 [IMP] core: rename upgrades-paths to upgrade-path
Since this option is soon to be used, this rename is a last tweek
to make it more logical to use since it will point to a single
upgrade dir most of the time.

closes odoo/odoo#44593

X-original-commit: 1c8e2809fb296abce6114b7da906d48a240df418
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-02-04 13:19:02 +00:00
Olivier Dony 39018e7515 [FIX] base_setup: show demo data button only in debug mode
During the port to 13.0 and the new Settings dashboard,
the "Load demo data" button visibility condition was reversed.

Cfr #34290 or https://github.com/odoo/odoo/pull/34290/files#diff-e5df7b873d03867c9527da957b762802L131

closes odoo/odoo#44587

X-original-commit: 61b7d53731623db42896f61a4c2772761d7892de
Signed-off-by: Christophe Simonis <chs@odoo.com>
2020-02-04 12:27:09 +00:00
Odoo's Mergebot fdba9a878f [IMP] website_blog: improve onboarding
The creation of a new blog post is noisy.
The user is disturbed with colors (purple box, blue borders, etc).

task-2144335

closes odoo/odoo#43692

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-02-04 15:20:19 +01:00
Romain Derie 2b0e88a6f0 [IMP] website: allow user to change cover color
Before this commit, the covers from event & blog, which shares the same
template, would be set a fixed bg-primary color which couldn't be
changed.

This commit adds the possibility to change that bg color.

task-2144335
2020-02-04 13:06:08 +00:00
Romain Derie 4eb2aeb8e7 [IMP] website: make cover_properties a mixin field
Next commit will add new cover properties entries for the bg color.
Still, we want a default `bg-primary` class. Instead of addind 3 new default
value in existing cover_property fields, the chance is taken to make a mixin
out of that field to avoid code duplication.

task-2144335
2020-02-04 13:06:08 +00:00
Katherine Zaoral d0cbd2a06d [FIX] account: be able to found the proper transfer account
Properly set the transfer account in the company taking account the accounts defined in th company domain.  We found this error because in l10n_ar module we have 3 chart of accounts based on the company AFIP responsability which actually have same transfer_account_code_prefix. For that reason it was setting a transfer account to the company which is not belongs to the current company.

closes odoo/odoo#44586

X-original-commit: d38228836b8944740f04ca355c997c4b6a346e48
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-02-04 12:25:39 +00:00
Debauche Stéphane e4e84196f6 [FIX] im_livechat: add missing dependency to livechat widget
Bug
===
A dependecy is missing "lazyloader.js"

Task #2118959
opw-2188615

closes odoo/odoo#44577

X-original-commit: ea787bec2631e7d26c7011a88395d29126859c38
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-04 11:32:02 +00:00
aab-odoo 7de76891c1 [FIX] stock: already defined test module
When there are two modules with the same name, an error is thrown
and only one of them is executed.

closes odoo/odoo#44573

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-02-04 11:27:24 +00:00
Romain Derie 8fc61fd2b4 [REM] website(_blog/_event): remove filtercolor option on cover
task-2144335
2020-02-04 10:59:22 +00:00
Jeremy Kersten 537644ec3e [IMP] website_blog: activate cover snippet on edit mode enter
As this is the first thing you want to do when creating a blog, it will ease
the onboarding.

task-2144335
2020-02-04 10:59:22 +00:00
Swapnesh Shah 5706ff62df [FIX] account: Set newly created template
Before this commit, Creating New Template from "Send Invoice" wizard doesn't update template_id on the Wizard.

In this commit, We write newly created template_id on the wizard.

closes odoo/odoo#44561

X-original-commit: 454e6ed9d956ac131d6476c95e59b2ab390df5b6
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-02-04 09:55:06 +00:00
Swapnesh Shah c3151daea7 [FIX] account: Use current date as fallback to convert currency
Fixes #43705
Before this commit, There will be tracback on converting currecy if there is not date on tax line.

Now we use current date to as fallback to convert currency.

closes odoo/odoo#44559

X-original-commit: 2b88d71c6e4815334f0edaa24d6041c5facd811e
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-02-04 09:41:30 +00:00
Martin Trigaux d11ee78019 [IMP] bus: unescape notification message
The title of notification is the author name escaped (for security
reasons).

   if (message.hasAuthor()) {
       title = _.escape(message.getAuthorName());
   }

When forwarded to the system notification, it does not need to be
escaped though, as the system notification is not HTML based.

Without this patch, a user named "Bob's friend" sending a message was
creating a notification with the title "Bob&#x27;s friend"

Unescaping the notification body just in case but the HTML of the body
in a mail.messages should be stripped by _notifyIncomingMessage.
Unescaping will just ignored unescaped characters and should do
nothing on messages not escaped.

Fixes odoo/odoo#24846

closes odoo/odoo#44550

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-04 10:33:19 +00:00
Odoo's Mergebot d64bf7e6cd [MERGE] web_studio: model configurator
Improvements for custom models and some default behaviours
linked to the Studio model configurator (Enterprise task).

In a nutshell:
- mark the default `x_name` field of a custom model as 'to be copied'
- improvement for kanban views that makes it easier to user with
  custom models

The interesting part is in the Enterprise `web_studio` module.

Task 2091654
Enterprise PR: odoo/enterprise#7326

closes odoo/odoo#42055

Related: odoo/enterprise#7326
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-02-04 13:16:40 +01:00
Damien Bouvy c2fccc9118 [IMP] base: make name of custom models copied by default
Copying a custom model's record seems pointless by default, since
no field is actually copied.

It makes sense to copy at least the `x_name` field, to make it clear
to the user that the system understood it was duplicating something
and not just creating something entirely new.
2020-02-04 10:46:41 +00:00
Damien Bouvy 18e06fa90a [IMP] web: kanban content container
The 'new' (read: the classes not in the 'compatibility layer section')
classes of the kanban views did not allow to cleanly separate an image
header from a content container.

This commit adds such a container, allowing a very simple layout that
should work all the time for a typical 'card with left image and right
content layout':
```xml
<div class="o_kanban_record oe_kanban_global_click o_kanban_record_has_image_fill">
  <field class="o_kanban_image_fill_left" name="image_128"
         widget="image"
         options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
  <div class="o_kanban_record_details">
    <div class="o_kanban_record_top">
      <div class="o_kanban_record_headings">
        <strong class="o_kanban_record_title">
          <field name="x_name"/>
        </strong>
      </div>
    </div>
    <div class="o_kanban_record_body">
      <!-- some fields here (e.g. tags,...) -->
    </div>
    <div class="o_kanban_record_bottom">
      <div class="oe_kanban_bottom_left">
        <!-- some fields here (e.g. kanban status,...) -->
      </div>
      <div class="oe_kanban_bottom_right">
        <!-- some fields here (e.g. user image,...)-->
      </div>
    </div>
  </div>
</div>
```

Before this commit, the absence of a container for the right side meant
that the top/body/bottom were flex-growed in a flex-direction: row
element, appearing as 3 columns instead of rows.
2020-02-04 10:46:40 +00:00
Damien Bouvy ea4c934728 [IMP] web: allow background-style images for custom models
The `FieldBinaryImage` assumes that the image mixin is used to manage
its fields - this is mostly true, until you use custom fields.

This commit makes using the 'background' option of the Image widget
possible by fallbacking the thumbnail field's name to the name of
the field itself instead of `image_128` when we're dealing with a custom
field.
2020-02-04 10:46:40 +00:00
Nicolas Martinelli 411dd85a80 [FIX] purchase: vendor reference
- Create a product A
  MTO, Buy
  Add a supplier S1 and set a specific reference
- Create a product B
  MTO, Buy
  Add a supplier S2 and set a specific reference
- Create a SO with A & B, confirm
- 2 RFQ are created

The first RFQ is created with the correct reference, but not the second
one.

This is because `display_name` depends on context keys: it is computed
once for both products with `partner_id` set as `S1`, while it should be
recomputed for product B with `partner_id` set as `S2`.

In order to avoid this, we use `with_prefetch()` to avoid reusing the
prefetched value.

opw-2176638

closes odoo/odoo#44564

X-original-commit: d96c1910be8f242455de9b443fc9db82155b4dd1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-04 10:09:27 +00:00