Commit Graph
3342 Commits
Author SHA1 Message Date
Adrien Dieudonne 464968de36 [FIX] account, hr_expense: amounts on multiple lines in the dashboard
Before this commit, the amount currency could be wrapped on a
second line (on mobile).

To fix this, we had to find a way to have more space:
- Buttons are now displayed at the top (mobile only).
- Amounts can grow (col-auto) and the other column will take the
  space left (col) and add "..." when there is not enough space.
  (mobile + desktop)

We also had to remove a button from a div tag in order to display
the buttons next to each other on mobile (buttons are "inline-block"
but div is a "block").
The main flow tour has been adapted accordingly and the typo has
been fixed too...

closes odoo/odoo#46680

Task-id: 2184243
X-original-commit: 159e3d4cb8a301c908f7718a56138528033e75d4
Related: odoo/enterprise#8963
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-03-03 08:09:49 +00:00
Lucas Perais (lpe) 9ce6136be7 [FIX] web, base: make company-specific report assets static
Before this commit, the company specific colors and font were
implemented by systematically overwriting a "virtual" report SCSS
asset file before rendering each report.
This caused many issues, forced frequent asset bundles recomputations
(performance problem + cache invalidation causing random bugs).
And it could simply not work in a multi-company setup where multiple
styles are involved, as the asset management could be made not
thread-safe.

PR #44225 was a first attempt to mitigate the numerous problems by
making the asset bundle invalidation less frequent. But the problems
were still present and a more complete solution was necessary for
multi-company setups.

Besides, the design of the bundle forbade making company specific assets.

This commit uses a different approach: instead of having a
company-specific asset that needs to be constantly updated, a global
"multi-company" asset is maintained and included in the report assets.
It only needs to be generated when a company style changes, not for
every rendering operation.

Unfortunately this change cannot be fully performed without updating the
template declarations, so it will require an update of the `web` (or
`base`) module to be operational.

As this represents a rather invasive change in a stable branch, extensive
testing was conducted to minimize the effects and ensure proper
degradation of features for production deployments where the new code
would be deployed without forcing an update of the `web` module:
- The report SCSS files were left untouched, to prevent any bundle
  invalidation, ensuring that old cached assets would remain valid. This
  means that single-company setups should not see any visible difference
  after pulling the code (with or without updating `web`).
  SCSS cleanup will be done later.
- Existing Python methods were kept but emptied, to make sure that
  old templates and code would not crash.
- For multi-companies, the last used colors will be applied for all
  reports until the `web` module is updated. The old behavior was not
  working correctly anyways, so the degradation is actually limited.
- For all setups, changing the colors after deploying this patch will
  have no effect unless the `web` module is updated.

/UPDATED FOR master on top of #44393/:
- removed the `res_company.update_scss()` method entirely
- fixed the report SCSS styles, as the variable names referred to the old
  behavior, e.g. "$o-company-primary-color" is nonsense.
  Renamed to "$o-default-report-primary-color" etc.

--
Improves #44225
Forward of #44393

opw-2168623
opw-2171040

closes odoo/odoo#46647

X-original-commit: a5b1421aecf27b1de408434d3bb6d7ac81f57dc3
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-03-02 13:22:09 +00:00
Nisha patel 159699b09c [IMP] various: set boolean_toggle on 'active' fields in form view
Currently, to activate/deactivate records with the 'active' checkbox
user has to switch to edit mode of the form.
So the purpose of the task is to allow the user to activate/deactivate
records from the readonly mode of the form view.

In this commit, we  set widget='boolean_toggle' on the 'active' field in form
view.

closes odoo/odoo#46567

Taskid: 2206794
Related: https://github.com/odoo/enterprise/pull/8918
Related: odoo/enterprise#8918
Closes: #46567
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-02 06:26:02 +00:00
fw-bot 1d135ffc06 [FW][FIX] base: No company_id on new res.partner
When a user is created, its partner_id shall not have any company_id.

A test has been added to check that in 'base/test'.

Update test_mail tests by setting a company to partner_id linked to users
as now, by default the partner linked to a new user has no company_id.

