Commit Graph
455 Commits
Author SHA1 Message Date
Brieuc-brd 418413e499 [IMP] web, *: directional icons
This commit adapts the directional icons to improve the usability and
maintain consistency with the ui icons library.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
Damien Bouvy 1e706d3069 [IMP] web, *: milk adaptations
*: hr_holidays, stock, sale, product, web, sale, purchase, stock,
   website, survey

Adapt some custom control panels (mainly for custom reports) to the
milk controlpanel.

hr_holidays:
Move the buttons to create a new time off or a new allocation to the
"create button" slot and transform it into a dropdown (creating
allocation requests is clearly a secondary action, not a primary one)

stock:
3 lines does not fit, must be on 2 lines

Part-of: odoo/odoo#116641
2023-05-12 22:59:19 +02:00
clesgow fcc1ad8025 [IMP] purchase{_product_matrix}: add/remove links to m2o fields
Adds back the direct link on the purchase line product's column when the
`product_matrix` is enabled. This allows the user to still click on the
product and go to its form when the module is enabled.

Also removes the direct link to the UoM, since it has no use.
Finally, sets a width for the product column in the purchase form to
keep it usable even when multiple columns are selected.

Part of task-3218314

Part-of: odoo/odoo#119381
2023-05-09 21:04:01 +02:00
Rahul Reddiar 9e1232b4a2 [IMP] purchase_stock: added buyer field in partner form view
Currently, automatically PO is generated in that PO buyer field is empty.

So in this commit, we added buyer field in partner form view, when rfq is
generated automatically and vendor has a specific buyer then at creation
of rfq, the PO buyer field will be set according to that.

TaskID - 3151213

closes odoo/odoo#113709

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-05-09 19:26:48 +02:00
niyasraphy 51761f1918 [IMP] *: improve window title in portal
account, purchase, sale

before this commit, opening a record from
portal(sale, purchase, invoice, project)
shows the window title as Invoice Portal Template,
Purchase Order Portal Template and
Sales Order Portal Template etc

* navigate to portal
* click sales order
* click and open any sales order
* see the window title

after this commit, better title will be
displayed to the portal users.

Invoice Portal Template --> Invoice/Bill
Purchase Order Portal Template --> Purchase Order
Sales Order Portal Template --> Sales Order

closes odoo/odoo#118567

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-04-14 11:49:27 +02:00
Antoine (ande) 8d40bcf89a [FIX] purchase: PO stat button no groups
To reproduce the issue:
1. Create user with no access rights apart from user rights in Sales,
   Sign, Project and Timesheet
2. Create a project, add a task inside and link an analytic account
   to the project
3. Create an RFQ, add a product linked to the analytic account
4. Confirm order, receive product, validate, create bill
5. Log in with user
6. Try to access the analytic account through:
   Project->Task->project name->Settings->Analytic account
7. An error message pops-up "You are not allowed to access Purchase
   Order (purchase.order) records."

Error: You should be able to access the analytic account, but the
Purchase Order smart button should not be visible/present

The data access by the smart button was not stopped by rules or
groups, thus data was always trying to be loaded, even when the user
did not have the access rights

OPW-3180788

closes odoo/odoo#115058

X-original-commit: 9e8b2ba1ae05de72f492d833edd8da91ded6f5b0
Signed-off-by: Adrien Widart <awt@odoo.com>
Signed-off-by: Demany Antoine (ande) <ande@odoo.com>
2023-03-14 12:24:03 +01:00
Victor Feyens 24ccf7d9b0 [CLN] *: useless type info for actions
The type fields of actions already defaults to
the model name in the base model definition.

Therefore, specifying `ir.actions.server`, `ir.actions.act_window`
& so on as type is useless (and adds noise since it's the same as
the action model).

closes odoo/odoo#114539

Related: odoo/enterprise#37855
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-08 17:33:37 +01:00
niyasraphy 357a670cb1 [FIX] purchase,stock: traceback field used in domain missing in view
before this commit, enabling the mass editing for the picking operation type tree view or for purchase.order tree view using the studio, throws the exception.

* install studio
* open purchase order tree
* enable mass editing for the tree from studio app
* exception will be shown

after this commit, on enabling mass editing on this tree view, will not throw exception.

closes odoo/odoo#114669

