Commit Graph
109343 Commits
Author SHA1 Message Date
Jérome Maes aab2dc1431 [IMP] hr_timesheet: add name on res.config views to hook other views 2017-04-27 10:34:50 +02:00
Jérome Maes 8cda7998ed [IMP] resource: add 35 and 38h/week working hours calendars
This commit proposes to add 35 and 38 hours/week resource calendars.
Those are considered as standard for a lot of countries. This helps
users starting with odoo time tracking.
2017-04-27 10:34:50 +02:00
Sanjay Jamod afb3311059 [IMP] point_of_sale: allow to resume in cash control
When closing a session with cash control enabled, the session is no longer
directly closed and allows to resume selling.
This allow to have the same behaviour with cash control enabled or disabled
when clicking on the close button of the pos dashboard.

#15919
2017-04-27 10:22:23 +02:00
Géry Debongnie 51e9aba2cb [FIX] web: do_action should properly resolves when complete
We changed the do_action method recently: before, it was calling
recursively its parent, now it simply triggers up an event.  We also
moved it to the 'services' mixin.  However, we did not properly connect
the 'on_success' option: it is not an option for the view manager, but
for the abstract web client.  As such, it should not be in the options
parameter, but it should simply be a key in the event payload.

This commit was found by solving the two following issues:
- open sale application, click on 'Inbox' icon to go to discuss,
  Discuss is opened, but the navbar stays with sales application
- after installing module website_crm_partner_assign in kanban view for apps,
  it does not reload...

Both of these were caused by the need to do something after a do_action,
and the deferred was not resolved at all.
2017-04-27 09:24:59 +02:00
Aaron Bohy d20074c555 [FIX] web: BasicModel: don't mix fields and action contexts
The context sent when performing RPCs is a mix of several contexts
(user_context, action's context, context defined in a field's node
in an arch...).

In general, the action's context should not be mixed with the
field's context:
 - for global RPCs (read a record, write a record, default_get...)
   only the action's context should be given
 - for RPCs triggered by fields (e.g. name_search in a m2o), only
   the field's context should be sent.

The exception is for onchange RPCs, as in this case, both action
and field's contexts should be sent.

Before this rev, the action context was always sent, which might
produced tracebacks (e.g. go to Sales > My Pipeline > New > click
on Customer field > Create and Edit > boom).
2017-04-26 16:35:18 +02:00
Yannick Tivisse b9944978e9 [MERGE] hr_payroll: Payroll module refactoring for salary configurator
Thanks to:

- Nicolas Michaux for the design part and his expertise.
- Laura Piraux for all her advices, reviews, ideas and kindness.
- Thibaut Delavallée for the technical advices.
- My mother for her pies.
- Martin Trigaux that did nothing.
2017-04-26 16:16:44 +02:00
Yannick Tivisse 3916e0c431 [FIX] hr_payroll: Add missing method
This method is used in enterprise currently, but should be in the basic module as it make sense to use it without that
2017-04-26 16:13:44 +02:00
Yannick Tivisse d7a3f39d72 [MOV] hr_payroll: Split models and views into separate files 2017-04-26 15:08:09 +02:00
Yannick Tivisse 6c3f9db1c8 [ADD] l10n_be_hr_payroll_fleet: Compute car related cost and advantages in belgian payroll
- Compute the taxable ATN due to the company car (Depends on the acquisition date, car value, fuel type and CO2 emissions)
- Compute the Total Depreciated Cost on the employer costs due to the depreciated recurring amount declared with the car purchase
- Allow to retrieve these 2 different values on a vehicle.model in the case we want to have a default value for a new car
- Modify name_get on a vehicle.model and the name compute method on a fleet.vehicle to display some useful information like the employer cost (by month) and the acquisition date
- A new car may be purchase for an employee when the amount on unused car in the fleet exceeds X. Add a res_config view to configure that behavior
- Add the company car mechanism (choose a car, select a new car from available models) on a hr.contract.
2017-04-26 15:08:09 +02:00
Yannick Tivisse e25dda3790 [IMP] l10n_be_hr_payroll: Update all advantages + Refactor the views
PURPOSE
=======

A very small amount of all the existing belgian advantages for employees and workers. The goal of this commit is to implement/update all the advantages and refactor the contract form view to be sexy and usable.

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

