Commit Graph
36 Commits
Author SHA1 Message Date
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Touati Djamel (otd) 6b0c82ccd1 [FIX] uom: add sudo when accessing ir.model.data
Steps to reproduce the bug:
- Create a user with only  "Inventory/Administrator" access right
- Connect with this user
- Go to Inventory/Configuration/UoM Categories
- Try to add/delete/change any unit of measure in any category

Problem:
an access error is triggered `You are not allowed to access 'Model Data'
(ir.model.data) records.`

opw-2905840

closes odoo/odoo#96137

X-original-commit: 8e58feb6e6151db8e47af4f296d5eb552532cb29
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-07-18 17:11:55 +02:00
Touati Djamel (otd) ba85494235 [FIX] uom: keep the current factor instead of setting it to 0
Steps to reproduce the bug:
- Create new UOM categories
- Add a new reference UOM
- Add another line, for example:
    - type: “Smaller than the reference”
    - Ratio: 4
- Click outside the line

Problem:
The type is changed to “Bigger” and the ratio is reset to 0,
because we are trying to change the type and the factor based on the value of the current uom factor,
but as this factor has not yet been calculated in `set_ratio` the changes will be distorted.

This part of the code in the onchange is useful when for example we already have a UOM category saved,
and we change the reference, in this case all the UOM will have to be calculated again

Solution:
Don't change the factor and the type in the onchange if it's a new line

opw-2754303

closes odoo/odoo#85214

X-original-commit: daf0dd44345de9877e2e79035d05ddca6c19064b
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-02-23 13:58:12 +00:00
Vishal Thacker b1e328d369 [IMP] uom: set one unit as a Reference Unit
Before this commit, the user was able to change the UoM type from
"Reference Unit" to "Bigger" or "Smaller" and let an UoM category with
no reference.
So, to force UoM category to have at least one Reference Unit, the user
can't change the reference unit if there is no other unit set as
reference.

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:24 +00:00
Ivan Yelizariev 0f91970020 [FIX] uom: avoid unneeded qty conversion and fields fetching
This could save some time when `_compute_quantity` is used thousands times in
request and there are thousands UOMs in the system

* if qty is zero, then result is zero
* if to_unit is the same, then result is `round((qty / factor) * factor) = round(qty)`

---

opw-2549026

closes odoo/odoo#72582

X-original-commit: a122db226cdf801675daaee5a69bcb47a47ab174
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-06-22 19:00:33 +00:00
JF Aubert 6f182eeeab [FIX] stock: allow change of reference unit of measure
closes odoo/odoo#57485

Related: odoo/enterprise#17365
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-04-14 13:14:10 +00:00
Adrian Torres 679185f3e8 [IMP] *: replace all raises inside unlink by api.ondelete
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
2020-12-04 09:16:16 +00:00
Victor Feyens ab76c421c2 [IMP] uom: protect/warn against uom changes/deletion
1) forbid deletion of main uoms & categories

2) warn modifications of main uoms data.
Except for the working Hours uom, which isn't a strict UoM
representation and could change between countries (and/or be deleted).

3) Also move the Dozen UoM to demo datas, it's a confusing UoM and isn't
used by the majority of databases.

4) Restrict deletion of used uoms on main models.
On sale orders and account moves the uoms couldn't be deleted thanks to the
SQL constraint covering the display_type logic, but the generic error message
is more clear for a user when deleting an uom.
2020-11-27 16:10:01 +00:00
Martin Trigaux 2683184aa6 [FIX] *: fix all the typos
And other reported English mistakes in source string
Courtesy of Transifex translators

And remove leftover from gengo

closes odoo/odoo#59022

X-original-commit: 26efc84c5cac47a2cc83d7b084f8b71528fec6c7
Related: odoo/enterprise#13781
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-05 09:36:34 +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
Simon Lejeune 80b55624c8 [FIX] uom: _check_category_reference_uniqueness
Edit the liters uom (default in its category) and change its category to
unit. You now have two references uom in the unit category. Try to set a
third one and now it fails.

This was because the constraint is implemented with an sql query but
since the new ORM the update in database are delayed. We force a
database update with flush so that the query gant get all the
informations it needs.

