Commit Graph
5914 Commits
Author SHA1 Message Date
Raphael Collet ea3e39506a [IMP] models: use slots for BaseModel
This restricts the attributes of a BaseModel instance to `env`, `_ids`
and `_prefetch_ids`.  This way, one can only assign fields on a record;
other assignments are programming errors.

This also reduces the memory footprint of records from 168 to 64 bytes
(-62%), and makes their instanciation faster.

closes odoo/odoo#51075

Related: odoo/enterprise#10529
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-05-18 09:51:43 +00:00
Krupal Oza 6d17897dff [IMP] various: Clean the kanban view design
PURPOSE
=========================

The goal of this task is to set up some kind of guidelines to make
kanban views consistent.
It is fine having different kanban views, but if a UI element is shared
among several kanban views, it should behave/look the same so the user
knows what to expect.

Kanban views can be split into two types:
==> 'documents' kanbans, such as res.partner, crm.lead, etc.
    - those records are created/edited often, numerous
    - 'opening' the card means accessing the record
==> 'dashboard' kanbans,such as stock.picking.type,account.journal, etc.
    - those records are not created/edited often, there are much less numerous
    - usually presented as dashboard, where 'opening' the card means
accessing a set of related 'documents' (clicking on a account.journal
to access account.move, or stock.picking.type to access stock.picking)
    - configuration of the 'card record' is done through a dropdown to
access configuration

Here are some guidelines for consistency. Bear in mind that those are
not rules, but guidelines for consistency that we'd like to keep in
mind when designing.

==> 'documents' kanbans
 - the record is accessed through global click
 - the user avatar is at the bottom right
 - the activity widget is at the bottom left (in last position if
there are other elements)

==> 'dashboard' kanbans
 - the record is accessed through a 'Configuration' option in the card dropdown
 - there is no global click, and therefore no focus shadow
 - the dropdown icon (o_kanban_manage_toggle_button) is always visible,
with icon fa-ellipsis-v
 - the listview counterpart should be presented as a dedicated
configuration menu, and shouldn't be in the 'dashboard action'
 - links in the body of the card are structured as follows: link with
<count>+label, then any additional aggregated metrics (not link) to the right
example https://drive.google.com/file/d/1ZP6HDHTtC7cQ6rDWgqLoPs6U8JCeNVkW/view?usp=sharing

==> global guidelines
 - the title font color is #212529, with 500 weight
 - the subtitle font color is #666666, with 400 weight
 - the font size is 1.083rem
 - text overflow is handled through linebreak, not ellipsis
 - numerical values are aligned to the right
 - the kanban state widget is at the bottom right

SPECIFICATION
=================

AS per guidelines Improved follwing kanban/dashbaord view
 - hr_job
 - hr_department
 - hr_work_entry
 - hr_appraisal
 - fleet_vehicle
 - product_template
 - sale_subscription_template
 - crm_team
 - res_partner
 - event
 - stock_picking_type
 - mrp_eco_type
 - maintenance_team
 - quality_alert_team
 - account_journal

Added the department menu on employee with default kanban view
Added sequence in hr_work_entry list view

TaskID: 2206372
Related Enterprise PR: https://github.com/odoo/enterprise/pull/10341
Closes: #50536
2020-05-18 12:11:22 +00:00
Yannick Tivisse 7b714a3bc7 [IMP] various: Update list views with new widgets
Purpose
=======

The following task implemented new widgets/features in the listview for better UI.
https://www.odoo.com/web#id=2195254&action=327&model=project.task&view_type=form&cids=1&menu_id=4720

The goal of the current task is to use those to upgrade our listviews

Specification
=============

Below are change requests on various listviews.

Remove decoration-bf="message_needaction==True" from every listview in every module.

PRODUCT - stock.view_stock_product_template_tree (product template)