Contract
~~~~~~~~

- Add advantages:
	- Transport mode:
		- Company car
		- Public transport
		- Others
	- Thirteen Month, Double Holidays
	- Commissions on target + Integration with warrants
	- Fuel card
	- Internet
	- Mobile
	- Meal Vouchers
	- Holidays and holidays compensations
	- Eco checks
- Compute employers costs. It's influenced obviously by:
	- The employee wage
	- The social security service fees (UCM, ...)
	- The various advantages
	- The social security contributions
- Implement all the mechanisms to compute those different values and advantages
- Refactor the contract form view to be sexy

Employee
~~~~~~~~

- Add missing fields to be able to compute correcly the Net Salary from the Gross Salary:
	- Disabled spouse, spouse fiscal situation and revenues
	- Dependent people (childen, juniors, seniors, disabled)
2017-04-26 15:08:09 +02:00
Yannick Tivisse 10466fb58e [IMP] l10n_be_hr_payroll: Update salary rules for belgian worker and employees
- Update the outdated ones:
	- Disabled Spouse Allowance
	- Child Allowance
	- Retain on Meal Voucher
	- Reimbursement of travel expenses
- Add missing rules:
	- Reduction for special family charges
	- Withholding Tax Reduction
	- Special social contribution
	- ATN Company Car
	- ATN Internet
	- ATN Mobile
	- Employment Bonus
	- Withholding Tax Reduction for Low Salaries
	- Withholding Tax Reduction for Low Salaries (ONSS)
	- Other family charges reductions
	- Reduction for isolated people
	- Reduction for isolated parent
	- Reduction for disabled employee
	- Reduction for dependent seniors
	- Reduction for dependent juniors
	- Reduction for low spouse revenue
	- Reduction for low spouse other revenue
	- Commission on Target
	- Representation Fees
- Add advantage templates with default values
2017-04-26 15:08:09 +02:00
Yannick Tivisse 7276cdf781 [IMP] l10n_be_hr_payroll: Update Withholding Tax Grid and Child Allowance rules up to 2017 2017-04-26 15:08:09 +02:00
Yannick Tivisse f89ac984e7 [IMP,FIX] hr_recruitment: Add field 'HR Responsible' field + 2 small fixes
- Add a field HR Responsible, who's the job responsible, not the recruitment responsible
- Fix the read_group in `_compute_application_count` method
- Only track subtypes for active employees
2017-04-26 15:08:09 +02:00
Yannick Tivisse e18e6b3c90 [IMP] hr_payroll: Add hr.contract.advantage.template model + some improvements
- Some label improvements
- Make the 'Working Schedule' required on a contract to work well on payslip. If not set, the working hours are not taken into account when computing the payslip, leading to a wage salary equal to 0.
- Add a hr.contract.advantage.template model. This is kind of a meta model to retrieve specific values for given advantages (like lower and upper bounds or default values). Add related views and actions too.
- Only add opened contract by default on a payslip in the onchange_employee_id
- Rewrite some method in new api style (with browse records)
2017-04-26 15:08:09 +02:00
Yannick Tivisse 90942e0ab4 [IMP] hr_contract: Add some fields and restructure some views
- An employee isn't required anymore on a contract, to allow default contract for a certain job
- Remove trial_date_start, as we assume that it's the same than the contract date start
- wage should be a fields.Monetary
- Add a state 'cancel' for a contract
- Move some fields to the employee (permit number, visa number, visa expiration date)
- Add company and currency on the contract
- Restructure contract form view in a so beautiful way
2017-04-26 15:08:09 +02:00
Yannick Tivisse 7964b81ac8 [IMP] hr: Add some default values and fields
- Default gender is male
- Default marital status is single
- Move some fields from the contract to the employee (permit number, visa number, visa expiration date)
2017-04-26 15:08:09 +02:00
Yannick Tivisse c63e869fb2 [MOV] fleet: Split models and views into separate files
It's a PITA to have a huge files with all the models into it. We took this opportunity to stick to the guideline.
2017-04-26 15:08:09 +02:00
Yannick Tivisse 2e7cdc1c90 [IMP] fleet: Clean some views and add useful piece of information
PURPOSE
=======

During the Salary Package Configurator implementation, some improvement have been made to improve the fleet management module