closes odoo/odoo#41621

X-original-commit: 68ced7972db64b22a4ff031bba0f78c06a88372d
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-10 09:02:53 +00:00
Kevin Baptiste f23cc14d13 [IMP] purchase: improve usability (back2basics)
TaskID: 2040826

closes odoo/odoo#35394

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-06 13:05:32 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Martin Trigaux 64907ba7aa [MERGE] forward port from saas-12.4 to master up to b27c145cf2
closes odoo/odoo#34697

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-09 12:28:03 +00:00
Adrian Torres 9e71d57d11 [REM] *: remove calls to api.one and adapt code
Adapt all code that was using `api.one` to recordset-style method and
remove any and all calls to `api.one` in preparation for its removal.
2019-07-05 09:04:45 +00:00
jem-odoo a766f5b7c1 [REV] uom: introduces duration unit of measure
This reverts commit 43d51466c8.
Reasons:
- too complex having 2 UoM "Hours"
- impossible with UoM to modelise month: is that 30 days or 31 ?

Task-1971491

closes odoo/odoo#34497

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-07-02 08:50:37 +00:00
Christophe Simonis 25e3f27062 [MERGE] forward port branch saas-12.3 up to 48a9f5a633 2019-06-17 13:20:35 +02:00
Nans Lefebvre 9ff767ec64 [FIX] uom: fix nonempty reference constraint on uom categories
What's the deal with SQL queries?
The query in _check_category_reference_uniqueness returns:
category_id | uom_count
-------------+-----------
(0 rows)
but if we removed AND U.active = 't', we would have had:
category_id | uom_count
-------------+-----------
8 |         0
(1 row)
As a result, the check on uom_data['uom_count'] == 0 could simply never be true.

opw 1959679

closes odoo/odoo#32788

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-06-12 11:31:16 +00:00
jem-odoo 43d51466c8 [IMP] uom: introduces duration unit of measure
This commit introduces the duration (time) units of measures, flagged as internation
unit of measure. We already have the "working time" UoM, but those ones are customizable
and might differ from the International System of Units; indeed, one working day means
8 hours (more or less) for some company.
The rational here is, when we are handling datetime, we need to get the UoM in the Odoo
System to convert the result; for instance, computing the difference between 2 datetimes
will return the number of days (or hours). But you need to match it with an odoo UoM to
extract informations from that value.

This unit of measure 'duration' is like a master data, because existing in the real world
and that many module will depend on.

Task-1971491

closes odoo/odoo#32840

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-05-14 12:26:41 +00:00
Victor Feyens 59059a480f [IMP] uom: rename measurement type 'time' into 'working_time'
This commit rename the measrurement_type 'time' into
'working_time' to be more precise, as time might means
duration.
This changes prepare the distinction between 'working time'
and international duration unit.

Task-1971491
2019-05-14 12:26:41 +00:00
Christophe Simonis 86ff929ad6 [MERGE] forward port branch saas-11.4 up to 1199451606 2018-09-10 17:06:18 +02:00
Yannick Tivisse 7978d4ba0f Revert "[IMP] *: Define groups on res.users models"
This reverts commit 99f497b390.
2018-09-10 14:23:42 +02:00
Prakash Prajapati 86d10380a1 [REF] barcodes, delivery, mrp, product, stock: Changing labels
Task: 1879617
2018-08-30 17:24:24 +02:00
jem-odoo 02645a6005 [IMP] uom: sql constraint is better than python one
Since we got 2 constraints checking the same
thing (one python, one sql), it is better
to remove the python one, which is not
very performance friendly in case of huge
import.
2018-08-23 17:28:07 +02:00
jem-odoo 69a898cf8b [IMP] uom: add constraints to force reference factor
When importing big amount of data, user can import
a list of uom. There is no constraint in Odoo to
force the factor to be equal to 1.0 for the reference
UoM in a category.
Onchange is not enought to ensure that constraint,
so this commit adds one in SQL for data intergrity
and to avoid problem in '_compute_quantity'
method.
2018-08-23 17:20:47 +02:00
Florent de Labarre d5357e4488 [IMP] uom: force factor to be 1 if reference unit
The _onchange_uom_type was already making sure it was the case but this
constraint ensure it is always the case.

