Commit Graph
67 Commits
Author SHA1 Message Date
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
Martin Trigaux 7d234fe640 [FIX] fleet: don't convert a date to date
date is already a Date field
2018-08-20 10:36:43 +02:00
Prakash Prajapati a71f0d6ab0 [IMP] fleet: improve rescheduling of automated activities
Purpose of this commit is to improve automated activities in fleet.
Currently they are not always updated or rescheduled. Specifically when
updating the expiration date or the responsible automated activities should
be updated accordingly.

This commit is linked to task ID 1838956 and PR #25899.
2018-08-10 15:36:05 +02:00
Raphael Collet 960360afe4 [REF] *: use native date/datetime for Date/Datetime fields
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master.

This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well.

Task-ID: 47189
2018-08-06 14:37:19 +02:00
Raphael Collet 896e36edab [REF] *: adapt create to work in batch 2018-07-24 16:58:14 +02:00
Gert Pellin b7bcbddccb [imp] fleet: Allow to filter/group by Make on vehicles
Add grouping possibility on model make for vehicles in the fleet.
Deleted redundent controll on make image for vehicles if model changed.
fixed _name_search for FleetVehicle

project : RD for Dummies
task : [Fleet] Allow to filter/group by Make on vehicles
2018-07-05 09:45:17 +02:00
sed-odoo 22ee6df66b [IMP] fleet: Allow to search vehicles based on assignation logs
Purpose
=======
We can not get the list of vehicles who have been assigned to a driver.

Specification
=============
The user is able to get the list of the vehicles assigned to a specific driver, by searching the driver's name with the "Assigned to" filter.
2018-06-08 16:04:32 +02:00
Yannick Tivisse 473c74f636 [IMP] various: Override _(name_)search instead of (name_)search
Purpose
=======
The method _name_search and _search add support to search as another user.

All the overrides of name_search and search redefine the behavior of the search.

This bring inconsistencies as the result of a call to _name_search and name_search
could differ on certain modules, which is not acceptable.

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

Example:
~~~~~~~~

If the name_search method is overridden to search also on the driver name,
then calling name_search with a label 'JF' will return all the cars with a name containing
'JF' or all the cars with a driver name containing 'JF'. Let's say that we have a ir.rule
preventing a user to read the cars of another company. Then the call to name search only returns
the cars satisfying the previous condition AND belonging to his company.

Now, we want to overpass this constraint. We call _name_search with the attribute name_get_uid=1.
Then the call to _name_search returns all the cars from all the companies with a name like 'JF',
but nothing is done about the driver_name.

Example of wrong search redefinition on a model
-----------------------------------------------

    @api.model
    def name_search(self, name, args=None, operator='ilike', limit=100):
        domain = args or []
        domain = expression.AND([domain, [('name', 'ilike', name)]])
        partners = self.env['res.partner'].search([('name', operator, name)])
        if partners and name:
            domain = expression.OR([domain, ['|', ('driver_id', 'in', partners.ids), ('driver_id', '=', False)]])
        rec = self.search(domain, limit=limit)
        return rec.name_get()

Example of correct search redefinition on a model
-------------------------------------------------

    @api.model
    def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
        domain = args or []
        domain = expression.AND([domain, [('name', operator, name)]])
        partner_ids = self.env['res.partner']._search([('name', operator, name)], access_rights_uid=name_get_uid)
        if partner_ids:
            domain = expression.OR([domain, ['|', ('driver_id', 'in', partner_ids), ('driver_id', '=', False)]])
        rec = self._search(domain, limit=limit, access_rights_uid=name_get_uid)
        return self.browse(rec).name_get()

The same logic should be applied on the overrides of the search method.
2018-05-23 11:15:46 +02:00
Yannick Tivisse 6cb5052e85 [FIX] fleet: Fix the _name_search override on fleet.vehicle
Actually _search return a list of ids, not a browse record.
2018-05-07 10:11:58 +02:00
Yannick Tivisse 348447923a [IMP] fleet: Improve stages demo data
Remove the old one and defined stages that are more realistic.
2018-05-04 09:47:05 +02:00
Yannick Tivisse 66db893fa9 [IMP] fleet: Rename purchaser_id from 'Contractor' to 'Driver' 2018-04-27 17:30:30 +02:00
Yannick Tivisse 77171d482c [IMP] fleet: Add track_visibility='onchange' on some fields
1/ Use track_visibility instead of overriding write method on a fleet.vehicle

