Revamp the kanban view of fleet.vehicle.log.services.
Add some ux improvements (new filters, better naming,..).
Fix bug where contracts/services of archived fleet.vehicle were
not counted in statinfo.
When a fleet.vehicle is archived, archive its related contracts/services.
closesodoo/odoo#62556
Taskid: 2389823
Related: odoo/upgrade#2063
Related: odoo/enterprise#15036
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
PURPOSE
Currently, when changing the driver of a vehicle, we don't set the end date
of the last driver and we can't automatically set it because this end
date can be another date that the start of the new driver.
SPECIFICATIONS
When we change the driver of a vehicle, add an activity to specify
the end date of the last driver.
LINKS
Task-2328981
closesodoo/odoo#58170
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Currently, Failing at base/models/res_partner.py#L535
We write on the partner because of the related `plan_to_change_car`
When Assign driver linked to internal user without admin rights
it gives an error in security rules due to write on partner.
So while creating the vehicle when driver is assigned pop the value
for related field plan_to_change_car and rewrite the same with sudo.
closes odoo/odoo#60358
Issue: #54199
Taskid: 2309192
X-original-commit: af21dba516de688743f75e6ffb3bc3341578e37a
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: LucasLefevre <lul@odoo.com>
Steps to reproduce the bug:
- Create vehicle A
- Create a contract for vehicle A
- Change the license plate of vehicle A
Bug:
The name of the contract of vehicle A hasn't changed
opw:2327820
closesodoo/odoo#57251
X-original-commit: 5a031de6c456180b0f447470382e1ae1c7dbd5dc
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
The three following fields have been added to fleet.vehicle:
- frame_type (Selection)
- frame_size (Float)
- electric_assistance (Boolean)
These fields are specific to bikes and are only displayed in form view when vehicle_type = bike
Number of doors is now set to 0 instead of 5 when the vehicle is a bike.
"plan_to_change_bike" boolean field has been added to the res.partner model and has also been added as related field in fleet.vehicle model.
Task ID: 2238055
closesodoo/odoo#50064
Related: odoo/upgrade#1718
Related: odoo/enterprise#10152
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This provides a better API to search for records by name without the
formatting part (`display_name`).
This also simplifies all the overridings of `_name_search` that no
longer need to call `name_get()`. The call to `name_get()` is done in
method `name_search` in a generic way.
/web/action/load is the public controller that Should be used by the
webclient to fetch actions
_for_xml_id is the default access method on actions that implements
fields filtering to avoid leaking server action code or other
information not needed by the webclient
Implementing whitelist of fields that can be access per model
Currently, in Configuration > Service Type > Add a new service type.
The category field is mandatory but it does not appear on list view.
So in this commit, display the mandatory category field on list view
Currently, in Configuration > Manufacturers. The count of Models is
always 0 because the it's compute stored field without the depends
so not computed each time.
So in this commit, fix the count of models by adding a correct trigger
closes odoo/odoo#55475
Taskid: 2296851
Closes: #54515
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
- Fix the display of the licence plat on the kanban view
- Store the Driver on fleet.vehicle.log.services to remember who was
the driver at the time the service was done.
- Rename 'Informations' to 'Information'
- Rename 'Driver' to 'Current Driver' on the contract
closesodoo/odoo#54051
Taskid: 2289808
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Leave the generic management of fields default to the orm as much as
possible.
* Default method is not called unless necessary.
* Default values are correctly post-processed by the orm when necessary.
Small UX improvements on list view and edit text of an empty kanban
screen.
Task ID 2291554
closesodoo/odoo#54234
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Changing the driver on a car shouldn't change the
fleet.vehicle.log.services associated. We should keep the driver
assigned to the car at the time the service was done.
closesodoo/odoo#54264
Taskid: 2208080
X-original-commit: 5422bb8d6e3db5d6932570116af74ea634c40a51
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
When creating a new service on vehicle, the first vehicle was always
selected by default due to a wrong default value. Same thing for the
contract.
Taskid: 2289808
X-original-commit: 9ec3875249748929c4a8e0c8a16e7b729ab9f2d9
Purpose of the task is the current name(_description) of model
fleet.vehicle.log.contract is too long and confusion.
So in this commmit, Rename model fleet.vehicle.log.contract
name(_description) to 'Vehicle Contract'.
closes odoo/odoo#52176
Taskid: 2267547
Closes: #52176
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Issue
- Install "Fleet" app and open it
- Add new car with user X as driver and set state as "Registered".
- Add new car with user X as future driver and set state as
'Waiting list'
The user is set as "Plan To Change Car".
Cause
When a user is set to a new car as a future driver,
the user will automaticly be set as "Plan To Change Car".
Solution
Add condition to set as "Plan To Change Car" only if the user
new car state is not "Waiting List".
opw-2259606
closesodoo/odoo#52836
X-original-commit: 6d35733e61b1d8b18acc3510046423aec7fe1c85
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
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>
With a user with only Fleet Administrator rights.
Assign an internal user as the driver of a vehicle (other than the
current user) => access error, you cannot write on model `res.user`.
Writing on a partner linked to an internal user requires write access to
this user.
closesodoo/odoo#47572
X-original-commit: a693b368d3faddef6774004d40567e26b7d59cec
Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
Purpose
=======
If you set a future driver and click on "apply change", a new assignation log is
automatically created for the new driver.
But the end date of the former assignation isn't populate.
Specifications
==============
Set the date "end date" for the former driver with the "start date" of the
new driver.
closesodoo/odoo#44635
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Currently when user change the image on a vehicle, it change it
for the car manufacturer and the goal of this image is to recognize
the manufacturer of the vehicle.
After this commit is applied, the model and vehicle image will be
fixed as per the selected brand image. user will not be able to
change from the vehicle and model.
closes odoo/odoo#44153
Taskid: 2168922
Closes: #44153
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Create analytic account from fleet (and link it to vehicle) based
on the plate and the fiscal deduction rate (if l10n_hr_payroll_fleet
is installed).
Add on employee a Mobility Card number. This number is set on vehicle
when we put a partner linked to employee on a vehicle.
taskID: 2127641
Purpose
=======
It is currently difficult to know exactly what is used for costs
and services on the contracts.
Hence it make it difficult to evolve the fleet application
We should clean the models in order to have something that is clearer
Specification
=============
Cleanup of models: removed Fuel and Cost. Contract and Services are no
longer inheriting Cost and are seperate models simplifying the use of
Fleet. A contract now has included services and they are no longer
generating cost.
closesodoo/odoo#34090
Taskid: 1931775
Related: odoo/enterprise#4572
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Fixes#38574
Assigning default value for non-stored compute fields is required in
13.0
closesodoo/odoo#38685
X-original-commit: 7fa80370f8e6fe814651627832d81abe9edebad3
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
To avoid slowing down search like "{relational_field}" contains "{value}"
we always need to return the lazy name_get() for each [_]name_search method
closesodoo/odoo#36735
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
When the many2xxx field relates to a model where company_id is required, set
this domain [('company_id','=',company_id.id)]
When the company_id field of the related model is not required, set this domain
['|',('company_id','=',company_id.id),('company_id','=',False)]
When setting the domain on a field which is in the treeview of a xxx2many field
evaluate against the company_id of the 'parent'.
Some constraints have been added on sereval models. Take a look at the complete
specification for more details.
TaskID: 2024446
Closes: #35266
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The big images are probably never going to be used for the following models:
- pos category
- fleet brand
- livechat channel
- mail channel
- payment acquirer
And if big images are needed some day the model should use image.mixin instead.
PR: #34925
image_original => image_1920 (now resized to 1920)
image_big => image_1024
image_large => image_256
image_medium => image_128
image_small => image_64
image replaced by image_1920 (when writing) or by image_1024 (when displaying
what was previously the big size)
+ add new intermediate format:
image_512
PR: #34925
Purpose
=======
Fields `customer` and `supplier` on `res.partner`
are mostly used in domains of many2x fields.
Those domains can confuse end users because they don't
see the partner they are looking for; and it's not obvious why.
Some identified problems:
1. It can lead to duplicated partners: the user does not find
the partner, so he creates a new one.
2. The user imports supplier contacts in the Contacts app, so they
don't get the `supplier` flag. Then the user wants to make a purchase order,
and cannot find the new suppliers in the list
3. A user removes the customer flag on a prospect, because they don't think
it's a customer yet - except now they can't make a quote for that customer...
Specification
=============
Remove the two mentioned fields.
Since fields `customer` and `supplier` have been removed, all partners
are now shown in many2one dropdowns.
But in some cases, not all partners are relevant or some are more likely
to be relevant than others. e.g. when creating a PO, top suppliers have a
higher priority than other partners.
So, adapt the places where those fields were used with the new mechanism to
display the searched the partners, according to the number purchase/sales
orders they made.
TaskID: 2031147
Co-authored-by: Yannick Tivisse <yti@odoo.com>
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'`
Purpose
=======
Some formviews are useless since there are so few relevant fields https://nimb.ws/1EdMV7
For instance, to create a new lost reason the user is forced to:
1. Hit create
2. Type in the name of the record
3. Hit save
4. Go back to the treeview
While he could simply type them away in an editable treeview.
The goal of this task is to allow for creation/edition of records in such models
directly from the treeview.
Specification
=============
Modify tree views from a given list of models for which the
treeview has to be made editable bottom.
If not specified otherwise, the content treeview should stay the same.
If a field is readonly/required/etc. in the formview, it should be in the
editable treeview as well.
Relabeling has to be done of the field itself, not in the view.
TaskID: 2026126
closesodoo/odoo#34577
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The old tree views don't really exist anymore, this odd pseudo-flag to
dispatch between "list" and "tree" tree views has no reason to remain.
Task 1937686
closesodoo/odoo#31243
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
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.
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
closesodoo/odoo#32341
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Basically when someone requests a new car, getting that car ready takes
some time, this means that during the waiting period, that person is
still driving its old car.
This commit adds a field future_driver_id on fleet.vehicle to tackle
that problem and a boolean plan_to_change_car on the partner to track
who wants to change car.
+ Apply some linting to the files
This commit cleans the vehicle form view, the vehicle contract form
view, the cost list view and adds a manager_id field on the
vehicle.model which is then used as a related on the vehicle.
Task: 1930298
closesodoo/odoo#31197
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
- Create a contract for a vehicle
- Renew the contract and set old one to closed
- Run the cron 'Fleet: Generate contracts costs based on costs
frequency'
The closed contract is reset to expired.
The contract should remain closed.
opw-1949470
closesodoo/odoo#31974
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>