If the pad content field is modified in Odoo, the content of the pad should be modified too.
Example: When merging tasks, the tasks descriptions are concatenated into the target record. But the taregt pad is not modified if it already exists.
Use ``profile`` to decorate an entry point method.
If ``profile`` is used without params, log as shallow mode else log
all methods for all odoo models by applying the optional filters.
:param whitelist: None or list of model names to display in the log
(Default: None)
:type whitelist: list or None
:param files: None or list of filenames to display in the log
(Default: None)
:type files: list or None
:param list blacklist: list model names to remove from the log
(Default: remove non odoo model from the log: [None])
:param int minimum_time: minimum time (ms) to display a method
(Default: 0)
:param int minimum_queries: minimum sql queries to display a method
(Default: 0)
.. code-block:: python
from odoo.tools.profiler import profile
class SaleOrder(models.Model):
...
@api.model
@profile # log only this create method
def create(self, vals):
...
@api.multi
@profile() # log all methods for all odoo models
def unlink(self):
...
@profile(whitelist=['sale.order', 'ir.model.data'])
def action_quotation_send(self):
...
@profile(files=['/home/openerp/odoo/odoo/addons/sale/models/sale.py'])
def write(self):
...
NB: The use of the profiler modifies the execution time
In 3071ef16c sorted filter was added, but arround the same time with the
change of filter in 6c579354 the js part of the feature was lost.
This commit adds it back.
opw-749422
closes#18361
Display both fiscal position and fiscal position remark on invoice.
Since the note is usually empty, it most of the time displays an empty
label next to 'Fiscal Position:'.
opw-756720
Before this commit, `action_done` on stock.move.line was intended to
receive the recordset of the move lines of a single move where the move
lines having a null `qty_done` were already unlinked.
This part of code was in stock.picking's `button_validate` and not
copied in mrp, and weird things happened when mrp tried to run
`action_done` on a stock.move.line with a `qty_done` of 0.
We move this check directly in `action_done`, as well as the check on
the picking type that was done in stock.move's `action_done`.
We also adapts rev[0] that was not working anymore since the new stock,
and add some tests.
[0] e79eaecc46
The constraint does not allow the same check out time as the next
check in time which might be rare but a possible and likely use case.
opw-756694
Closes#18400
Some one2many fields are called with a many2many widget to unlink
records instead of delete them. But this behavior was modified with the
new views and the records were deleted anyway.
In this commit, we restore the previous behavior, and create a FORGET
command in basic model
to do that. Note that the widget='many2many' is a hack, and a better way
to accomplish this is to use a new custom option. But this would be a
fix for master (PR #18413)
Trying to display external identifiers would make the server crash
because the method in charge of requesting the external id information
would expect an object but it was being given a string and thus not
computing the m2o_value for the record.
This commit fixes this by changing FieldMany2One objects' m2o_value
instatiation to use its _formatValue method to compute it, _formatValue
is then overridden in FieldReference so that it properly handles both
strings and objects to calculate its m2o_value and relation.
Before this commit, the makeDefaultRecord could return a rejected
deferred if the onchange returned a warning. This was useful in this
usecase: the user is in a form view with a one2many (for example, an
invoice with no customer set), then click on 'Add a line' (the invoice
line). In that case, the onchange returns a warning, and we do not want
to add the line at all, so the makeDefaultRecord is rejected.
This works fine, but we then have another problem: when we create a new
record from scratch, it may happen that a warning is returned (for
example, if a vendor has its 'warning on invoice' flag set, then a
purchase order is done with this vendor, then confirmed, then the stat
button for 'vendor bills' is clicked, which opens a list view with the
vendor in the context. Clicking on 'create' will return a warning,
which is what we want). In that case, the record still needs to be
created.
To solve this issue, we simply add an option to the makeDefaultRecord
function to prevent rejecting the deferred.
* website
Unfortunately, we cannot guarantee that the duration between two odoo
actions is always less than 10 seconds. Indeed, loading translations
is for example quite slow. With this commit, we are now able to modify
the timeout duration for a specific step.
When a picking is available, any added stock move should directly be in
the available state. This is done thanks to a key in context put in the
one2many (stock.move) field on the picking view and an override of
stock.move's default_get. Sadly, an extension of the picking view in
stock_account redefined the context attributes, and the new context did
not have the special key we need. As all the context keys present in
stock_account are present in stock, we remove the extension. And we add
a simple test in stock.
* can't compare a function and a float in Python 3 (it works in
Python 2, though it makes no sense and was just hiding a bug)
* no iteritems method on dict in Python 3 (use compat helper)
* P3-invalid "except" syntax (sadly pylint apparently does not have a
standard lint for that, though it's easy to catch... if you can run
the code under P3)
* web_editor, web_planner, website
The 'Dialog' class is used in both backend and frontend. Also, lots of
actions can be done without the use of any modal. It thus makes sense
to lazy load its related xml only when a first modal is opened.
This change also allows to get rid of the "base_common.xml" file as the
dialog template is the only remaining one in there and, in the future
website update, it will allow to not load any static XML file on website
page loadings.
Qweb rendering is great to render "complex" widget structures. However,
using it to render something as simple as a button was not very
meaningful. This commit deletes the "WidgetButton" template and replaces
it with an utility JS function to render buttons according to given
parameters.
Also, this change will allow a better change. Before this commit, the
only templates left in the "base_common.xml" file are the "WidgetButton"
and the "Dialog" ones. With the removal of "WidgetButton", the file can
now be lazy loaded only if necessary, on the first dialog instantiation.
This will allow to remove the need to load static XML files on each
frontend page loading.
Thanks to @xmo-odoo and its Python3 virtual machine for spotting this
one (and shame on Python2 that does not crash when comparing a method to
a float because voilà).
Add the 'xmlDependencies' key to the 'Widget' class. If defined, it is
an array of URLs to XML files that the widget will need to work.
Those are loaded in the `willStart` method so that they are available
before all rendering parts.
- Refactor the function and document it
- Multiple calls to the function with the same URL now load the
templates only once
- A call to the function with an URL now returns a deferred which
indicates when the given URL has been loaded (not when all the
calls to the function are finished)
In order to be sure website is loaded and to allow searches in DOM require
on website was necessary. This is a partial revert of e66ba3ce1e
that was a bit hasty.
A special case was made for products not available when running a search on
the qty_available field.
For domains like ('qty_available', '<=', 5), it should include non-available
products too.
Fixes#18336
Create a company, try to install a coa without specify an Interbank Transfer Account (required field):
The COA can't be installed due to the missing Interbank Transfer Account that will be created by the COA... that leads to a "deadlock".
-opw: 752928
Purpose
=======
It is possible to break the installation of any module if a module that creates a product should be installed.
to reproduce:
set "all" as category of one product
then change "all" category to view type
then install pos (because pos installs one product)
you will get the error message in a traceback
See https://www.odoo.com/web#id=748876&view_type=form&model=project.issue&action=963&active_id=49&menu_id=4720
Specs
=====
remove "Category type" in categories
it seems to me the only usefulness of this was the deprecated tree view of product categories (no longer exists)
When we validate a SO with an MTO product, then an RFQ and a delivery
picking are created. The status of the delivery picking is in state
'confirmed', but should be 'waiting' as the delivery waits for a
specific delivery input.
The problem is caused by the unreserve method, which is called in the
'procurement_jit' module. This method only checks that a move has
ancestors to determine if the move should be in waiting or in confirmed,
which is not the case for our delivery move because the RFQ has not been
validated yet so there is not ancestors yet.
To fix this issue, we check the 'procure_method' of the move, and if it
is in 'make_to_order' we put it in 'waiting' instead of 'confirmed'.
We also fixed the function recalculate_move_state that could cause the
same problem.
- Create a tax using the tax template 'GST + QST for sales'
- Create a SO with the following lines:
Product 1 100 Units @ 0.1
Product 2 2000 Units @ 10.334
Product 3 2000 Units @ 10.334
Product 4 5000 Units @ 0.1
Product 5 1500 Units @ 0.1
- The totals are:
Amount without taxes: 41996.00
Taxes: 6288.90
When printed, the quotation gives:
Amount without taxes: 41996.00
Taxes: 6286.52
This is due to the method `_get_tax_amount_by_group`, which is using
`line.price_reduce` for tax computation. Since it is a Monetary field,
it is automatically rounded to the currency precision, while it should
be rounded with the same precision as `price_unit`.
Introduced in 99743cc4aa
opw-752487