X-original-commit: dad9d98697781307a1cb537e8e818a775b50432a
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-03-08 13:49:08 +01:00
maximilien(malb) ee2c82700e [IMP] account,sale,repair,website,purchase: remove setting and display correction
Before this commit, the accounting module had a setting on the selection of taxes used by the sales, purchase, website_sale, ... modules. In addition, the website_sale module had the same setting related to the accounting one.
This PR isolates the tax selection parameter in the website_sale module, and instead of using the tax selection, the accounting module will use rounding method (round per line, round globally).
Selecting one of the two will change the display of all account_move or other view using the tax selection setting.

Display changes:
In round per line, a column tax excluded will always be displayed while a column tax included will be in optional hide.
On the other hand, in the round globally, only the tax excluded columns will be available.

closes odoo/odoo#99209

Task-id: 2954332
Related: odoo/upgrade#3826
Related: odoo/enterprise#30853
Signed-off-by: William André (wan) <wan@odoo.com>
2023-03-02 19:24:45 +01:00
ノウラ 477082212d [FIX] sale, purchase: fix product description overflow
Steps to reproduce:

- Install stock, purchase
- Create a product with a long name without whitespace
- Create a purchase order with that product
- Go to portal and access the purchase order

Current behavior:
- Product description overflows when accessing the PO from the portal

Behavior after the PR:
- To fix the problem in the Portal we add table-responsive to the table

opw-3133407

closes odoo/odoo#112672

X-original-commit: 5abccc5efc6e333c8a889a1c24419dadc9c6e7f0
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-14 18:11:47 +01:00
Hansun (hale) 79bbaeeaf0 [FIX] purchase: form view of a field after reminder
To reproduce the issue:
1. Install [Inventory], [Purchase] on Apps
2. [Settings]>[Inventory]>[Storage Locations]: enable
3. On [Purchase], Create. 'Deliver to' field is ill-positioned

Desired view: use the full width of the row

Applicable versions: 16.0 - master

opw-314167

closes odoo/odoo#111759

X-original-commit: 46700f12b0b4e64029bccf3abb791fe95400331d
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-02-03 07:07:04 +01:00
Anita (anko) f5eec1d539 [FIX] sale,purchase,account: Duplicating document_tax_totals
If user would add addictional field in one of reports it could break other
reports as other models do not share all the same fields. Now modules inherit
template and create their version of field.

task-2858097

closes odoo/odoo#106140

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-01-26 18:50:58 +01:00
mehjabinfarsana c420d87af7 [FIX] purchase: currency required attribute issue
before this commit, when try to create a purchase order without inputting currency field it was showing exception like "The operation cannot be completed:
- Create/update: a mandatory field is not set."

after this commit, user cannot save the record without filling currency field

closes odoo/odoo#110786

X-original-commit: 34b24e4e3d34470bcbeb28f0b89b59cea84b7c7d
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-24 10:20:47 +01:00
niyasraphy a6917c4630 [IMP] purchase: add uom in purchase settings
closes odoo/odoo#107218

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-06 12:29:25 +01:00
gawa-odoo 8bf6bee153 [IMP] analytic, *: block validation with mandatory plan
* = {account, sale, purchase, hr_expense}
When a plan is mandatory for SOL, POL or expenses, the flow should still be blocked when pressing the button, and not only when creating analytic lines.

We add the info in the context of the button, so automatic flows are still not blocked.

When the applicability rule requires a mandatory analytic distribution, raise an error upon :
- confirming PO,
- sending or confirming SO
- approving Expense Report by manager.

t-3040929

closes odoo/odoo#107166

X-original-commit: 8623a7850288828759db125b1054b0fed6b6b135
Signed-off-by: William André (wan) <wan@odoo.com>
2022-12-04 17:58:01 +01:00
Jorge Pinna PuissantandMichael Mattiello (mcm) c7c2959449 [IMP] web, *: simplification and standardization of the settings arch
The aim of this commit is to simplify and standardize the settings archs.

To do this, a small DSL exclusively for the settings was created. This
new DSL introduces 3 tags: `app`, `block` and `setting`.

The `app` tag is used to declare the application on the settings view.
It creates an entry with its logo on the sidebar of the view. It also
acts as delimiter when searching.

```xml
    <app string="CRM" name="crm">
    ...
    </app>
```