- When duplicating a fleet vehicle cost (for example when duplication a vehicle contract), duplicate the included costs too.
- Add a field Cost Description on the list view
- Rename 'Acquisition Date' into 'Immatriculation Date'
- Rename 'Car Value' into 'Catalog Value (VAT incl.)'
- Add a information field 'Residual Value on a vehicle'
- Prevent an employee to have several cars
- Only display opened contract on the vehicle form view
- Add the driver on the odometer list view
- Rename 'Odometer value' into 'Odometer at creation' on a vehicle contract
- Restructure to vehicle model form view to be bearable by a human eye
- Show the handle widget on the fleet vehicle state list view
- Show configuration menuitems to fleet managers, not only debug mode
2017-04-26 15:08:09 +02:00
Adrien Dieudonne f6f342e50b [FIX] web: FormController: prevent opening multiple form dialogs
Before this commit, the form dialog was open twice when you tried to
add a new record on a one2many if you were already in a modal.

The event wasn't stopped, so the first form dialog was correcly rendered
but the second one tried to load the same form view on a wrong model.
2017-04-26 14:44:52 +02:00
Parth Gajjar 18971b3e3a [FIX] web: properly transfer field options to fields data
The basic model did not transfer field options to special data methods
from fields.  This was mostly not an issue, except for the widgets that
actually need them, such as the status bar and the domain editor.

This was only visible when opening views with different view types,
but this is a problem in general.  We should have a better mechanism to
help widgets fetching data, but for now, this is the best we can do.
2017-04-26 14:43:16 +02:00
Aaron Bohy e950f60fef [FIX] web: increase timeout of test_01_js
This test executes the QUnit js test suite. Since the new views,
this suite keeps growing, which is good. The default timeout
for phantomjs tests is 60 seconds, which starts to be tight for
test_01_js when the runbot is overloaded.

So this commit increases the timeout of this test to 120 seconds.
2017-04-26 12:25:35 +02:00
Fabien Pinckaers f9644d3698 [IMP] sale_timesheet: better labels 2017-04-26 12:12:04 +02:00
Fabien Pinckaers a5255bc875 [IMP] sale_timesheet: placeholder on project_id 2017-04-26 12:03:06 +02:00
Martin Trigaux 0245228969 [IMP] point_of_sale: add ensure_one
instead of old assert
add doctstring to clarify the method structure
2017-04-26 11:27:15 +02:00
Aaron Bohy 8dfb32aa90 [IMP] web: qunit_config: hide passed tests by default
Tests are executed a bit faster in the browser when passed tests
are hidden.
2017-04-26 11:19:20 +02:00
Aaron Bohy bead8452c2 [FIX] web: Views: sequential lazy loading of libs
The views can specify js (and css) libraries to lazy load when
they are instantiated for the first time. The previous
implementation was too naive as it always loaded the specified
libraries in parallel. However, it may happen (e.g. gantt view)
that some of those libraries depend on other ones.

This commit implements a mechanism to handle libs dependencies
between each other. For instance, specifying:
    js_libs: [
        ['a', 'b'],
        ['c'],
    ],
will load 'a' and 'b' in parallel, but wait for them to be
loaded before loading 'c'.

The new implementation still supports the old syntax. So,
    js_libs: ['a', 'b', 'c'],
will load 'a', 'b' and 'c' in parallel.
2017-04-26 11:19:20 +02:00
Aaron Bohy 8f9362809e [FIX] web: FormView: notebook: activate first visible tab
In a notebook, tabs may have an invisible attrs. The first visible
tab should be active in any case. This wasn't working at the first
rendering of the view, because the invisible attrs was evaluated
for each tab, before processing the next ones, so the it couldn't
find a next tab to activate.

This fix ensures to process all tabs (i.e. generate their DOM
element) before evaluating their invisible attrs, and trying to
find which tab to activate.
2017-04-26 11:19:20 +02:00
Aaron Bohy 6fe55c370d [FIX] web: view_manager: reload views with correct params
Mode 'readonly' is a concept of list and form views. When
switching from a graph view to another view, then switching back
to graph, there was a crash because 'readonly' is not a known mode
of graph (in graph, mode is used to determine the type of graph to
display (pie, chart or bar)).