Instead of posting messages in the write method to notify that the record value
changes, use the attribute track_visibility='onchange' instead.

2/ Add track_visibility='onchange' on some fields

3/ Track visibility on 'recurring_cost_amount_depreciated'
2018-04-27 17:30:30 +02:00
Yannick Tivisse 02775e6cd2 [IMP] fleet: Introduce fleet.vehicle.assignation.log model
Purpose
=======

Currently it's impossible to know who was driving a given car at a given time.

We have some piece of information like the immatriculation date of a vehicle
or the date of the first contract. But it's not enough.

This is problematic to solve a rather common issue:
- Who is gonna pay the fine for having exceeded the speed limit?

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

Introduce a simple model fleet.vehicle.assignation.log, containing info about:
- The driver
- The vehicle
- The start Date
- The end Date

A simple button on the fleet vehicle should be sufficient to solve the issue.

We cannot generate data from the salary package as these dates can't be predicted
at the contract signature.
2018-04-27 17:30:30 +02:00
Yannick Tivisse ef8befeef4 [IMP] fleet: Add subtype to track driver modifications 2018-04-27 17:30:30 +02:00
Yannick Tivisse 50dfff2462 [IMP] fleet: Allow to search vehicles based on the driver name 2018-04-27 17:30:30 +02:00
Yannick Tivisse 2958bcc383 [IMP] fleet: Archive related contracts when archiving a vehicle 2018-04-27 17:30:30 +02:00
Yannick Tivisse 7356c3b5b6 [IMP] fleet: Add 'Next Activities' on vehicles
This commit adds:
- The button on the chatter
- The button on the kanban card and a progress bar on top of the stage
2018-04-27 17:30:30 +02:00
Yannick Tivisse 3fc4c3b966 [IMP] fleet: Add an informative 'First Contract Date' field
The goal of this field is to be able to keep the value of the first contract
even if it has been closed/deteled.

It could be used to compute the depreciation of the car.
2018-04-27 17:30:30 +02:00
Yannick Tivisse 13bd8e7db6 [IMP] fleet: Order cars by plate, then by acquisition date
This commit allow users to see in the kanban/list view the oldest cars with no plates
2018-04-27 17:30:30 +02:00
Yannick Tivisse 47857a63ac [IMP] fleet: Remove the unicity constraint on the driver
It should be possible to assign 2 vehicles to the same person.

The constraint is too restrictive.
2018-04-27 17:30:29 +02:00
Yannick Tivisse 2bc85571a9 [IMP] fleet: Display all the stages on the fleet.vehicle kanban view
All the stage should be displayed to allow a user to move a car in another stage
even if no other cars are into it.
2018-04-27 17:30:29 +02:00
Yannick Tivisse b510e7f41b [IMP] fleet: Make the license plate not required
It's not mandatory for a car in the fleet to have a license plate.

It should be possible to create the car before the immatriculation date.
2018-04-27 17:30:29 +02:00
Yannick Tivisse 647292a963 [IMP] fleet: Add a default value for 'acquisition_date' 2018-04-27 17:30:29 +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
Christophe Simonis c309ccd7b3 [MERGE] forward port branch saas-11.2 up to fed775bc0c 2018-04-18 18:30:35 +02:00
Christophe Simonis fed775bc0c [MERGE] forward port branch 11.0 up to 8c64159b88 2018-04-18 18:20:40 +02:00
Yannick Tivisse a78442194a [FIX] fleet: Track driver modifications on vehicles 2018-04-18 11:53:32 +02:00
Christophe Simonis 74033eb007 [MERGE] forward port branch saas-11.2 up to 90f8f17fb4 2018-04-16 19:50:50 +02:00
Christophe Simonis 860dfb5586 [MERGE] forward port branch 11.0 up to d277adf4d5 2018-04-06 15:36:10 +02:00
Yannick Tivisse 9999a54028 [FIX] fleet: Add missing dependencies on compute fields 2018-04-04 11:32:56 +02:00
Yannick Tivisse 3eb328cdc5 [IMP] fleet: Track changes on license_plate and total_depreciated_cost 2018-04-04 11:32:56 +02:00
Yannick Tivisse ea5547aff4 [FIX] fleet: Display 'No Plate' in name when no place is defined 2018-03-29 10:24:15 +02:00
Thibault Delavallée 77c7b68a9b [IMP] fleet: improve activity management on fleet contract model
This commit improves fleet contracts management through a better integration
of activities and addition of automated activities. Several things are done
in this commit :

 * fleet vehicle log contract does not inherit from mail.activity.mixin.
   This commit adds the inherit so that fleet users and managers can now
   schedule and manage activities on vehicle contracts. This will help them
   in their daily job;
 * automatic activities generation is added when contracts are nearly expired
   and renewal is required;
 * a menu to configure activity types is added. Indeed fleet managers should
   be able to see and configure activity types related to their job;
 * filters are added to be able to use the systray and to filter the kanban
   view based on activities