- `string` : The "display" name of the application.
- `name` : The technical name of the application (the name of the module).
- `logo` *optional* : The relative path to the logo. If not set, the
        logo is created using the `name` parameter :
        `/{name}/static/description/icon.png`.

The `block` tag is used to declare a group of settings. This group can
have a title and a description/help.

```xml
    <block title="Title of group Bar">
    ...
    </block>
```

- `title` *optional* : The title of the block of settings (the old h2),
        you can perform research on its text.
- `help` *optional* : The description/help of the block of settings
        (the old h3), you can perform research on its text.

The `setting` tag is used to declare the setting itself. The first field
in the setting is used as the main field (optional). This field is
placed on the left panel (if it's a boolean field) or on the top of the
right panel (otherwise). The field is also used to create the setting
label if a `string` is not defined. The `setting` tag can also contain
more elements (e.g. html), all of these elements are rendered in the
right panel.

```xml
    <setting string="this is bar">
        <field name="bar"/>
        ...More elements
    </setting>
```

- `type` *optional* : By default, a setting is visually separated on two
        panels (left and right), and is used to edit a given field. By
        defining `type='header'`, a special kind of setting is rendered
        instead. This setting is used to modify the scope of the other
        settings. For example, on the website application, this setting
        is used to indicate to which website the other settings apply.
        The header setting is visually represented as a yellow banner on
        the top of the screen.
- `string` *optional* : The text used as label of the setting. If it's
        not defined, the first field is used as label.
- `title` *optional* : The text used as tooltip.
- `help` *optional* : The help/description of the setting. This text is
        displayed just below the setting label (with classname
        `text-muted`).
- `company_dependent` *optional* : If this attribute is set to "1" an
        icon is displayed next to the setting label to explicit that
        this setting is company-specific.
- `documentation` *optional* :  If this attribute is set, an icon is
        added next to the setting label, this icon is a link to the
        documentation. Note that you can use relative or absolute path.
        The relative path is relative to
        `https://www.odoo.com/documentation/server_version`, so it's not
        necessary to hard-code the server version on the arch anymore.

closes odoo/odoo#106425

Task-id: 3081367
Related: odoo/enterprise#34337
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Michael Mattiello (mcm)" <mcm@odoo.com>
2022-12-02 14:40:25 +01:00
niyasraphy 90ca48bf25 [FIX] sale, purchase: add place holder for product warning fields
closes odoo/odoo#105691

X-original-commit: 4e343409fe6a5752ee1b15197a6e092968830c8c
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-11-18 12:57:50 +01:00
Hubert Van de Walle (huvw) 94392f8947 [FIX] purchase: Uom should not be displayed when disabled
Steps to reproduce
==================

- Use a mobile phone / mobile view in devtools
- Go to Purchase > Purchase Orders
- Click on one item
-> A traceback occurs, the uom is missing

Cause of the issue
==================

The field is declared as
  `<field name="product_uom" groups="uom.group_uom"/>`

The raw value is accessed with
  `<t t-esc="record.product_uom.value"/>`

Solution
========

Add the missing group

opw-3033650

closes odoo/odoo#105487

X-original-commit: bc6c2d8d15e22f6af720db6a28e21739defede94
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-11-14 09:28:36 +01:00
niyasraphy 1709cba800 [FIX] sale,purchase,stock,account: partner form warning alignment
closes odoo/odoo#105511

X-original-commit: 6aa86c92c7ee7d46c54250960c2b34753e13b8be
Signed-off-by: William André (wan) <wan@odoo.com>
2022-11-10 00:27:59 +01:00
David (dafr) fe45115f7c [FIX] purchase: Add 'price_total' & 'price_tax' to the order lines tree
# Description
The absence of those fields can generate a log note spam & performance issue when updating an order line value.

# HOW TO REPRODUCE
- Create PO with 40+ order lines (50 recommend) (* SA to reproduce would be nice)
- Confirm PO (state needs to be "purchase")
- Update the Ordered Quantity of the first line.
- Save
=> PO Lines from page 2 and beyond have each created the following log message:
"The ordered quantity has been updated."

# Explanation
The purchase.order.line onchange will not save any update on 'price_total' because it is not on the onchangeSpec.
Then a purchase.order onchange is done, and this one does have 'order_line.price_total' on the onchangeSpec, forcing the onchange method to return the field 'order_line' (aka ALL the order lines) as updated.
When saving the changes, the JS framework, who does not have the data for the order_lines on the 2nd page, will not correctly filter the fields with real changes, and add the 'product_qty' field (and more) to the "write" call for every order_line not in the 1st page.
Then the write method, without checking if there is any real change on the product_qty, for each lines that has product_qty in the Write's values, will write in the log note and call a performance intensive method: _create_or_update_picking()

OPW-2982004

closes odoo/odoo#104549

X-original-commit: e99cdd6430bf85bcae8ec3b8febcf8e3719169a5
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: David <dafr@odoo.com>
2022-10-31 10:41:44 +01:00
Damien Bouvy 5a79a2857f [FIX] (various): adapt to grid form views
closes odoo/odoo#102993

X-original-commit: c5a9d95ee13d0ed1d261e803d15d1f17cedfaab6
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-10-25 16:11:59 +02:00
gawa-odoo b8dca3b174 [IMP] analytic, *: Json field for analytic distribution
The `analytic_distribution` field is a Json.
It was stored temporarily as a char.

Search is not available yet, so we do queries by hand when we need to search on keys.

Also added a constraint on account_analytic_distribution_model,
so we don't have models with accounts specific to a company when the model has no company or another company.
It would cause an issue when looking at the models from another company.

X-original-commit: 7064c95aa04e5138bb12ae97acfee04ebb67cc0e
Part-of: odoo/odoo#103097
2022-10-17 10:11:09 +02:00
clesgow 269e66ee34 [FIX] purchase: Adapt PO line form to grid
Adapts the Purchase Order Line form to the new grid css system for
groups.

closes odoo/odoo#102760

X-original-commit: 91582733e413e28e9f26f16e7209f6d91ca546c4
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2022-10-12 11:29:45 +02:00
Fabien Pinckaers d9e753aa29 [IMP] missing d-flex to align star & name
closes odoo/odoo#102526

X-original-commit: fd8f15366f395aab0a0b6c453fb0ab3aad082b74
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-11 15:51:59 +02:00
Damien Bouvy e647a2de09 [IMP] *: adapt to grid form views
The recent switch from tables to css grids for form views `group` nodes
has introduced several inconsistencies/issues with several views accross
modules - these will not be the last fixes.

closes odoo/odoo#102174

X-original-commit: 836568dfd59886a6d52f15e0e2109709903b6803
Related: odoo/enterprise#32295
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-10-11 13:15:12 +02:00
gawa-odoo ba4b71427f [IMP] analytic,*: changes on applicability and make fields visible
Add choices for the business domain on applicability rules, so rules are more precise
Also put 'general' as domain from the view when it's what should have been.
Make analytic field visible since owl migration (for sale and purchase)

closes odoo/odoo#102461

X-original-commit: c5867d5009a7fb448fff1be487b9e9c3e7945d4b
Related: odoo/enterprise#32421
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
2022-10-10 14:04:43 +02:00
JF Aubert 28a2c49d42 [FIX] product,purchase,mrp_subcontracting: adjust product & supplier info ui
Within Purchase tab:
- Make Quantity hidden by default.
- Move Currency right after Price.
Move Purchase Description to the right of Vendor Bills.

closes odoo/odoo#102702

Task: 3004014
X-original-commit: b3e78b5a8f825650123004a8b8677aaacfe6b43e
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Jean-François Aubert <ajf@odoo.com>
2022-10-10 09:48:03 +02:00
clesgow d850128292 [FIX] purchase: re-align receipt reminder
Avoids breaking the layout by hiding the label instead of fully removing
it from the DOM

Part of task-2985735

X-original-commit: 36eab7d034b52657bae988e5c35b0c429df2c05b
Part-of: odoo/odoo#102495
2022-10-06 19:59:08 +02:00
Romeo Fragomeli 5f2017e544 [FIX] purchase,sale: adapt colspan in form view
Since the usage of the `CSS Grid` some view are broken due to too much
CSS rules conflicting together.
The new form view system is less tolerant to missing colspan.
This commit, change the colspan when needed (e.g. no label)

Steps to reproduce:
* Go to sale
* Select the product menu
* Select a product (e.g. Printer)
* Some fields on the form view (in panel) are not aligned => BUG

closes odoo/odoo#102246

X-original-commit: 4813d1ebd4295c8be7ee6b6a892604f15cc43fce
Related: odoo/enterprise#32320
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2022-10-06 00:37:17 +02:00
Victor Feyens 5f621c9fe2 [IMP] purchase(_*): convert order view to OWL
Task-2918791

X-original-commit: b2457fbc45aa8a2714c92ea48333fa8108acf405
Part-of: odoo/odoo#101352
2022-09-28 11:14:36 +02:00
Touati Djamel (otd) bc6c8255a9 [FIX] purchase: remove extra filter domain
Steps to reproduce the bug:
- create a new product “p1”
- Create a purchase order with “P1” → confirm it
- Click on “Purchase history”

Problem:
No purchase order is displayed for this product, whereas we have a
confirmed PO.

Because the partner id is formatted as a string and added to the domain,
so when the `web_search_read` function is executed, it will return an
empty result because the id is supposed to be a number instead of a
string: https://github .com/odoo/odoo/blob/master/addons/web/models/models.py#L62

Solution:
The filter on the vendor can be removed because it's already added when
calling the action: https://github.com/odoo/odoo/blob/678bc958fafd5502a61ce54069b13160ad37d2d4/addons/purchase/models/purchase.py# L1240

opw-2976152

closes odoo/odoo#100892

X-original-commit: 9431adc5bfce525bd3a9ec4c3f7215f2ee312841
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-09-23 09:21:35 +02:00
gawa-odooandHabib 7e3403068f [REF] *: Analytic Apocalypse
The goal of this commit is to get rid of the analytic tags as they were confusing, serving tag purposes as well as distribution on analytic accounts.

Everywhere analytic tags were used as a distribution have been replaced with a new widget that will dispatch distribution on analytic accounts. If there was an analytic account field next to the tags, it has been included in the distribution.

Analytic tags that were used simply as information tags have been removed.

To fill the new widget, there are now 2 kind of rules that will help fill and prefill it.
The first are applicability: previous groups have been removed, and have by replaced by plans. Each account is required to have a plan. These plans define when they are available in the widget: a default applicability per plan and applicability lines that can specify rules following the context of the widget.

The second one are distribution models, that will replace previous default rules but follow the same principles. The accounts (and so the plans) that will be given by the distribution model can override the applicability rules from before.

closes odoo/odoo#98914

Related: odoo/upgrade#3885
Related: odoo/enterprise#30743
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: Habib (ayh) <ayh@odoo.com>
2022-09-20 12:36:01 +02:00
Romain Estievenart 98a97d0fea [IMP] *: removes .form-group
this commit removes the usage of .form-group class which is deprecated
since BS5.

Here is the css rules that was used:

a) https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L1997
As we can see, it simply adds a `margin-bottom` of `1rem` which
corresponds to the `.mb-3` BS class.