Closes #25465
2018-08-23 16:29:21 +02:00
jem-odoo 3592dbd035 [IMP] uom: prevent time uom deletion
Time UoM are almost Master Data for timesheet modules.
Some user remove those before installing timesheet modules, making
it impossible and crashing (as some field required a time UoM to be
set at installation).

Since we don't want to hardcode xmlids of 'Hours' and 'Days' time
UoM, we rather prevent the deletion of such UoM in the system.
The UoM can be desactivate to avoid having plenty of them in system
in use.

Task #39079
2018-08-13 14:33:48 +02:00
Nirali Sapra 23415c2b52 [REF] uom: Change constraint message
When an uom is created with a rounding of 0.0, an error message
is triggered, we improved this message.

TASK-60709
2018-08-09 13:30:39 +02:00
Raphael Collet 896e36edab [REF] *: adapt create to work in batch 2018-07-24 16:58:14 +02:00
Hetashree Chauhan 06a804596e [REF] stock,uom: error message more clear
Change to more understable error messages

TASK-1841502
2018-06-18 16:49:16 +02:00
Yannick Tivisse 99f497b390 [IMP] *: Define groups on res.users models
The reified view on the res users will be dropped in the following commit.

The previous commit adds support to define each group as a computed field on the res users.

This commit defines:
- A boolean field for each 'isolated' res.group, i.e. a group in the hidden category.
- A selection field for each 'Application' res.group, i.e. a group in a application category.

Example:
- The group to manage pricelist in sales becomes a boolean field
- The groups project user/manager become a selection field
2018-04-26 15:13:38 +02:00
jem-odoo fb323d0068 [FIX] uom: avoid context key, and rather use parameter
When converting UoM, the conversion can fail if the source and destination
uoM are not in the same category. By default, and error is raised, but using
a context key, we can receive the initial quantity.
To avoid the context key (which is not used anymore), we prefer use a dedicated
parameter to be more explicit.
2018-04-16 14:32:25 +02:00
jem-odoo e0ed50a724 [IMP] uom: unique reference UoM per category
Users can configure multiple references in a same
category. This might cause problems during conversion
and does not make sense.
Since this is a "late" constraint, we define it in
python to avoid conflict with existing data.
We allow user to have multiple unactive reference, but
force to have exactly one active. So when a new UoM
category is created, user have to encode the reference
unit first, and then the bigger/smaller ones.

This commit also update stock tests, since they were
redefining new reference UoM in the same category, and
finally, this commit provides some tests for this
uniqueness and custom UoM behavior.

Task #1820076
2018-04-09 10:13:18 +02:00
jem-odoo 2d32ff4bb8 [IMP] uom: measurement type on category
In order to restrict some uom field to some uom category, it is required to
add a measurement type on uom.category. Also, this will lessen the use of
master data.

Some technical justifications:
- measure_type is not required, to allow people creating their own
uom.category. Those ones will not interfere with addons business.
- measure_type is unique: we restrict to only one category containing
time, weight, ... in order to avoid mismatch category during conversion.
(2 different weight categories can not be converted).
- measure_type on uom.uom is stored: to allow search and domain on
field, we need to store it. Usually, UoM are not updated every day,
and the number of uom in a database is not that important.

To illustrate this mecanism, a domain is added on
'project_time_mode_id', in project module. This field
is use as timesheet default uom, and we obviously want to
restrict it to time category (timesheeting in liter does
not make sense ...)

Task #1820076
2018-04-09 10:13:06 +02:00
XavierDo 2966d4faed [IMP] product: rename product.uom into uom.uom
Also rename product.uom.categ into uom.category to
 give it a decent name.
2018-02-26 14:27:26 +01:00
XavierDo 6a378e3839 [IMP] product: move uom in a new addon
Moves UoM models, test and data to a new addon in
order to be able to use uom without product.
A simple example is be to be able to use UoM for
timesheets.

This commit only move code, and adapt xml ids
without chaging any feature or functionnal
behavior.
Note: 'product' module now depends on new
'uom' module.
2018-02-26 14:27:26 +01:00