remove all decorations from <tree>
set the following decorations on 'virtual_available' and 'qty_available'
decoration-danger="virtual_available&lt;0"
decoration-warning="virtual_available==0"
also set decoration-bf on 'virtual_available'
apply the same modifications on stock.view_stock_product_tree for product variants

SUBSCRIPTION - sale_subscription.sale_subscription_view_list

remove all decorations from <tree>
'stage_id' field
set <field name="stage_id" widget="badge" decoration-info="stage_category == 'draft'" decoration-success="stage_category == 'progress'"/>
'recurring_next_date' field
set <field name="recurring_next_date" string="Next Invoice" widget="remaining_days" attrs="{'invisible': [('stage_category', '!=', 'progress')]}"/>
set decoration-bf on 'code' and 'recurring_total_incl'
move 'percentage_satisfaction' before 'recurring_total_incl'
set widget="many2one_avatar_user" on 'user_id'
add <field name="activity_ids" widget="list_activity"/> after 'user_id'

ELEARNING - website_slides.slide_channel_view_tree

set widget="many2one_avatar_user" on 'user_id'
'enroll' field
set <field name="enroll" widget="badge" decoration-success="enroll == 'public'" decoration-info="enroll == 'invite'" decoration-warning="enroll == 'payment'"/>

POS - point_of_sale.view_pos_order_tree

remove all decorations from <tree>
'state' field
make visible and move it at the end of the view
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state not in ('draft','cancel')"/>
set decoration-bf on 'name'

APPRAISAL - hr_appraisal.view_hr_appraisal_tree

'state' field
set <field name="state" widget="badge" decoration-info="state in ('new','pending')" decoration-success="state == 'done'"/>
'date_close' field
set <field name="date_close" widget="remaining_days" attrs="{'invisible': ['|',('state','=','done'),('state','=','cancel')]}"/>

PAYMENT - account.view_account_payment_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'posted'"/>
move 'company_id' before 'amount'

CONTRACT - hr_contract.hr_contract_view_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'close'" decoration-success="state == 'open'"/>
set widget="many2one_avatar_employee" on 'employee_id'

PAYSLIPS - hr_payroll.view_hr_payslip_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'verify'" decoration-success="state in ('done','paid')"/>
set decoration-bf on 'number' and 'net_wage'
move 'company_id' before 'basic_wage'
set widget="many2one_avatar_employee" on 'employee_id'

SURVEY - survey.survey_tree

'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'open'"/>

APPLICATION - hr_recruitment.crm_case_tree_view_job

set widget="date' on 'create_date'
set widget="priority' on 'priority'
set widget="many2one_avatar_user" on 'user_id'

TIME OFF - hr_holidays.hr_leave_view_tree

remove all decorations from <tree>
'state' field
set <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state in ('confirm','validate1')" decoration-success="state == 'validate'"/>
apply the same changes in hr_holidays.hr_leave_allocation_view_tree

closes odoo/odoo#51305

Taskid: 2256589
Related: odoo/enterprise#10614
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-15 08:24:05 +00:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
ahenriquez eb2c9e07ba [IMP] mrp: add hook to prepare procurement values on MO creation
We need a hook to be able to personalize the procurement values
which will be used on procurement group creation when creating MO

closes odoo/odoo#51016

X-original-commit: 9a100e99ad401e5ca6bf45bf8371388c47ec7849
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-05-11 10:17:40 +00:00
Andrea Grazioso (agr-odoo) 6e69a2bf0b [FIX] mrp: successfully retrieve empty computed field
1. Install MRP
2. Launch an Odoo shell on the database
3. Type the command
`print(env["mrp.bom.line"].browse(1).child_line_ids)`

Traceback will occur with exception
odoo.exceptions.CacheMiss: ('mrp.bom.line(1,).child_line_ids', None)

This occur due to the empty value that the computation of the field
yields, which is not saved in cache.
Fix by adding a default value.

opw-2226951

closes odoo/odoo#50950