b) https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L2326
As we already checked all `form-inline` in [1] and [2], we don't have to
do anything about these rules.

'''Breaking change: Dropped form-specific layout classes for our grid
system.
Use our grid and utilities instead of .form-group, .form-row, or
.form-inline.'''

https://getbootstrap.com/docs/5.0/migration/#forms

Notes:
- `position: relative` is already on `#new-password-group`.
- `.field-db`, `#editor-media-image`, `.unsplash_img_container` and
`#url-form-group` seems unused.
- Sometimes margins are unnecessary because of blocks overlapping.
  (e.g. `margin-bottom` is not needed if margin-top is set on the
  following node)
- CSS rules applied on `.s_website_form_rows > .form-group` are now in
the XML by adding `mb-0 py-2` BS classes.

Follow-up of:
[1] https://github.com/odoo/odoo/pull/97967
[2] https://github.com/odoo/enterprise/pull/30343

closes odoo/odoo#100052

Related: odoo/enterprise#31261
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-09-16 20:51:56 +02:00
svs-odoo 2bc141e6ba [REF] purchase(_stock): Removes price diff account
- Removes related fields in views and models.

Part-of: odoo/odoo#99411
2022-09-12 13:49:15 +02:00
Ahmed Khalaf (ahkh) 275fa2f0ce [IMP] purchase: Purchase Dashboard to OWL
This commit converts the purchase dashboard to owl component
and removes its legacy code.

