Create two models, `object` and `category`. The object have a Many2One
to the category. Override the `search` on the category so it returns a
subset of the records if a context key is present. Create an IR Rule on
object with the following pseudo-domain: `categ_id in category.search([])`.
Search on object with the context key present. Even if the context
should only be applied to category, it is applied to object too thus
there are some object missing.
When evaluating the domain of IR Rules, the current user is propagated
with the current environment context. API calls triggered by the domain
are called with the given context, possibly populating the cache with
different records than it would normally does without the context (i.e.
at `addons/point_of_sale/models/account_journal.py#L19-L23`). Following
requests do use that invalid cache thus return invalid results.
Forcing an empty context on the user used during the evaluation of the
context ensures the IR Rules are working as they should and is
future-proof (cf `load_company` v13 context key)
opw-2041667
closes#35123closes#35125closesodoo/odoo#35667
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Co-authored-by: Hugo Adan <hugo@vauxoo.com>
When accessing a SO's tasks from Contacts (the partner_id's page), and
calling action_view_task, the active_id first corresponds to the contact's id.
Therefore, if a project.project exists with the contact's id, one can access
the SO's tasks, but otherwise, we get the error
Record does not exist or has been deleted.
(Records: [partner_id], User: ...)
Thus, if there is one corresponding project, we first update the context:
active_ids is set to project_id,
allowing access to the SO's corresponding project's tasks.
Note that the same thing is done lower:
eval_context.update({'active_id': task_projects.id})
which is too late to avoid trying to access the wrong record.
In the case where there are more than 1 corresponding projects (or if
there are no corresponding tasks), we don't have the issue.
OPW 2052559
closesodoo/odoo#35792
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
In some cases, the first request of a test is made before the
proper setting of the cookie. In that case, Odoo picks a new session,
leaving the request unauthenticated.
closesodoo/odoo#35780
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
- Create Event (Where All Day is Set to False)
- Edit Event > Check 'All Day', make it 'Recurrent'
An error occurs because a mandatory field is not set (`stop_date`).
It is possible to work around the issue by doing:
- Check 'All Day'
- Save
- Make it 'Recurrent'
However, the result should not depend on the order we perform the
action. To solve this we send data to server with `force_save`.
Fixes#27269Closes#33068closesodoo/odoo#35758
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
From the Maintenance app go to "Settings">"Equipment Categories".
Create a new category, insert a name and save. An alias get
automatically created with the same name as the new category.
The new alias point to "Maintenance Equipment" model, so when
an email is matched with the alias a new equipment under the new category
is created. This is indeed the default behavior but the help message
is deceiving the user. Changing it.
opw-2049830
closesodoo/odoo#35728
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Rewrite the product associated to a serial number.
There is a check to forbid this if some move lines already exist.
This check does not actually care what value is written,
so it can raise uselessly (and forbid a legitimate write).
opw 2049717
closesodoo/odoo#35736
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
In case a User is defined as Expense Responsible for another
user, and if he has Officer Expenses Rights, he cannot validate
an expense while it should be the case.
opw-2043985
closesodoo/odoo#35711
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
From the Inventory (stock) application go to Operations>"Batch Pickings"
Create or open an existing Batch Picking and click on "Print".
A report will be generated containing the barcode associated with the
operations. The barcode cannot be read from a barcode scanner because
it's too blurry (probably because of the low quality it contains
an unnatural greyscale).
When this report is generated from the template, a request to generate
the barcode is sent to the controller, which invoke the procedure to
create the png image on the fly with a set of parameters embedded into
the request.
If the width and height parameters are too low the result is a low
quality image, so the solution is to pass higher parameters and then
resize the image via "style" attributes.
Note that the same solution is applied in multiple templates.
opw-2045949
closesodoo/odoo#35752
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Make sure we don't execute the method with an empty list of candidates
to avoid a zero division.
opw-2049881
closesodoo/odoo#35723
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Steps to reproduce the bug:
- Let's consider two company C1 and C2 and a user U allowed for this two companies
- Create a storable product P tracked by serial number
- Create a PO in C1 with P and deliver it with a serial number SN
- Go to Inventory>Master data>Lots/Serial Numbers
- Change your current company to C2
- Click on SN
Bug:
An access rights error was raised because the system tried to compute SO and PO linked to SN
with the moves of all the companies. So the record rule "stock_move multi-company" was
raised.
opw-2049093
closes#35694
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Pdf files created with third party tools could trigger an exception in
several modules that attempt to manipulate them (see example below).
```
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2239, in mergePage
self._mergePage(page2)
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2277, in _mergePage
originalContent, self.pdf))
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2199, in _pushPopGS
stream = ContentStream(contents, pdf)
File "/usr/lib/python3/dist-packages/PyPDF2/pdf.py", line 2673, in __init__
stream = BytesIO(b_(stream.getData()))
File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 845, in getData
decoded._data = filters.decodeStreamData(self)
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 346, in decodeStreamData
data = FlateDecode.decode(data, stream.get("/DecodeParms"))
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 111, in decode
data = decompress(data)
File "/usr/lib/python3/dist-packages/PyPDF2/filters.py", line 49, in decompress
return zlib.decompress(data)
zlib.error: Error -5 while decompressing data: incomplete or truncated stream
```
This is caused by the decompression function used by default in PyPDF2
which uses a limited buffer, unable to store all the data.
The solution, as per
[zlib documentation](https://docs.python.org/3/library/zlib.html#zlib.decompressobj),
is to use an intermediate ```decompressobj``` object to handle
the decompression.
However we do not directly control the library, which is also used
multiple times in the codebase so we decided to apply a fix directly into
the core module instead of patching every call.
opw-2048029
closesodoo/odoo#35646
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Install Email Marketing (mass_mailing) without Website.
From Email Marketing app, under Configuration -> Settings
the section "Mailing List" is empty.
This is not the expected behavior: any empty section should not be
visible.
To avoid breaking some third-party app which could rely on the element
'<div id="mailing_list" class="row mt16 o_settings_container"/>'
we choose to hide the title of the affected section, re-enabling it when
the appropriate app is installed.
opw-2045481
--
I confirm I have signed the CLA and read the PR guidelines at
www.odoo.com/submit-pr
closesodoo/odoo#35491
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
The decimal precision must not be dependent of the current company's decimal places. E.g:
Create a move Z in the company A where decimale precision is 5.
Switch into the company B having a decimale precision of 8.
Edit the move Z, an error can appear because the decimale precision is now 8 instead of 5.
closesodoo/odoo#35572
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Because of a whitespace character present at the beginning of the message_id of some mails,
they were fetched twice.
From the SQL side, we see that Outlook is formatting the header following the RFC822
by allowing the header to look like:
Header:<CRLF>
<whitespace><hash_of_msg_id>
From RFC822:
"Each header field can be viewed as a single, logical line of ASCII characters.
For convenience, the field-body portion of this conceptual entity can be split
into a multiple-line representation" (abr.)
It was also possible to find out by checking the logs.
One or two whitespace(s) can be seen before the hash of the msg_id.
The following commit is making sure we use and save the message_id without the whitespace
by stripping them off on the coming mail.
OPW-2006806
Applying CHS solution to avoid crash on empty header.
closesodoo/odoo#35682
Signed-off-by: bve-odoo <Abridbus@users.noreply.github.com>
In case `move_line_ids.location_id.company_id` or
`move_line_ids.location_dest_id.company_id` is not set, the fallback
value is `False`. Indeed:
```
>>> True and False or True
True
```
This makes `company_from.id` or `company_to.id` crash.
We keep the logic but change the condition:
```
>>> False if True else True
False
```
opw-2045628
closesodoo/odoo#35695
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Use category sequence to order them instead of their order of appearance in
the list of sequence ordered attributes
closesodoo/odoo#35610
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Before this commit, every model having website_id would have the default
`set null` as ondelete value for that field. Exception for `ir.ui.view` and
`website.redirect` which are set to `cascade`.
This meant that deleting a website would basically transform all its specific
records into generic ones.
That would lead to unwanted behavior, such as multiple `ir.attachment` with
same URL, when 2 websites had been theme-customized. Deleting one of the
website would result in later crashes when trying to open theme customization
in the remaining website(s), since those website would find their specific scss
custom attachment as well as the generic one from the deleted website.
Probably more behavior might be problematic when deleting a website before this
commit.
To summarize the choice of this commit implementation, every model not existing
outside website module are set to `cascade` (website.redirect, website.menu,
product.wishlist..).
The rest should be in restrict, as we don't want to delete a whole forum, blog
or job, which should probably be managed case by case to decide what to do.
Thus, restrict is a good choice to notify user of what should be handled.
Some exception remains, ir.ui.view should be delete on cascade while sale.order
should be set to null.
opw-2038414
opw-2035249
closesodoo/odoo#35398
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
If there is no product on an invoice line, there is an onchange to ease tax
input that prefills the line with the account default taxes.
Because this is a relational field (a many2many), field = recordset
is as valid as field = recordset.ids, but the semantics is different.
In the second case, the id list is added with 4 commands, not a 6.
So the default taxes are only added, and none are ever removed.
Note that the ORM behaviour changed; this .ids was historical,
but before (v10) it did remove other taxes.
opw 2046112
closesodoo/odoo#35657
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
In other words, when a field F depends on a non-stored field G, it also depends
on G's dependencies. This guarantees that whenever a dependency of G is
modified, F will be invalidated and marked to recompute (if necessary).
The transitive closure of dependencies is not computed over stored fields.
Anyway stored fields already trigger the recomputation of their dependent
fields during their recomputation. The performance impact on the loading of a
registry is negligible (less than 1%), and the increase of recomputation
triggers is small (less than 10%).
(cherry picked from commit 3fbd86bcbe)
opw-2033493
closesodoo/odoo#35636
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
- Change the company's country to Finland;
- Go to Contacts and click on Create;
- Tick the Company box above the Name field;
- Start typing into the Name field;
- Click on a company with a VAT number under its name.
Before this commit, a Traceback appears. This occurs because the
response of the request with the suggested company has the fields
'company_name' and 'company_code' and these fields are not in
res_partner.
Now, the suggested company is parsed to correctly field the country
field.
opw-2049636
closesodoo/odoo#35631
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Steps to reproduce:
- Create a service product P with invoicing policy = Timesheets on tasks,
Service Tracking = Create a task in a new project and Re-Invoice Policy = No.
- Create a SO with P and confirm it
- Go to the task created for the SO and assign an employee on it.
- Valide the related analytic line in the timesheet module
- Create a user U with the following rights: Sales: 'User: all documents',
Project: 'Manager' and no right in Employee.
- Log as U and try to invoice the SO
Bug:
An access rights error was raised
opw:2044659
closesodoo/odoo#35656
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
- Create a PO, change the Purchase Representative (`user_id`)
- Create the corresponding vendor bill
The `user_id` of the PO is not transferred to the invoice.
There is no reason to not keep the value.
opw-2046963
closesodoo/odoo#35611
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Add Angolan code in order to use Angolan specific translations in Odoo.
The main terms are the same but the technical terms are different
Closesodoo/odoo#35592closesodoo/odoo#35600
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
The local events snippets is an empty HTMLElement which is filled by
JavaScript on page loading. Before this commit, the filled content was
saved in database. This does not create a real problem as the content
is reloaded as soon as the page loads but you can see old events
flickering before the new events are actually loaded.
Now the snippet is cleaned before saving. This also allows to add
default content with a custo so that it is shown during the events
loading (as we are currently doing on odoo.com...).
closesodoo/odoo#35597
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Backport from 12.0, commit : 1b753b0d53
note: there was also report of PDF content blocking that when indexed
blocked an instance worker indefinitely
Since PyPDF2 gives bad results for PDF indexing, stop using it since it
raises more issues than it helps users.
opw-2044679
closesodoo/odoo#35310closesodoo/odoo#35525
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Steps to reproduce the bug:
- Install stock_dropshipping module and enable Routes on SO lines
- Create a storable product P with a supplier S
- Create a SO with P and set this line with the route dropship
- Confirm the SO ( a PO has been created to S with P)
- Change P on the SO with an other product
Bug:
The product P stayed on the PO.
So a product linked to a PO line cannot be changed on a SO.
Do not forward-port in 12.0 and upper
opw:2040249
closesodoo/odoo#35454
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Make a transfer payment from bank to cash
validate, check the journal entries
You see that there are two moves, each with the name
given by their journal's sequence (one in bank, one in cash)
Now, unreconcile, and cancel the payment
set it to draft, re-confirm it
Before this commit, the entries created had the same name which was
the name of the previous journal entry
This was because, at cancel time, the move_name of the payment was not reset
After this commit, the move name is reset on cancel, and both
journal entries have a new sequence based name when
confirming the payment the second time
OPW 2046412
closesodoo/odoo#35478
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>