Commit Graph
411 Commits
Author SHA1 Message Date
Nicolas Martinelli d1a0601660 [FIX] mrp: display human readable lot
Display the readable value of lot name in the Production Order report.

opw-2178868

closes odoo/odoo#43990

X-original-commit: 7e82b77a80fe70da45676fd87a458ffe9948e48d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-27 10:52:58 +00:00
jdoutreloux 52ed0be17e [IMP] uom : remove 'measure_type' field
This removes the measure_type field which has become unused and
causes issues when users try to add new uom categories.

Task-2043927

closes odoo/odoo#41056

Related: odoo/enterprise#6945
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-13 11:19:17 +00:00
Kevin Baptiste 6cbe824871 [REV] web: reverts update to fontawesome 5.11.2
This reverts commit ff1c35513a.

closes odoo/odoo#41480

X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc
Related: odoo/enterprise#7110
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 10:33:36 +00:00
Kevin Baptiste ff1c35513a [IMP] web: update to fontawesome 4.7.0 to 5.11.2
FontAwesome 5 introduced new names for some icons as described on
https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes

This commit replaces the old names to the new ones.

closes odoo/odoo#35826

Taskid: 2050241
Related: odoo/enterprise#5180
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28 10:05:12 +00:00
Victor Feyens 9215e73fa2 [IMP] * : replace with_context(force_company=c) by with_company(c) 2019-11-18 12:25:05 +00:00
Nicolas Martinelli 46ef76555f [FIX] mrp: print barcodes
- Create a product A with a barcode, UOM as 'Unit(s)' with a BOM
- Create a MO for A with more than one unit, validate
- Print the 'Finished Product Label (PDF)'

A single label is printed for all units, although it is not logical: a
label should be printed for each unit, as already done for the Zebra
labels.

In case the product UOM is 'Unit(s)', we print a label per unit. To do
so, we use a template similar to `label_transfer_template_view_pdf`.

opw-2091663

closes odoo/odoo#39311

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-10-24 09:34:11 +00:00
Dharmraj Jhala 30b1af7937 [IMP] * : enable static string edition using report editor
*:
	delivery
	hr_timesheet
	mrp
	sale
	sale_coupon
	stock

This commit makes the static strings / labels editable with studio
by wrapping them in appropriate tag (mostly span) whenever needed.

Task-Id 2030430

closes odoo/odoo#34685

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-10-17 09:39:01 +00:00
Simon Lejeune 96406dc2a9 [REF] mrp: multi company
Ensure proper domains are applied and enforced on relation fields thanks
to the `check_company` attributes.

Make sure unbuild have proper sequence for each companies.

The produce wizard and workorders company is the one of the production.
The BoM line company_id is the one of its bom_id.
Added some tests.

task-1985992
2019-09-03 15:05:03 +00:00
Kaushalya Mandaliya 03c2083890 [FIX] mrp: traceback while printing BOM structure report
From the commit: 36b976ccee
A traceback is generated while printing BOM structure
report, which is fixed in this commit.

task-2024247
closes: #34899

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-07-30 10:33:16 +00:00
Arnold Moyaux dc35b88411 [DEL] stock, mrp: remove report forecast
It will be replaced by an easier report that will
dispaly the cumulative forecast and the planned in/out
moves.
2019-07-16 08:26:54 +00:00
Christophe Simonis 5548029fb7 [MERGE] forward port branch saas-12.4 up to 5e81b18e24 2019-06-27 20:51:59 +02:00
Christophe Simonis 5e81b18e24 [MERGE] forward port branch saas-12.3 up to 0247d2f35f 2019-06-27 20:45:52 +02:00
Christophe Simonis 465909f0fd [MERGE] forward port branch 12.0 up to cd21c016b0 2019-06-27 18:01:07 +02:00
Jorge Pinna Puissant 044c5c2c81 [FIX] mrp: BoM structure report with variants
1. Setup a few variants for a product;
2. Create a BoM for each of the variants with different
components/quantities, make sure to specify the product variant field;
3. Go to any of the variants and click Print BoM Structure.

Before this commit, it will print the BoM structure for all variants and
not only the one selected. Also, it will print in all the variants the
same BoM structure. If multiples BoM were selected to print, each
variant of the product was printed with each of the BoM structure
selected.