X-original-commit: fc885499a3c75d8d564569ec4cea41a8a64f3164
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-08 15:50:43 +00:00
Nicolas Martinelli 6bc3b30371 [FIX] mrp: Sub BoM
- Create products P1 & P2
- Create a BOM for P1
  Operation O1
- Create a BOM for P2
  Use 1 unit of P1
  Operation O2
- Open the 'Structure & Cost' report for P2

The BOM of P1 is not taken into account in the report.

This happens because a 'Sub BoM' must have the same Operation than the
parent (or no operation set).

There is no real functional reason for this, so we remove the
limitation.

opw-2246370

closes odoo/odoo#50743

X-original-commit: 5d3e88aa919a69ad54076637e72b880552e2a0be
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-06 11:14:35 +00:00
Nicolas Martinelli 1b70a132d3 [FIX] mrp: wo state when changing qty
- Create a product P
- Create a BOM:
  Use 1 unit of C
  Routing with 2 Operations
  Start Next Operation: 'Once all products are processed'
- Create a MO for 10 units
- Process the first WO
- Scrap 2 components, produce 8 units in the first WO
- In the MO, change the quantity to produce to 8

The first WO is done, the second WO is still waiting for the previous
one to finish.

We change the state of the next WO.

opw-2244166

closes odoo/odoo#50690

X-original-commit: 8a723f0f104e64d336764431ea15eb3166cc52b7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-05 15:35:48 +00:00
Nicolas Martinelli 02ccba232e [FIX] mrp: putaway on byproduct
- Create a product P
- Create a BOM for P
  Use 1 unit of C
  Produce 1 unit of byproduct B
- Create a putaway strategy for C
  From: Stock
  To: Shelf 1
- Create a MO for P, perform until the end

The product C is sent to Stock instead of Shelf 1.

When the stock move line is created, the putaway strategy is simply not
applied.

opw-2242987

closes odoo/odoo#50687

X-original-commit: 49ffdfb6ecbdf11ee1dc85ef494df515f249466e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-05 15:32:26 +00:00
Aaron Bohy b6d05f6015 [IMP] *: update kanban views
Use the new Many2OneAvatarUser field widget in some kanban views,
which allows to open a DM chat window with the corresponding user
by clicking on the avatar.

Part of task 2195254
2020-05-05 10:05:12 +00:00
Martin Trigaux 2d00263127 [I18N] *: export saas-13.3 translations
closes odoo/odoo#50031

X-original-commit: 15a7a9f9d71a0b9c46d7caf2f4fbf09a5a4c63fe
Related: odoo/enterprise#10140
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-04-23 07:13:48 +00:00
Arnold Moyaux a405de0161 [IMP] stock, mrp, purchase_stock: forecast popover usability
Set the padding on the write for date. Modify the text to be consistent
with the manual and automatic orderpoint. Explains the min, max
and quantity to order mechanism.

closes odoo/odoo#48536

Task: 2161378
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-22 08:05:50 +00:00
Arnold Moyaux 90f067cce8 [IMP] stock, mrp, purchase_stock: allow to define vendor, bom on orderpoints
Allow to set a BoM or a vendor on an orderpoint. In this case it's
passed to the values and will be processed by _run_buy and
_run_manufacture to use them.

Task: 2161378
2020-04-22 08:04:32 +00:00
Arnold Moyaux 712c377a0e [FIX] mrp, stock: route diagram button under routes field
Usabilty. Move the route button under the route params.
People had issue with route and didn't know that this
report exist. We hope that moving it under the route will
help user to configure their route.

Task: 2161378
2020-04-22 07:59:44 +00:00
Arnold Moyaux fc692354b6 [IMP] mrp, stock: default route on orderpoints
Set a default route on orderpoint created by the replenishment report.
First it select the first route on the product if it exists (it's
uselss since it's a preferred route on the report but it's used for
clarity). If the product has no route then it tries to guess it
with vendor pricelist or BoM on the product.