Having automated activities allow to replace some messages posted on the
contract. Indeed currently there are messages posted on vehicles about
contracts to renew. As we now have automated activities on contracts to
remind assigned people to renew it the log can be safely removed. It will
lessen noise generated on chatter.
2018-03-27 16:31:01 +02:00
Thibault Delavallée fce33767af [IMP] fleet: add responsible on fleet vehicle log contract model
Currently there is no place to indicate who is responsible of managing
fleet contracts. As we plan to integrate activities to fleet app having
responsible to push notifications is necessary.

This commit adds a responsible field following Odoo convention, aka a
user_id field linking res.users records. It is also added on the view.
2018-03-27 16:31:00 +02:00
Thibault Delavallée 8de00fee31 [IMP] fleet: log standard creation message instead of unnecessary custom one
Currently a note is posted on the fleet with 'name has been added to
the fleet'. It is not really interesting as it is no notified to
anyone and it makes some noise. Let us therefore fall back on the
standard behavior.
2018-03-14 11:05:59 +01:00
Christophe Simonis 36945a5853 [MERGE] forward port branch 11.0 up to c2e878e34c 2018-03-01 19:43:25 +01:00
Goffin Simon d3843d7ed0 [FIX]fleet: Error when clicking on the costs of a vehicule
Steps to reproduce the bug:

- Go to Fleet
- Group by status
- Click on a vehicule
- Click on Costs

Bug: A traceback was raised because a group_by was made on the model "fleet.vehicle.cost"
for the field "state_id" and this field doesn't exist on this model.

opw:1815454
2018-02-27 09:42:40 +01:00
Fabien Pinckaers b341b5ca73 [IMP] Remove duplicate fields names 2018-01-07 19:28:03 +01:00
Kinjal Mehta 092bb2bd5c [IMP] fleet: changed duplicate field label in the same model 2018-01-04 17:56:53 +05:30
Christophe Simonis 362f0489d0 [MERGE] forward port branch 11.0 up to fe22a0f9ca 2018-01-03 12:28:52 +01:00
Martin Trigaux cab7e0d204 [FIX] *: add missing space in multilines messages
Courtesy of @Yenthe666
2018-01-03 11:09:09 +01:00
Christophe Simonis f02ed9ab9a [MERGE] forward port branch saas-16 up to 0af13af5de 2018-01-02 16:54:38 +01:00
Yannick Tivisse b72240e3c9 [FIX] fleet: Don't copy driver_id on vehicle duplication
Purpose
=======

There's an unicity constraint on the fleet.vehicle model.

It's thus impossible to duplicate a car if the driver is set.
Y
2017-12-19 12:47:42 +01:00
Christophe Simonis 29590a61cd [MERGE] forward port branch 11.0 up to 8fb25e185b 2017-11-28 16:57:58 +01:00
Nicolas Martinelli 3e44ceb927 [FIX] fleet: typo
opw-783760
2017-11-23 10:39:47 +01:00
Alexandre Kühn 23e6dd36d7 [IMP] web: hide in kanban tag's color (#20815)
New feature:

   - New Transparent tag visual (grey border & text, white bg),
   - By default, newly created kanban tags are transparent,
   - Tag's colorpicker has now a 'Hide in Kanban' checkbox,
     to select the transparent color.

Toggling off 'Hide in Kanban' sets the color of the tag as follow:

   - Previous color, if 'Hide in Kanban' was toggled on on the
     same formview session.
   - Color 1 (dark orange), otherwise.
2017-11-20 10:47:43 +01:00
Martin Trigaux 07fa8d9b97 [FIX] fleet: model description
It actually represent the brands, not the model of a car

Courtesy of the translator teams
2017-11-10 16:51:19 +01:00
Martin Trigaux abf8568879 [FIX] fleet: fix typo
Courtesy of translator teams
2017-11-08 15:52:30 +01:00
Christophe Simonis 017ee5eab3 [MERGE] forward port branch saas-17 up to 877e709871 2017-08-24 13:17:53 +02:00