Now, if you select one BoM, only this is printed. If multiples BoM are
printed, each product, and product variant are correctly related to
their respective BoM structure.

opw-2007939

closes odoo/odoo#34353

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-06-25 08:42:27 +00:00
Ankita Raval 5a34d64a44 [FIX] mrp: bom structure report
The "BoM Structure report" should not include the cost of the products
as it is often shared with third parties. We now only display the cost
on the "BoM Structure and Cost report" and remove the "BoM Cost report"
as it is redundant with the former.

Task Id: 1969709

closes odoo/odoo#33323

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-11 12:39:15 +00:00
Yannick Tivisse f5dfe4727c [IMP] api.py: Rename company_id/company_ids into company/companies
The goal is to be coherent with the user property.

Actually, company_id and company_ids on the environment are no fields.

Calling env.company_id returns a browse record, not an id.
2019-05-29 08:09:15 +00:00
Arnold Moyaux 2843dcfaa0 [FIX] mrp: print selected quantity
When using the print unfolded button, it will print only 1 product
and not the selected quantity on the report.

Task: 1939278

closes odoo/odoo#32340

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-06-11 12:44:51 +00:00
Arnold Moyaux 36b976ccee [FIX] mrp: display all information for pdf
mrp_plm in OE uses the child_bom and prod_id from lines obtains
by _get_pdf_line in the case of a pdf report. It was already pass
by _get_bom_lines with the html report. It implies that the pdf and
html report could be different.

Task : 1939278
Closes #32340
2019-06-11 12:44:14 +00:00
Christophe Simonis 243a4ae5cb [MERGE] forward port branch saas-12.1 up to 330b99f60c 2019-05-10 15:20:01 +02:00
Christophe Simonis cc3a2c1bf3 [MERGE] forward port branch 12.0 up to e11bacfe51 2019-05-09 21:07:44 +02:00
Jorge Pinna Puissant 97b44806f5 [FIX] mrp: recursive bom with different quantities
Having 4 products and 3 BoMs:
BoM 1:
 product = Finished
 quantity = 100 units
 - Semi-Finished 10 units

BoM 2:
 product = Semi-Finished
 quantity = 10 units
 - Assembly 10 units

BoM 3:
 product = Assembly
 quantity = 10 units
 - Raw Material 10 units (product.product 5$/unit)

Before this commit, the price for 100 units of Finished product was
500$, which is wrong. The price was calculated using 100 units of
Semi-Finished product and not 10 units as it should be.

Now, the price is 50$

opw-1973347

closes odoo/odoo#33115

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-05-03 11:02:35 +00:00
Christophe Simonis 8dd5a85267 [MERGE] forward port branch saas-12.3 up to 60e71302a3 2019-05-13 15:26:12 +02:00
Yannick Tivisse a5b6f31cf2 [IMP] base: Contextualize the multi company
Purpose
=======

Allow the user to select the allowed companies for which he wants to see records
on top of selecting his current company.

It is confusing for users to see the records from the company he is connected to
and the records of the children companies.

Instead of using the hierarchy of companies to access records across companies,
the user can now select (from his set of allowed companies) the companies for
which he wants to access records.

/!\ This means that the user will interact with records from company A when in
company B.
Example: a SO has been created and confirmed in A. When in B, I create the
invoice from it.

Specifications
==============

1/ Deprecate the parent/children hierarchy on the res.company model. The fields are
kept on the res.company model to ensure the retro-compatibility, but won't be used
accross the standard code anymore. The only functional usage for this mechanism
was to allow to see records from several companies by creating a virtual parent
company, which will be possible with the new mechanism.

2/ By default, a user will only see the records of the company he is connected
to (or records without a company). (It is still editable by the user if needed).
For that, put this information in the user context, to allow having different
configurations on different browser tabs. Instead of having domains like
['|',
('company_id', '=', False),
('company_id', 'child_of', user.company_id.id)]
you'll have something like
['|',
('company_id', '=', False),
('company_id', 'in', company_ids)]
Note that the 'company_ids' is a value that is passed in the evaluation
context on the record rule, as we already have user, or time.
company_ids is a list of the ids of all the enabled companies in the
user's context.