Task: 2161378
2020-04-22 07:58:04 +00:00
Arnold Moyaux 943da6df0f [IMP] stock, purchase_stock, mrp: Replenishment Report
New report to easily order missing products in each warehouse.
Orderpoint have a new type: 'manual'. Manual orderpoint are not
trigger by the scheduler but the user could create replenishment
from the report directly. The report use the forecast report in
order to detect missing quantity for today (it does not search
depending the lead time for each product warehouse due to lake
of performance). It compares missing quantity with incoming RFQ
and other ongoing orderpoint. If it still missing a new entry
for replenihsment is created (it's also automaticaly deleted if
the replenihsment has been done another way).

Task: 2161378
2020-04-22 07:52:45 +00:00
Simon Lejeune 6c3ddc3ad0 [REF] mrp: bom not required on production order
task-2226404

closes odoo/odoo#49494

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-10 13:02:28 +00:00
Nicolas Martinelli 15b5b5f518 [FIX] mrp: decoration precision
1. Set Decimal Accuracy of "Product Unit of Measure" to 6
2. Create new Unit of measure: "Thousand(s) of units", with ratio 1000.0
3. Set accuracy for Unit(s), Thousand(s) of units, kg to 0.000001
4. Create two products: "parent" (UoM: Thousand(s)) and "child" (UoM: kg)
5. Create Bill of material: parent needs 0.12 of child
6. Add 10000 of child product to stock
7. Create manufacturing order for 100.123456 of parent product.
8. Click "Produce".

The decoration of the lines is incorrect.

This happens because of Float representation at the JavaScript level,
leading to comparison such as:

`12.014999...8 < 12.015000`

It's not possible to use some kind of rounded comparison. As a
workaround, we change the way the float are compared.

opw-2234824

closes odoo/odoo#49559

X-original-commit: f62c2b33fe834defb2c39988f3c9e90047a56d2c
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-14 15:54:17 +00:00
Nicolas Martinelli 414a0bac5a [FIX] mrp: partial production using all components
- Create a product P using one component C
- The BOM is flexible
- Create a MO for 10 units
- Product 9 units, but use all components
- Post the inventory

The MO is considered as done, while it should remain in progress.

This happens because the MO state is computed based on the move raw
state. In this case, it should compare the quantity produced and the
quantity to produce.

The material availability is set to `False`.

opw-2220855

closes odoo/odoo#49247

closes odoo/odoo#49526

X-original-commit: dd7ef482a1c41f271b133fbfcc3d389d16677da1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-14 12:00:59 +00:00
Tiffany Chang (tic) 306f6423f3 [FIX] mrp: customize unbuild form via manufacturing order
When unbuilding a manufacturing order, there are fields in the default
unbuild form that do not make sense to show (i.e. they already
correspond to the manufacturing order that is triggering the unbuild).
Therefore we make a simplified version of this form that is better
suited for a button generated window.

This change includes removing the resetting of 'location_id' and
'location_dest_id' when they correspond to the 'company_id' by onchange
function since this would overwrite any 'default_location_id' and
'location_dest_id' values when calling the view + this seemed like it
would be annoying if someone clicks on the same 'company_id' within the
dropdown and their location values changed.

closes odoo/odoo#49514

Task: 2234872
X-original-commit: d23341a5b4cb82f4a96b55464dec32dc28ce4351
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-14 11:24:48 +00:00
Pratima Gupta 55b8207b34 [FIX] mrp: set default company for stock production lot
Before this, unable to quick create production lot from
produce wizard in components, as default company was not
set correctly.

Fixes-2234784

closes odoo/odoo#49455

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-13 09:16:25 +00:00
Pratima Gupta d71d074082 [FIX] mrp: check availability button should be visible
Before this commit, check availability button was becoming
hidden, even if move is partially available on MO.
Fixed it.

Fixes-2234494