closes odoo/odoo#97590

Taskid: 2920812
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-08-29 23:46:48 +02:00
Denis Ledoux 87e968a45a [IMP] purchase: move group inside the view
The goal being to get rid of the `groups_id` feature for backend views

Part-of: odoo/odoo#98551
2022-08-29 22:42:53 +02:00
Denis Ledoux 8b91cab67f [IMP] base: remove groups_id from ir.ui.view
The goal of this revision is to get rid of the `groups_id` field of the model `ir.ui.view`.

- This feature wasn't really known or used by most developers,
   and not straight-forward to understand.
   Removing it allows one less complicated thing to learn for developers.
   Besides, thanks to odoo/odoo#95729,
   changing the behavior of the `groups=` attribute,
   we can easily get rid of this `groups_id` feature
   by simply adding `groups=` in the elements of the views
   using the `groups_id` field, it will have the same effect:
   adding the elements in the view only for the users part of the specified group.

- By getting rid of the groups_id many2many field on ir.ui.view,
   it makes possible to cache the view architecture without
   requiring to use the groups in the cache key.
   Currently, if we want to cache the view architecture,
  it would be required to use the intersection of the user
  groups with the groups_id groups of the view,
  making it costly to compute the cache key,
  therefore altering the performance point to cache the view
  architectures.