This is due to commit odoo/odoo@ef6b330 which aims to reset the
mode to readonly when coming back to a form view using the
breadbrumbs.
2017-04-26 11:19:20 +02:00
Géry Debongnie 2679fdd9b9 [FIX] web: add mutex in basic controller
Before this commit, concurrency issues were mostly handled by the mutex
in the basic model.  That mutex makes sure that save and change
operations are properly serialized.  However, this is not enough. Here
is an example:

1. we have a required field with an onchange and a current value
2. the user changes the value to an empty value. This triggers an
   onchange
3. the user clicks on save, before the return of the onchange
4. the controller checks with the renderer if it can be saved.  At that
   point, the onchange is not yet complete, so the values stored in the
   fields are still the initial ones, which are valid (non empty value
   for required fields)
5. so, the controller request a save operation
6. the model add the save operation in the mutex, wait for the onchange
   to complete, then apply the save operation
7. we end up with a required field with an empty value

The issue here is that the model properly saves and apply onchanges, but
the responsability to check if a record is valid (which depends on the
modifiers AND the field widgets) is the renderer's responsability (it
has to ask the question to all its sub field widgets).

So, we need to serialize 3 operations: applying the onchange, checking
if the save is valid, and saving the record.  This cannot be only in the
model, so we need to add a concurrency control mechanism somewhere else.
What we do in this commit is to add a mutex on the basic controller (it
will most likely be used by the list controller as well).  In this
mutex, we currently serialize the field change operation and the save
operation, but I assume some other operations will need to be handled by
the mutex.

In addition to this, we also change some asynchronous methods to return
a deferred, so we are ready for other kind of asynchronous behaviour in
the future.
2017-04-26 10:32:03 +02:00
Dhaval Panchal 71f3abccab [IMP] generic: default view should be graph view insted of pivot view in reporting menu 2017-04-25 18:30:36 +02:00
xmo-odoo 2479c6bc21 [FIX] patch hunk broken by 09731b78 2017-04-25 16:42:37 +02:00
Christophe Matthieu 6979f267b3 [REF] account: adapt the payment field to the new framework
The account payment widget did not work at all, since we pushed the new
views. With this commit, we adapt the code to the new views (note: the
file account_payment_widget was renamed in account_payment_field).
2017-04-25 16:36:27 +02:00
Christophe Matthieu 0c4e69e803 [IMP] barcode: add some javascript docstring 2017-04-25 16:36:20 +02:00
Thibault Delavallée 9ab9da235f [IMP] lunch: display latest orders first in previous orders widget and menuitem
Ozeurouïze zizisse madnesse !
2017-04-25 14:11:48 +02:00
Thibault Delavallée a4c76239fd [IMP] account: fix link and redirection in invoice email
Currently the link is always the website link once website_portal is
installed. However it is better to use the generic /mail/view controller
that chooses the right redirection depending on the user trying to access
the document.
2017-04-25 14:10:54 +02:00
Thibault Delavallée b49da62365 [IMP] sale: improve link in quotations email
Currently the link is always the website link once website_portal or
website_quote is installed. However it is better to use the generic
/mail/view controller that chooses the right redirection depending on
the user trying to access the document.

This commit also fixes redirection in website_quote that is always
redirecting to the front-end. Classic users should land on the backend.
Indeed seeing the front-end page is rarely interesting for them.
2017-04-25 14:10:54 +02:00
Thibault Delavallée bf2f6f9264 [IMP] models: sudo get_formview_action but add access rights uid
get_formview_action is now called as sudo to avoid access rights issues
when browsing it and trying to determine the ID of the form view to
display.

However in some cases it can be interesting to know the real user trying
to access the form view. The original uid is therefore added as parameter
of the method to have the best of two worlds.
2017-04-25 14:10:54 +02:00
Thibault Delavallée 3c2c166fa6 [FIX] mail: do not sudo access action fetch in /mail/view
Otherwise it is impossible to know the user trying to access the record.
This leads to some incoherent redirection.
2017-04-25 14:10:54 +02:00
xmo-odoo 6b9268bd15 [FIX] print statement -> function
In Python 3, ``print`` becomes a builtin function. This is available
in Python 2 by importing the ``print_function`` feature from
``__future__``, the feature is conveniently still available in Python
3 (it just does nothing).

Fixers:
    libfuturize.fixes.fix_print_with_import