closes odoo/odoo#49381

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-10 09:23:36 +00:00
Julien Mougenot 48ee7272b6 [IMP] *: adapt qunit suite bundle inheritance
Since the test assets bundle name has been changed and its structure is different,
the inheriting assets need to be updated.

Task 2002399
2020-04-07 14:40:53 +00:00
Julien Castiaux ab4000fb3c [REF] base: Remove deprecated exceptions and osv
TL;DR: remember `osv` and `except_orm` ? You can forget about them.

* Deprecated `except_orm` dropped.
* `UserError` elevated as super type of all user-related
  errors.
* Unused `DeferredException` dropped.
* Unused `QWebException` dropped (real one is in `qweb.py`).
* `MailDeliveryException` made a python exception.
* `name` legacy exception attribute made an alias of the python standard
  `args[0]` attribute and deprecated.
* `value` legacy exception attribute dropped.
* `exception_type` RPC error response key dropped.
* Deprecated `osv` module dropped.
* `--osv-memory-age-limit` cli option made an alias of
  `--transient-age-limit` and deprecated.

The `odoo.exceptions.Warning` have long been a deprecated alias to
`UserError`. It is going to be removed in a future version but first we
explicitly deprecate it with a warning.

The `odoo.exceptions.DeferredException` was a very old internal
exception, it has been removed without deprecation notice as it is never
raised.

The `odoo.exceptions.except_orm` has been a deprecated exception type
with deprecation warning for 5 years, it has been removed in favor of
UserError which becomes the super class of all user-related errors.

The `odoo.base.models.ir_mail_server.MailDeliveryException` was
inheriting `except_orm`. As it is not related to a user error but is
more of a problem an admin much take care of, the exception has been
made a Python error.

The `exception_type` JSON key in RPC error responses was holding an
hardcoded value derived from the exception type. Its usage has been
dropped in favor of the `name` JSON key that holds the precise exception
name. Again as it was hardly used in the source code (beside the crash
manager) it has been dropped without deprecation warning.

Since we are here trying to clean odoo custom exceptions, we are also
deprecating the `name` exception attribute in favor of the more standard
`args[0]` attribute.

The `name` (along with `value`) were two attributes used to raise
`except_orm` exceptions before the introduction of `UserError`,
`AccessError` and related exceptions. The `name` attribute, at the time,
was holding the exception type/title. Nowadays it contains the error
message. The `value` attribute, at the time, was holding the error
message. Nowadays it is no more used.

The `osv` module contains very old deprecated aliases. There is no
simple way to log a deprecation warning for osv, osv_memory and
osv_abstract but as they have not been in use for ages, they have been
removed too. To be consistent, the `--osv-memory-age-limit` cli option
has been made a deprecated alias to the `--transient-age-limit`.

closes odoo/odoo#45723

Task: 2187728
Related: odoo/enterprise#9162
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-08 08:41:17 +00:00
Victor Feyens 5199d45760 [FIX] mrp: forgotten create decorator
Followup of
https://github.com/odoo/odoo/commit/58df6c86e06304b2c5f020e0fb93988e9e388fe0.

By default, the create, when not specified as `api.model`, supports
creation in batch (thus the batching opportunity isn't lost here).

BUT, if a create override isn't specified as `api.model` or
`api.model_create_multi`, it won't be accessible in rpc calls (because
the ORM thinks a record in self is needed).