Part-of: odoo/odoo#98551
2022-08-29 22:42:50 +02:00
Denis Ledoux 9a8ad08dc6 [FIX] purchase: currency_id is required for account-tax-totals-field
The widget `account-tax-totals-field` needs the value of the
`currency_id` field, even when not in multi-currency mode.

The widget is used in `sale.order`, `account.move` and
`purchase.order`. The only place where the field
was not included when not in multi-currency mode
was the purchase.order.

A traceback was raised when attempting
to open the purchase order form when
not in multi-currency.

This is an oversight of odoo/odoo#95729

closes odoo/odoo#98597

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-23 12:05:51 +02:00
Denis Ledoux 0501bbd62e [IMP] base: uniform "groups" in back-end view
This revision is to make uniform the behavior of the `groups` attribute
on the Python model fields
and on the node in the view architecture.
In both cases, remove the node from the view completely.

Before this revision,

in a back-end view:
 - In the Python model, if a field has the `groups` attribute set
   and the user is not part of
   the groups, the field is removed, completely, from the view.
 - In the view architecture, if a node has the `groups` attribute set
   and the user is not part of
   the groups, the node is made invisible (not completely removed, just
   made invisible).

in a front-end view:
 - if a node has a "groups" or "t-groups" set and the user
   is not part of the groups, the node is removed from the view.

So it's 2/3 cases removing nodes restricted to a group.
and 1/3 case making invisible nodes restricted to a group.
It's simpler to have a uniform behavior for the 3 cases,
simpler to understandard for developers.

In addition, this will help for the goal to cache back-end views.
It makes possible to convert views using the `groups_id` field
by moving the content of these views directly
in the view to which they add content which is suppose to be completely
removed when the user has not the according group.
By getting rid of the `groups_id` many2many field on `ir.ui.view`,
it makes possible to cache the view architecture without
requiring to use the groups in the cache key.
Currently, if we want to cache the view architecture,
it would be required to use the intersection of the user
groups with the `groups_id` groups of the view,
making it costly to compute the cache key,
therefore altering the performance point to cache the view
architectures.

closes odoo/odoo#95729

Related: odoo/enterprise#29592
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-19 19:10:39 +02:00
Morgane (morm) eb71a1baa1 [IMP] purchase: scss revamp
Prior to this commit, the dashboard was a table and there was
unnecessary scss.
This commit changes the table into the new bs5 grids
and clean the scss files.
In the portal view, a class(orders_label_text_align) that didn't affect
the design was removed.

task-2906527

closes odoo/odoo#95902

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-08-10 14:43:12 +02:00
stefanorigano (SRI) 56064ff1e4 [REM] *: drop oe_clear class in favor of clearfix bootstrap default
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2918463

Part-of: odoo/odoo#97051
2022-08-04 13:54:14 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
+2 bc0a0cead6 [IMP] web,*: enable owl list & form views
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.

We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).

[1] odoo/odoo#92475

Part-of: odoo/odoo#78221
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2022-07-22 16:21:45 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Victor Feyens fba6ea5a47 [IMP] *: do not force admins to be app admins
For bugfix purposes, app administration groups have been given to
(implied by) the "Settings" group because without those rights,
opening/saving the settings crashed.