closes odoo/odoo#46515

Task: 2198688
Forward-port-of: #45900
X-original-commit: 187b12fc5715721efdd9af283e086dfc3f856fc2
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-28 09:19:19 +00:00
qsm-odoo b6553afeac [FIX] base: properly alert the user of bundle compilation errors
Since we now use native promises, the code in charge of alerting the
user of bundle compilation errors was opening both an alert and a
dialog (fwp of https://github.com/odoo/odoo/pull/46437).

In 13.0, the mention fwp is not enough. On the website, the JS is also
lazy loaded now so we need to wait for that lazy loading before being
able to open a modal.

The whole alerting code should be improved to not be defined in python.

Fixes https://github.com/odoo/odoo/issues/45447

closes odoo/odoo#46482

X-original-commit: d5a2469b1edd0d22b366b44086d08c6f0b2247b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-27 19:33:01 +00:00
Hardik Prajapati ad5038ac74 [FIX] base: fix various issue of the contacts form view
In address block there is extra space between label and field
so added class o_td_label with o_form_label in span tag

Wrong hover title on create company button when company_name is set
so direct use icon attrs instead of span

closes odoo/odoo#44695

Taskid: 2182637
Closes: #44695
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-27 05:55:39 +00:00
Victor Feyens b174428344 [REF] base: remove unused dead action(s)
PURPOSE

Clean dead actions.

SPECIFICATIONS

Some ir.actions.act_window are not used in odoo codebase anymore

  * not linked to a given menu;
  * not referenced in the code;

LINKS

Task ID 2188942 (original)
Task ID 2196183 (Social/Marketing specific)
Community PR odoo/odoo#46435
Enterprise PR odoo/enterprise#8846
2020-02-27 13:09:52 +00:00
Sébastien TheysandRaphael Collet 5d62e4954f [FIX] core: fix _flush_search() when _order depends on m2o
closes odoo/odoo#46365

X-original-commit: 604b6a22db8eddfb37f9be31d3826394e25bd86c
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2020-02-26 17:56:32 +00:00
Raphael Collet 687793adca [IMP] core: do not warn about crappy upgrades in test modules
This allows modifications of models of test modules in stable versions.

closes odoo/odoo#46329

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-26 12:16:22 +00:00
Yoshi Tashiro 06d842d31f [IMP] base: use unnaccent Japanese prefectures
Very few people in Japan know how to type accented characters, which
brings a usability issue when the Japanese prefectures are defined
with accented characters.

closes odoo/odoo#46258

X-original-commit: db4ea065fee3e0344a65d2386799ffa6e7e47abc
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-25 14:16:20 +00:00
Sébastien Theys 6bb0963b6a [IMP] core: optimize read() by avoiding useless query
When the `select` returns nothing more than ids that are already known, there is
no need to make it at all.

This removes one query from `_read` every time it has to fetch only fields that
are stored in a different table (o2m, ...), which happens all the time when
reading a stored field first (triggering prefetch) and then reading a o2m.

The query that is now removed was used to check access rules, but the trick is
to use `check_access_rule` to verify the rules in python instead.

Part of task-2061122

closes odoo/odoo#36263

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-02-25 13:46:10 +00:00
Lucas Perais (lpe) 9256492f10 [FIX] qweb2: ignore comments between branching directives
Have a template of that form:
```xml
<t t-if=""/>
<!-- Comment -->
<t t-elif=""/>
```

Before this commit, both python and JS crashed because any type of node
between branching directive was forbidden

After this commit, Comments are just ignored and removed, while actual
template nodes are still forbidden between branching directives
There is no crash anymore

closes odoo/odoo#45899

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-02-24 15:32:19 +00:00
Toufik Ben Jaa 1744878573 [FIX] base: access rights issue on users form
- The form view on `res.users` displays information about
    how many record rules, ACL and groups are applied to the users.

    In some cases the current users may not have the required
    access rights to compute those values.
    To fix this issue, the computed fields are now computed
    in `compute_sudo` mode

closes odoo/odoo#46149

X-original-commit: 653f81f49ba4d92648eb04209cdbe73894dfac08
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-02-24 16:39:26 +00:00
Raphael Collet dfab454732 [IMP] fields: inherited field on new record are set on parent records
This makes the behavior of `onchange()` consistent in the case of
inherited models (with `_inherits`).

closes odoo/odoo#45910

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-24 15:52:32 +00:00
Swapnesh Shah 8c64021512 [IMP] base: add group by object on Access Rights
Create the same group by as available on ir.model.access

closes odoo/odoo#44677

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-24 08:18:35 +00:00
alt-odoo 8f70f203d0 [FIX] base: merge user contacts without company
If some contacts are linked to a user, we keep the company consistent
but we should do it only if a company is set on the destination partner.

opw-2199352

closes odoo/odoo#46000

X-original-commit: 3f9cb47cb6fdc240a58f3daa3bd4cf32f55cb084
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-21 21:06:03 +00:00
Romain Estievenart e0231481d6 [FIX] base,hr,web: kanban image sizing/look & feel
The image illustrating some kanban cards (like "Employees" or
"Contacts") has a weird scaling and rendering on smaller screen sizes.

Step to reproduce (on small screen):
1. Open Employee
2. Apply a filter
3. Picture is ugly (shape changes to get something pretty weird)

This commit fixes it by:
1. removing the rounding which was only applied (sic) on smaller screens
2. adjusting the size and/or the margins of the image to keep its ratio
   and the alignment with the other kanban cards.

Task ID: 2198419

closes odoo/odoo#45956

X-original-commit: dd5db84464998b45d0524055f9c96bcad894c4c9
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-02-21 14:28:04 +00:00
574d7f0d4c [IMP] core: import-compatible export of m2m fields
When performing an import-compatible export, m2m values would be
exported as a record per cell unless the `id` subfield was the first
to be exported. Which is not the case when using the export UI (as it
always adds the field itself before any subfield). This would make the
m2m not actually export-compatible in most cases.

* export m2m "display name" in an import compatible format as well
* re-prioritise exporting xids when there are multiple m2m exports in
  import-compatible mode
* never fall back on the o2m / non-import-compatible m2m path for m2ms
  in import-compatible mode

Note: if multiple m2m fields are specified only one of them gets filled.

Task 2065428

closes odoo/odoo#37407

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Ravi Singh <ras@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
2020-02-21 12:12:19 +00:00
Adrien Dieudonne 62c9227fda [FIX] web: document layout configuration: style not scoped
Commit 9a482fc introduced change for the document layout preview:
all "td" tag included in clearfix were in display: flex;
Because of this some styles were broken in form views on mobile.

We could have only put this rule in the right scope but
we preferred to fix this correctly.

Steps to reproduce:
- Go to Settings
- General Settings
- Click on Configure Document Layout

Related to task-ID: 2184243

closes odoo/odoo#45830

X-original-commit: 0206ee8f8a3652ae0eeb5aa78a94b92bd6e84921
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-02-20 14:47:04 +00:00
Victor Feyens 5ccdc1540d [IMP] base: no use of default AND compute for non stored fields. 2020-02-20 14:51:13 +00:00
Raphael Collet 60b0f6da34 [FIX] core: avoid invalidation of field 'ir.ui.view.arch' when setting it
This fixes the following issue.  Set the field `arch` on a view; this
automatically writes on `arch_db`, which is a translated field.  If some
translations are discarded, a call to `unlink()` invalidates the whole
cache.  And then things go wrong: when `arch_db` is validated, the field
`arch` is missing from cache, and the ORM sets it to `None` because the
field is still protected by the initial write!

Fix the issue by avoiding the call to `unlink()`, and do it in SQL
instead.

closes odoo/odoo#45740

X-original-commit: e7679152ee480a51ef2b6d208ae7a05b2ef61941
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-19 17:42:16 +00:00
Swapnesh Shah f69fa0af63 [FIX] base: paperformat_id is required on settings
Not setting a value for paperformat_id on 'Company Document Layout'
will also make paperformat_id False on the company but it is required
in the settings.

Without this commit, you can get in the weird situation of being able
to set a value on the document layout but having an error in the
general settings as a required field is missing.

Apply the same logic as in the other views

closes odoo/odoo#45527

X-original-commit: e518063e48936a3f8f9f921950cdae209e67ab47
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-17 15:07:15 +00:00
Raphael Collet 84723d4278 [IMP] core: add warning when removing field on upgrade
The purpose is to force developers to explicitly manage the removal of
field via migration scripts.

closes odoo/odoo#45269

Related: odoo/upgrade#777
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-13 16:21:48 +00:00
Martin Trigaux 0cc8610923 [I18N] export saas-12.3 source terms
closes odoo/odoo#45285

X-original-commit: bb281e98f52a2716f00d43a07446a08df698c1dd
Related: odoo/enterprise#8413
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-13 11:45:39 +00:00
Debauche Stéphane 3b2b2ef9d8 [IMP] base: improve state creation usability
Purpose
=======
Improve the state creation flow.
Some users created states by mistake, we want to avoid this situation.

Specifications
==============
Do not allow to create country from the partner form view.

Disable the quick create of the state in the partner form view.

When we create a state from the partner form view, set by default the
country of the state to the country of the partner.

Task 2178289

closes odoo/odoo#44291

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-12 08:14:45 +00:00
Adrian Torres 9b0e976b9f [IMP] base: raise warning if no field in search view
Before this commit, it was possible (and common) to create search views
without fields and only filters, the consequence was that a search for
that particular search view was not possible. (See
https://github.com/odoo/enterprise/pull/7852)

With this commit, a warning is raised if no field is defined within a
search view, preventing these "common mistakes" from happening again.

closes odoo/odoo#45058

Task-id: 2179521
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-12 13:44:07 +00:00
Raphael Collet eb08ac11ff [FIX] base: missing flush() before setting up registry
Custom models and fields set up the registry as part of their CRUD.
Make sure to flush() before setting up the registry, in order to avoid
neverending recomputations (as fixed by the former commit).

closes odoo/odoo#45163

X-original-commit: af6dbb5c7c165dcf37bf87ee76c0170795ecb574
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-02-12 10:16:12 +00:00
Victor Feyens fe7b0e828f [IMP] base: UI improvement
closes odoo/odoo#43676

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-11 14:48:52 +00:00
Victor Feyens 27650db8bb [IMP] base: onchange cleanup 2020-02-11 14:48:52 +00:00
Victor Feyens d4e0fe018d [IMP] *: use ref= instead of eval="ref(' in xml field tags.
* Code cleanup
* Avoid a safe evaluation of the field value when loading those records.

closes odoo/odoo#44883

Related: odoo/enterprise#8283
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-02-11 13:07:06 +00:00
Johan Demaret Rivarola 0d5fcdc1c7 [FIX] base: clear cache before read access check
When reading binary content such as `image_128` on `res.users`,
`AccessError` should be raised when necessary.

Steps to reproduce:
  - Populate cache in superuser mode.
  - Access cached field with public user.
  - Read access is allowed but should not.

Concrete example:
  - Unpublish `demo` user.
  - Access `/slides` with `public` user.
  - The template data is generated as `sudo`.
  - The same data is then accessed as `public`.
  - AccessError should be raised when requesting
    `/profile/avatar/<int:user_id>` but is not.

Closes #43826

closes odoo/odoo#45033

X-original-commit: e0112db4d6131751475365ab4c42de848f925dce
Signed-off-by: Christophe Simonis <chs@odoo.com>
2020-02-10 17:43:11 +00:00
Swapnesh Shah 591861faf0 [IMP] base: Use correct reference
Follow-up on https://github.com/odoo/odoo/commit/22f02af6bf002324ebafc38d4eefeda60063247a
Use the correct reference for the file.

closes odoo/odoo#44919

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-02-08 15:00:26 +00:00
Thibault Francois 4673a04c94 [FIX] base: don't swith back with su=False in _name_search
When you have su == True in your env and you call _name_search
    the _name_search was switching back to su = False
    when you call with_user with the same user or with None

    To reproduce the issue, take a model where a user has
    no access.control.list allowing to read the model
    call name_search with sudo.

X-original-commit: 8755269f9877e039663adaec8500b530b6d67c68
2020-02-08 18:55:15 +00:00
Raphael Collet c732a5e44f [FIX] ir_model_access: missing flush() before SQL query
X-original-commit: ba1d04ac8a23a2f3cfad7f332dab96f7e460eb53
2020-02-08 18:55:14 +00:00
Andrea Grazioso (agr-odoo) 96a3383c82 [FIX] base: fix Croatian address formatting
Have a company with Croatian address but no street2 set.
Create and invoice, print it. On the report the street2 will appear
blank (Empty line).

Correcting the formatting of the address fix the issue

opw-2182621

closes odoo/odoo#44789

X-original-commit: 5f4cc31a3b5a459f4a33c149fafb635a13f08270
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-06 17:43:53 +00:00
Raphael Collet 058cf208a8 [ADD] sql_db: pre/post-commit/rollback hooks 2020-02-05 13:50:23 +00:00
Odoo's Mergebot e753bb1a85 [MERGE] sale_stock : add a default warehouse on the user
Purpose
======
Our current integration between FSM and Stock works well for basic flows, but quickly shows limitations. We don't handle warehouse by employee. Use-case: each worker has a dedicated van with a dedicated stock. I want to track the material used for each intervention to make sure that nothing is stolen.

+ This is also useful in usecases outside of FSM. Example: I have 3 shops (= 3 warehouses), each employee works in a different shop, the default warehouse set on the Sales Order should be the default warehouse of the salesperson. So this should be done sale_stock (and not in FSM)

Specifications
===========
Add a 'Default Warehouse' field on the user only visible if :

- sale_stock is installed
- the 'multi-warehouses' feature is enabled
- domain should only include warehouses which belong to a company the user has access to
- not required

The field should be editable by a user on his own profile and by the admin on all users.

When creating a FSM task from scratch, adding some products creates a SO, the warehouse on the SO should be the default warehouse of the user set on the FSM task.

On SO creation,  set the 'default warehouse' selected on the user assigned to the SO. If there isn't any 'default warehouse' set on the user, fallback on the current behavior (warehouse with
lowest sequence)

The field on the res.user should be a property field to allow multicompany usage.

Task : 2166382

closes odoo/odoo#44257

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-05 17:00:16 +01:00
jdoutreloux 9d9badbb90 [IMP] base : add group name on res_user view
Add a group name to allow a better view inheritance
in sale_stock.

Task-2166382
2020-02-04 17:44:49 +01: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 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
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
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
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
wan 3b333b2675 [FIX] base: company_id on res.partner associated to company
The fact that there is a company id set means that you cannot select the
partner in a M2o if you didn't select the company in the selector, and
that you cannot open a document where that partner is set if you are not
in the correct company.
This is an issue for inter_company_rules, as you should be able to
select the company to make a so, po or invoice to a company of the same
database.
2020-02-03 10:46:00 +00:00
Martin Trigaux eafa9f4abc [FIX] *: python 3.8 compatibility
time.clock is deprecated since python 3.3 and no longer exists in python 3.8
time.process_time was introduced in python 3.3

Replace "is" by "==" as this produces a SyntaxWarning in python 3.8

Fixes odoo/odoo#41313

closes odoo/odoo#44502

X-original-commit: f03b4cb5576f264b6845242ba112f02422af4f5f
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-03 14:38:20 +00:00
Denis Roussel 68f5883aff [FIX] ir_property: Allows to search on boolean == False
Closes #43580
Fixes #9449

Adds field type conditions for boolean in search for Property model.

As False values are not stored in DB for boolean, the search() does
not return any value for non existent lines with:

* operator: '=' and value: False
* operator: '!=' and value: True

Uses the 'include_zero' and inverse operator mechanisms implemented
in Property model.

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-03 14:07:10 +00:00
Yannick Tivisse c7bb0786ed [IMP] base: Remove unused field res.company
closes odoo/odoo#44371

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-31 11:38:11 +00:00