It doesn't look like somebody can create stock move lines from the web
client itself, but it doesn't cost anything to follow the global api
(and it's clearer to clearly specify the create as create_multi).

closes odoo/odoo#48964

X-original-commit: a4fd8f8062046bcea97d9f7cfe300e19020cdecd
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-04-03 11:32:11 +00:00
svs-odoo 1b2b14879a [IMP] mrp: no help in workorder tablet view
For the `mrp.routing.workcenter`, removes the help from the `worksheet`
field to set it into the view.
This way, the tooltip doesn't appear each time the user cursor is placed
in front of the pdf in the workorder tablet view (`mpr_workorder`).

task-2225362

closes odoo/odoo#48903

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-06 06:24:03 +00:00
Nicolas Martinelli bc129637bb [FIX] mrp: False barcode
- Create a MO for a product tracked by S/N
- Perform the MO
- Print the 'Finished Product Label (PDF)'

The barcode printed is `False`.

If the S/N is not set on the `move_line`, we should fall back on
`lot_id.name`.

opw-2228337

closes odoo/odoo#48949

X-original-commit: fb69b5a99becd92ee0ee7698709da05a0b33850f
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-03 09:41:23 +00:00
Andrea Grazioso (agr-odoo) 9ae9e7e0a6 [FIX] mrp: fix bom products quantity calculation in list view
Go to inventory>product variants (list view), search for
'FURN_78236'.
Set quantity on hand (qty_available) 50
Now, back in list view, adjust your search to FURN_7

QTY on hand for FURN_78236 is 0.

This occur because during the computation of qty_available, the bom
kits (FURN_78236) are calculated first, but the qty_available depends
on the bom lines products, which are calculated only at the end.
Since qty_available became protected by the global environment, it
cannot be recomputed recursively and it is not in cache, thus is 0.

Making the simple products compute first in the _compute_quantity fix
the issue

opw-2226417

closes odoo/odoo#48924

X-original-commit: f41c650f162021bb6c76736c7dcbe4eee059cec1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-03 06:25:37 +00:00
svs-odoo c1f3596bd3 [FIX] mrp: create mrp.document through mrp.eco
How to reproduce:
  - Open PLM app, open an Engineering Change Order;
  - Click on "Update Documents";
  - Try to upload a document -> Traceback.

As we did not cast res_id as integer, the check method of ir.attachment
crashes when accessing company_id on a malformed recordset of ECO
because the domain generated by _filter_access_rules_python is:

  `['|', ('company_id', '=', False), ('company_id', 'in', [2, 1])]`

This route is also used when adding attachment to a `product.product`.
In this case the check didn't work either but somehow passed because no
domain is generated by `_filter_access_rules_python`.
The following snippet shows that if there was one, it would also crash:

```
In [16]: records
Out[16]: product.product('25',)

In [17]: records.stock_move_ids
Out[17]: stock.move()

In [18]: self.env['product.product'].browse(25)
Out[18]: product.product(25,)

In [19]: self.env['product.product'].browse(25).stock_move_ids
Out[19]: stock.move(41, 13)
```

task-2223153

closes odoo/odoo#48515

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-30 14:42:12 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
Arnold Moyaux 3c08091940 [FIX] mrp: stock.move with reference new
Usecase to reproduce:
- Create a MO as draft
- The stock move inside don't have a reference despite the MO name is
already set.

It happens because the reference and the group are set during the
action_confirm. However it's not great if the user takes time before
confirmation or if he cancels the MO. In those case the reference
on the moves remains 'new'.

opw-2201986

closes odoo/odoo#48568

X-original-commit: 1b7e304a907d8a43d5f561226028a4b353902fab
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-03-30 08:59:24 +00:00
Goffin Simon 2683b1f073 [FIX] mrp: Impossible to create a lot from MO
Steps to reproduce the bug:

- Let consider a user U from a single company C (Multi companies = False)
- Let's consider a BOM B for a finished product FP with product P1 as component and product P2 as byproduct
- Let's consider that P2 is tracked by lot
- Log as U and create a MO for FP
- Produce the MO

Bug:

A widard was opened but it was impossible to create a lot for P2

opw:2216028

closes odoo/odoo#48556

X-original-commit: 30ebdee091362b8c857bdcad2bdf44bd698572c4
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-03-30 07:07:09 +00:00
William Henrotin 5569768ec2 [FIX] mrp: create a bom with positive quantity
Creation of production order from a bom with 0 quantity to produce will
fail. As there is already a constraint on the quantity to produce on MO,
this commit adds the same constraint on BoM.

closes odoo/odoo#48485

X-original-commit: 1330500885ae096372ab32fba4ffc9db252dd2d4
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-30 07:42:38 +00:00
svs-odoo 4a93f93e40 [IMP] mrp: plan work order in demo data
Confirms and plans the manufacturing order created for table (MTO) in
demo data to have already a work order.

task-2199747

closes odoo/odoo#46464

Related: odoo/enterprise#8922
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-26 11:44:56 +00:00
svs-odoo 565379033c [IMP] mrp: make Table Kit as consumable
Task #1970460
2020-03-26 11:44:56 +00:00
svs-odoo 2589d66c62 [IMP] mrp,stock: tracked product always have SN/LN
Before this commit, some tracked product quantities didn't have a SN/LN.
To avoid some issue at the use, it's better all demo data fulfill
requirements like that.

Task #1970460
2020-03-26 11:27:45 +00:00
svs-odoo a05b21d74b [IMP] *: remove sublocation for demodata
Demo data product's quantities are no more put in sublocation as by
default, multilocation aren't active.

Also, adapts `test_location_usage` because as we moved quantities from
sublocations to the main stock location, the stock warehouse will have
reserved quantity due to a backorder created by demo data.
In this test, we try to change location as a scrap location, what we
can't do if this location has some reserved quantities.

Task #1970460
2020-03-26 11:27:45 +00:00
Arnold Moyaux d40e99e944 [FIX] mrp: add barcode for SFP and PC
Handle missing barcode for 'pick components' and 'store after
manufacturing' picking types

closes odoo/odoo#47201

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-19 10:45:25 +00:00
William Henrotin 389049102a [FIX] mrp, purchase_requisition: hide empty variant description
Commit abef168389 adds the fields
'product_description_variant' on mrp.production and purchase.requisition
models. This text is taken from the product variant.

This commit make them invisible in case they are empty.

closes odoo/odoo#47716

Related: odoo/upgrade#948
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-24 11:08:12 +00:00
William Henrotin 1093baa29a [REM] mrp: remove unused field
Task : 1966889
2020-03-24 11:08:12 +00:00
Nicolas Martinelli 0d16e7331c [FIX] mrp, mrp_subcontracting: clean-up routes at uninstall
When `mrp` or `mrp_subcontracting` are uninstalled, the routes used as
'Picking Before Manufacturing Route' and 'Resupply Subcontractor' are
kept active. When the modules are re-installed, the routes are created
again, and appear duplicated.

The routes should be deleted if they are not used anywhere else.

opw-2222895

closes odoo/odoo#48206

X-original-commit: ce219b8375dc14daf9d380433d254b622a947773
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-23 14:18:10 +00:00
Nisha patel e428d473c3 [IMP] various: Allow to select only internal users on m2x field with res.users
Purpose of this task is to prevent users from setting portal users on
internal documents by mistake, and preventing noise and performance
issues resulting from loading all the portal users in those fields.

This commit fixes internal many2x fields to res.users which are now
restricted to internal users by setting domain (share=false) on form view.

closes odoo/odoo#47553

Taskid: 2172779
Related: https://github.com/odoo/enterprise/pull/9204
Related: odoo/enterprise#9204
Closes: #47553
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-16 10:28:35 +00:00
Odoo's Mergebot fd113d48a2 [MERGE] *: ir.rule declaration cleanup
* remove global assignation in xml, it is a computed field anyway, let the orm compute it
* put all `ir_rule` definition as noupdate in the xml

closes odoo/odoo#47688

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-20 17:24:11 +01:00
Victor Feyens 532c083cbb [IMP] *: remove global field definition in ir rules xml
It is a computed field, there is no need to manually set its value.
2020-03-20 16:15:40 +01:00
Helly kapatel 1c9a6db16f [IMP] various: Change 'assignation' to 'assignment' across all modules
Purpose
=======
The main definition of 'assignation' is the following:
   "an appointment to meet someone in secret, typically one made by lovers"

The correct word we should be using is 'assignment':
   "the allocation of someone or something as belonging to a particular group or category"

So in this commit change every iteration of the word
'assignation' to 'assignment', across all modules.

closes odoo/odoo#45041

Taskid: 1966215
Closes: #45041
Related: odoo/enterprise#8375
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-20 14:12:51 +00:00
Rémy Baranx (bar) bbd4391c15 [IMP] various: update of documentation links in res.config
Purpose
=======

- Change the font-awesome icon from fa-book to fa-question.
- Change the icon color to text-secondary (the same than the multi-company
  icon).
- Adjust the icon size to the uppercase text size.

closes odoo/odoo#47210

Taskid: 2209062
Related: odoo/enterprise#9116
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-18 09:53:15 +00:00
Nicolas Martinelli 17e12603a2 [FIX] mrp: dynamic attribute
- In inventory app, create an attribute that is dynamic
- Create a product with a variant with the dynamic attribute
- Create a bom for the product with some specific component for that variant
- Open structure and cost

A crash occurs.

In this case, the object is a `product.template`, so a condition
product-specific shouldn't be checked.

The template is set at:

https://github.com/odoo/odoo/blob/3588487ab4ef867f7fb981a395deaf298eb4a4e4/addons/mrp/report/mrp_report_bom_structure.py#L107

opw-2198976

closes odoo/odoo#47769

X-original-commit: 3c476dee5d3a0cc0fde0f9c6620507a07929e4fc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-17 09:24:01 +00:00
Arnold Moyaux 343e46d97f [FIX] mrp: modify linked move remove quantity done
- create product comp1
- create product finished1
- created bom: 1 comp1 for 1 finished1
- activate PBM
- 100 units of comp1 in stock
- create an MO for 5
- on the pbm, deliver 3 and no backorder
- on the mo, check availability, produce 3
- on the pbm, unlock, change delivered qty from 3 to 5

On the mo, the raw move is reserved to 5 units but the 3 units
used in the first produce are removed.

It happens because editing the quantity or initial on a move
will try to reserve the next moves. In order to reserved,
_do_unreserve will destroy the stock.move.line and _action_assign
(call just after) will recreate them in order to regenerate the
reservation. In the process the qty_done on the stock.move.line will
be loss. We want to avoid this behavior in mrp so we call
_decrease_reserved_quantity from mrp that will keep stock.move.line
with quantity done.

opw-2206472

closes odoo/odoo#47617

X-original-commit: c6cf5841015c87163f8ea16dd75232e5cb855df6
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-03-13 15:25:19 +00:00
Julien MougenotandMathieu Duckerts-Antoine e68d3bb09d [REF] *: Adapt all modules to new control panel
Adaptation of the code throughout all modules to properly instantiate the newly
refactored control panel and update it accordingly.

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 14:08:33 +00:00
yhu-odoo b08e3d114a [REF] stock,stock_account: archived products and quantities
PURPOSE

Keep consistent behavior of the stat buttons and the different stock
reports when archiving a product

SPECIFICATION

Currently, you can archive a product but the behavior of the different
stock reports, stat buttons isn't coherent afterwards. Here are the
different behaviors that should be improved:
1.Keep quantity on hand and forecasted quantity visible (in the stat
button + when opening it)
2.Automatically (un)archive RR and BOM if the product is (un)archived
3.Valuation report: show the archived products without the "archived"
filter (behaves already this way in the inventory and forecast reports)
4.When a product has been archived and still has quantity in stock,
include it in inventory adjustments for which counted quantity = default
to stock on hand (dont do so for archived exhausted products).

Also, revert #47478 since we don't have active field.

LINKS

Task 2178269
PR #45586
Fixes #41634

Related: odoo/upgrade#811
Related: odoo/enterprise#8513
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-13 08:37:26 +00:00