3/ Out of the generic improvements brought by this task, this will illustrate
issues that could exist since several versions. For example, it should not be
possible to create a scrap order for the company A with a package of the company
B, or it should not be possible to create an invoice on the company A with
payment terms from the company B. Before the version 12.0, it was easy to
encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side
effect of the fact that the SUPERUSER_ID has become an inactive user was to
make it more difficult to introduce mismatch on the records, but haven't solved
the issue, as it was still possible to do it with parent companies
configuration. Some of these issues have been fixed in this commit, but all the
business flows should be re-tested to check if an ir.rule should be introduced
(eg: a multi company rule for stock.quand.package), if the company of a record
is correctly transfered to another record created from the first record (eg:
From a SO, create an invoice and a payment, the company of the sales order
should be transfered on the invoice and the payment, even if the company of the
sales order is A and I'm logged into the company B with the company A enabled.

4/ Currently, if I click on a button on a notification email (example 'View
Task'), I face a traceback if I'm not logged into the company of the record.
Now, if you click on a button and if you have access to the record, the correct
company will be automatically set.

5/ If I display a kanban view with several records from several companies (and
an image), all the images should be displayed.

6/ Currently if you copy paste an url, this will crash if you're not in the
correct company. This won't be fixed because it's quite impossible to do it in
a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into
the correct company, re-copy/paste -> Ok.

7/ 2 property methods have been added on the environment to retrieve the company
on which the user is logged in and the companies the user enabled, on a specific
tab.
That way, when creating a record, instead of doing
default=lambda self: self.env.user.company_id
do
default=lambda self: self.env.company_id
On the other hand, to retrieve the enabled companies, do
companies = self.env.company_ids

8/ Modify the Company Switcher widget to allow to log into another company
WITHOUT writing on the res.users (and thus bringing cache invalidation issues
and so on). Also allow to enable several companies and see records from several
companies, and independantly of the other browser's tabs.

9/ When focusing on a tab, save the current company configuration on the local
storage. That way, when doing 'CTRL+T' or a middle click, the context is
propagated to the new tab.

10/ Improve the error message in case of multi company access errors. Now, when
the user is in debug mode, display the related names of the records and the name
of the user who brings the issue.

11/ Remove the context erasing when writing on a res.users
This is probably coming from the migration to new API of the base module.
The context was not propagated at this moment, which was a common mistake at
that time. When migrating the module, probably by using the 'black box' method,
as the context was not propagated, it was erased on the new version. This is
now an issue because the context (i.e. the enabled companies) was erased when
writing on a res.users, leading to tracebacks.
See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624

12/ Fix the crash manager on redirect warnings. The issue is the following
- Create an invoice on a company without a configured CoA.
- Set a partner
- On the onchange_partner_id, a redirect warning is raised to propose you
to configure a CoA
- Click on 'Go to the configuration panel'
- A generic warning says something like 'Do you want to discard your changes?'
- Click on yes, the page refreshes, but not on the redirect action.
Now, set correctly the action on the hash, and reload instead. The breadcrumb is
lost for example, but you reach the correct action at least.

13/ Introduce a res.group to enable/disable the multi company per tab
feature.

14/ To help the users to know which tab is in which company, add the
possibility to have a favicon per company. When creating a company,
the classical 'O' icon is colored by default in a random color.

15/ Remove the company switcher on the frontend. This was mainly there
to allow a user to swicth to the company linked to the website.
This behavior is now transparent to the user. If the website A is
activated, then the company set on the context is the company of the
website.

16/ Deprecated the _company_default_get method on the res.company
model. Remove the method _get_company on the res.users model.

17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval
context. You can now use those variables on domains in the views to
access directly to the activated company.ies on the current tab.

TaskID: 1960971

closes odoo/odoo#32341

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-13 08:57:49 +00:00
Rishabh Jadia 3ace78f63c [IMP] mrp: MO printing not based on reservation
A MO printing was based on stock.move.line with the reserved lot/sn and
the pickup location. However in order to have stock move line, the MO
has to be reserved. Also a partial reservation would result with a print
that only contains the reserved product and the other product were
ignored. Since v12, the picking before manufacturing exist and the
picking operation display the same information than the current MO
report. The purpose of this commit is to only display the useful
information to the manufacture user (the product and the quantity he
needs). The location and lot should be in the PBM document.

It also remove duplicate information like print date which is already
present in the header.

Task id #1931811

closes odoo/odoo#31338

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-05-10 11:39:33 +00:00
Christophe Simonis 2a06f4dcf3 [MERGE] forward port branch 12.0 up to 09fb2469b4 2019-03-29 18:10:57 +01:00
Goffin Simon 72932d7956 [FIX] mrp: Printing a BOM with a variant
Steps to reproduce the bug:
- Create a BOM for product P
- Generate variants for P: P1 and P2
- Go to BOM of P and click on Structure & Cost
- Change the current variant to P2
- Click on "Print"

Bug:

A traceback was raised because the function _get_bom expects in arguments that
product_id is an id and not a recordset.

opw:1950401

closes odoo/odoo#32128

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-03-26 12:46:02 +00:00
Christophe Simonis 28cce6ce3a [MERGE] forward port branch saas-12.1 up to c0cf4049b2 2019-03-29 19:47:46 +01:00
Christophe Simonis 93d736e905 [MERGE] forward port branch 12.0 up to 6e8dff1952 2019-02-11 16:17:02 +01:00
Arnold Moyaux 9f5de8b116 [IMP] stock, mrp: report forecast cell clickable
closes odoo/odoo#30464
2019-02-12 12:12:14 +00:00
Christophe Simonis 8c29df10e0 [MERGE] forward port branch saas-12.1 up to 93d736e905 2019-02-11 17:00:35 +01:00
Nicolas Martinelli afc5ec8bdf [FIX] mrp: cost and attributes
When retrieving the BOM lines in `_get_bom_lines`, we check the product
attribute values to know if the BOM line should be taken into account or
not. However, we do not do such a check when we retrieve the price in
`_get_price`.

It can lead to an inconsistency between the sub-lines displayed and the
total price.

We need to apply the same filtering logic when getting the price.

opw-1932437

closes odoo/odoo#30917
2019-02-08 13:49:49 +00:00
Christophe Simonis 87924cb5ad [MERGE] forward port branch 12.0 up to a46138cb01 2019-02-07 13:14:02 +01:00
Nicolas Martinelli 85ada6ff6d [FIX] mrp: PDF of BoM structure
- Create the following BOM for 1 Unit of A:
  B: 55 Units
- Create the following BOM for 728 Units of B:
  C: 1 Unit
- Create the following BOM for 1 Unit of C:
  D: 728 Units
- Go to 'BoM Structure & Cost' of A:
  A: 1 Unit
     B: 55 Units
        C: 0.0755 Units
           D: 58.24 Units
- Print Unfolded:
  A: 1 Unit
     B: 55 Units
        C: 0.0755 Units
           D: 40040 Units

The unfolded PDF structure is incorrect.

The reference quantity taken into account to compute the BoM subline
should be the quantity on the line, not the quantity on the parent line.

opw-1915546

closes odoo/odoo#30726
2019-01-31 12:03:44 +00:00
Hardik Prajapati 81c090751f [FIX] mrp: Barcode on Manufacturing Order Report
opw-1925956

closes odoo/odoo#30304
2019-01-17 12:17:33 +00:00
William Henrotin 6118b7a4a4 [IMP] mrp: missing pdf report
On a manufacturing order, there is no way to print a pdf report that
gather all finished products. This new report show product, quantity as
well as the lot barcode and name.

Task : 1923216

closes odoo/odoo#30011
2019-01-16 07:08:30 +00:00
Christophe Simonis a337b9ec92 [MERGE] forward port branch 12.0 up to f854e01a98 2019-01-18 14:26:33 +01:00
Christophe Simonis cf52a04979 [MERGE] forward port branch saas-12.1 up to d3b8422c9c
closes odoo/odoo#30614
2019-01-28 13:58:11 +00:00
Dipalee Bhalodia 78ab56e797 [MOV] stock_zebra,stock: Move reports from stock_zebra to stock
All the reports and test file from stock_zebra to stock  and mrp_zebra to mrp

closes odoo/odoo#27676
2019-01-22 11:38:56 +00:00
Haresh Shyara 7997f3b00f [IMP] mrp: replace _get_bom_reference by an xpath
In the BoM structure and cost report the purpose of _get_bom_reference
was to add content with an override in order to display it directly in
the column BoM. It could be improved by using the classic display name
and add a name to column in order to use an xpath in another module.
The function _get_bom and _get_bom_line can also be used in order to
introduce extra content directly in the column added with an xpath.

Task ID : 1875677

closes odoo/odoo#26493
2018-12-11 16:21:05 +00:00
Pierre Masereel ee1ea10c8c [IMP] stock, mrp, repair: production location for each company
Each company should have its own production location to allow specific
account on it.

TASK-ID: 1882269
2018-11-14 10:52:03 +00:00
Jorge Pinna Puissant d80b607aa2 [FIX] mrp: bom structure & cost report indentation
When a product's name is too big, in the structure & cost report, the
product's name line go to the line automatically.

Before this commint, the indentation applied on the products in the
report was only applied on the first line of the product's name.

Now, the indentation is applied on all the lines of the product.

opw-1966440

closes odoo/odoo#32945

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-04-25 09:14:13 +00:00
Christophe Simonis 3b3a65bef0 [MERGE] forward port branch saas-11.4 up to dc35de9d30 2018-11-06 14:12:51 +01:00
Arnold Moyaux ba239e4cac [FIX] mrp: subproduct price + rounding
On the BoM structure report the price on line with a
child BoM is inchoerent. Also the sum of all lines in
the report is not always equals to the total of the parent
line.

For the first issue, it happens due to commit 17b6256955
that use the number of operation cycle as quantity.
The second issue happens because sometimes the rounding is not done
at the smallest level and thus the rounding of the sum is different than
the sum of the rouding.
2018-11-05 10:02:09 +01:00
Christophe Simonis b81c2bce84 [MERGE] forward port branch saas-11.4 up to 3c108977c1 2018-10-22 16:59:51 +02:00
Arnold Moyaux 17b6256955 [FIX] mrp: bom structure in batch
Usecase to reproduce:
- Create a BoM that create more than 1 finished product
- Use a routing
- Open the BoM structure report

The operations time from the routing are multiplied by the quantity show
on the report.

It should not happen since routing's operations are not by unit.
If a user create a BoM that produce 50 finished products then the
operation time is always the same when the user produce between 1-50
units. It then double from 51-100,... (workorder use the same process
for the expected duration).

This commit fix this behavior by using a rounding up on the
quantity asked on the report / BoM product quantity.
It also take care of the workcenter capacity.

opw-1890005
2018-10-15 13:04:49 +02:00
Swapnesh Shah 87a9780270 [FIX] mrp: print bomstructure report with float quantity
Usecase to reproduce (chrome):
- Create a BoM with float quantity in component
- Print the BoM cost and structure report

When using a type="number" on firefox it is not possible to use a
decimal. However on chrome there is no restriction and a decimal
could be use. It makes senses to be able to work with decimal
(e.g. the UoM is in kg)

It also exists an explicit cast to integer since data are received as
string from the javascript. However since quantity displayed could be
decimal, the cast should be adapted to float.

Closes #27464
Fixes #27437

closes odoo/odoo#27522
2018-10-08 09:33:04 +00:00
celm1990 fc411ceb19 [FIX] mrp,stock_account: correct external ID
Following changes made at 6a378e3839

Closes #27322
2018-10-05 11:04:53 +02:00
Yannick Tivisse eaba05b9ae [FIX] sale,stock,account,...: Use groups in views only if they exist
Purpose
=======

They are a lot of places where we set an attribute 'groups' on a view element and:
- The group doesn't exist anymore
- The group xmlid is not correct
- The group xmlid exists but the modularity is not respected (example: group_stock_user
  used in a view in the 'product' module).

Where it happends, nothing warns the user of the developer. The element is just never
rendered.

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

Fix the occurences of bad groups definition
2018-10-02 12:35:34 +02:00
Christophe Simonis 43b63a0465 [MERGE] forward port branch saas-11.4 up to 57e387b645 2018-10-01 16:01:54 +02:00
Martin Geubelle fc268a37dd [FIX] mrp: correctly define BOM structure report
Calling `html_container` is not only useless when using the `basic_layout`
but it's also dangerous because it is already present in the latter.

The assets will be added twice in the report (once in the head and once in
the body).

Morever, the <base> tag was added in the report ; this tag is only useful when
rendering the pdf version, which uses minimal_layout that already set the
<base> tag ; this tag can only be present once in an HTML document so it has
been removed from the BOM report.

This results in a report not being editable by Studio.
2018-09-27 12:29:12 +02:00