1) Do not load hidden view content

This commit uses the conditional inheritance of views
(depending on user groups) to avoid loading unnecessary view
& record content client-side.

This improves performance for admins without the specific application
admin rights, but also fixes the main bugfix problem,
caused by the webclient querying name_get for the records in relational
fields content.

Example:

sale_management adds a res.config.settings field to specify
the default sale.order.template for the current company.

If a 'Settings' user without 'sale.group_sale_manager' opens the
settings, he won't see this setting, but if a default template is
specified for the current company, the webclient will still request
the name_get of this template to the server, because the field
was present in the view, only hidden with a groups attribute.

With this commit change in sale, the field won't be in the view unless
you have the Sale manager group, avoiding the error/traceback/bug.

2) Remove implied application administration groups

Do not force the specific application groups on all 'Settings' user,
they globally do not need those rights, and if they need it, they
can add it to their account themselves.

3) Add a test to make sure settings user are able to manage settings.

4) Enforce 'settings' -> 'access rights' -> 'internal user' groups

As the previous test highlighted some 'false positives' because
it considered a settings user unable to read `crm.team`
and `stock.warehouse` records, we also took the opportunity to enforce
the fact that 'Settings' & 'Access rights' users must be internal users.

It makes no sense for a portal/public user to have access to the
settings, and didn't work anyway.

Part-of: odoo/odoo#91909
2022-06-23 23:48:29 +02:00
Tiffany Chang (tic) 00689e7fc6 [REM] purchase_requisition{_stock}: rem old call to tender pt2
This commit removes the call for tender feature via a
purchase.requisition. This feature is to be replaced with the ability to
directly compare prices/options of POs/RFQs within a PO to remove extra
steps to compare them. The linkage between POs previously provided by a
purchase.requistion is replaced by the POs being directly linked to each
other. Feature to auto-create call to tenders via a product option is
removed and the user is expected to know/be responsible for when they
should do a call to tender themselves.

All references to old Call to Tenders replaced with Blanket Order, and
we remove/rename the menu items since Blanket Order is now the only
purchase.requisition.type option (we expect minimal customizated types).
Follow-on refactoring to switch purchase.requisition to
purchase.blanket.order to come later. Follow-on refactoring to switch
purchase.requisition to purchase.blanket.order to come later.

Part of Task: 2695116
Upgrade PR: odoo/upgrade#3586

Part-of: odoo/odoo#87656
2022-06-20 12:15:58 +02:00
Patrick Hoste bf992f24b2 [IMP] various: improves usage of partners
SPECIFICATION

Various change for the partner view:
- Moved the activity widget to the bottom right of the kanban
- Moved the informations badge to the bottom right next to the
  activity widget and made them clickable
- Change the address options order and add a small help below
- Change the 'Remove' button function from delete to remove from
  the company and add a delete button to the right end.
- Correct some typo
- Add an 'Archived' ribbon to the kanban card
- Change various small things

LINKS

Task-2821356

closes odoo/odoo#89249

Related: odoo/enterprise#26442
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-14 11:41:15 +02:00
aliya c11e0a431a [IMP] purchase,sale: add a smart button to view source SO/PO
Task 2833338

Add a smart button to show origin SO/PO on invoices and vendor bills.

closes odoo/odoo#90664

Signed-off-by: Steve Van Essche <svs@odoo.com>
2022-06-02 10:56:15 +02:00
Arnold Moyaux 470b756297 [IMP] purchase_stock, sale_stock: pickings status
Add a reception/delivery status on sale orders and purchase orders.
The idea is to have an indication in list view about the situation
of pickings linked to the SO/PO.

Inside the document itself, the quantity delivered decoration are
designed to indicate if everything is correctly deliver or if
it still something to do. (red if the delivery/receipt is late and
incomplete)

Task-2381757

closes odoo/odoo#63356

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-04-04 17:48:08 +02:00
Didier (did) fc9e67bc6b [IMP] mail: move message unread counter to channel
The field could have been removed from thread since https://github.com/odoo/odoo/commit/88b8cd058713bfad2942f7e7434c34b6c1a6e7da

task-2746109

closes odoo/odoo#83765

Related: odoo/upgrade#3222
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-21 14:59:42 +01:00