#8530
2017-04-25 13:27:54 +02:00
xmo-odoo 3cbca4b734 [FIX] iterator definition & stepping
* in P3, the iterator stepping method has become a dunder method (next
  -> __next__), the protocol has not changed, add a __next__ alias to
  the iterator-next definition (nota: ir.config also has a next method
  but it's not part of an iterator, so don't alias it and don't
  convert calls to it)
* since ~2.6, a builtin (next()) has been added to step an iterator &
  allow for a default (in case of iterator end), convert all manual
  stepping to the builtin

Fixers:
    libfuturize.fixes.fix_next_call

#8530
2017-04-25 13:04:54 +02:00
Christophe Simonis 4441237b0a [MERGE] forward port branch saas-15 up to ab68a1c674 2017-04-25 12:36:02 +02:00
Pierre Masereel 38bb4f07d0 [IMP] stock_account: rename 'to refund' -> 'to refund (update SO/PO)' 2017-04-25 11:12:39 +02:00
Srushti Patel 49c159a906 [IMP] purchase, sale_stock, stock_account: to refund purchase
When we have purchase orders and we return some products to the
supplier, we now have the possibilty to set those moves as 'to refund'
and so the quantity received is decreased.

Because the feature 'to refund' already exists on the sale orders, we
will generalize it in the module 'stock_account' which is a dependency
of both 'sale_stock' and 'purchase' which are the both module that use
the feature 'to refund'.
2017-04-25 11:08:14 +02:00
Christophe Matthieu f47775b039 [FIX] account: don't display alert in some cases
Before this commit, in the reconciliation widget, the reconciliation alert (exclamation mark) was displayed, even for amounts less than the total. It does not make sense, so we just hide it in that case.
2017-04-25 10:00:48 +02:00
Aaron Bohy b25ba51e6f [FIX] mail: client action: listen to search view changes
When the user changes the filters in the search view, this one
triggers up an event to notify its environment that its state
changed. This came with the new views, as before the search view
triggered an event on itself (i.e. used 'trigger' instead of
'trigger_up'). At some point, 'trigger' will be deprecated and
'trigger_up' will be used instead, everywhere.

The code in mail hasn't been updated accordingly, so the thread
wasn't updated when the user changed the filters.
2017-04-25 08:58:34 +02:00
Aaron Bohy 764127357c [FIX] mail: re-bind handlers on chatter buttons
When a user opens a record in a form view, the chatter is
displayed. Then, if he clicks on 'Create', the chatter is removed
from the DOM (there is no chatter in create mode). After saving
the newly created record, the chatter is displayed again, but the
same widget's instance is kept.

However, when being removed from the DOM, the event handlers bound
on elements of the chatter (e.g. 'New Message', 'Log a Note'...
buttons) are automatically unbound.

So before this rev., the buttons didn't work anymore once the form
view had switched to create mode. In this commit, we detach the
chatter's $el before updating the view, so that its handlers aren't
unbound when the old content is replaced by the new one.
2017-04-25 08:07:17 +02:00
Aaron Bohy f5bfa3d3b6 [FIX] web: FormView: don't modify record's context
Before this rev., some keys were added to the context of a record
if there were x2many fields in the form view with a context
defined on their node (containing *_view_ref keys, specifying the
fields_view to load to display the relational data). Those keys
should not be added to the main record's context, and it may cause
errors (e.g. click on the 'Procurements' stat button in the Product
form view).
2017-04-25 08:07:17 +02:00
Aaron Bohy 6e85008504 [FIX] web: BasicModel: send context when fetching data
when calling 'read' to fetch a record and 'search_read' to fetch a
list of records.

I don't know where (or if) it is used, but it seems more correct
like this (and mostly, it was the case in the old views, so we
re-introduce the same behavior).
2017-04-25 08:07:17 +02:00
Adrien Dieudonne fcc5ce9d46 [FIX] web: BasicModel: handle many2many default values
Before this fix, default values for many2many fields (i.e. 'replace' commands)
weren't correctly handled by the model, so the default values weren't set for
those fields.
2017-04-24 17:29:52 +02:00
Christophe Matthieu 6d4e223c18 [FIX] barcode: various javascript fixes
* Avoid unnecessary reload
* send option to saveRecord
* Display error warning to set the quantity as option
2017-04-24 17:05:20 +02:00