Consider upgrading module 'base' on a database with millions of 'res.partner' records.
The upgrade of country and country state data makes a very costly search to reverse
the dependencies of the non-stored computed field 'contact_address', just for the sake
of invalidating its value from cache, which is most probably not present at all. The
cost of the search is so high that it may prevent from upgrading the module (timeout).
closesodoo/odoo#80251
X-original-commit: b7f9d0b7c3dfbca0f4897a650983a298da811ce1
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
In https://github.com/odoo/odoo/pull/78652 a fix was made in the layout
designer guaranteeing that the company_details field followed the correct
address format set by the company. However, this fix didn't take into account
all company data, making some `format_address`es raise a `KeyError`. This PR
fixes that by using the company_date defined in `_display_address`.
Fixes https://github.com/odoo/odoo/issues/78942closesodoo/odoo#79097
X-original-commit: 3cdc770c4966cef88362f8119a96de5501d21b18
Signed-off-by: Leonardo Pavan Rocha <lpr@odoo.com>
Because the field is stored it doesn't make much sense to have a
context dependency and that can cause significant issues. However
`name_get` looks pretty innocent and it's not necessarily insane to
have a context dependency *there* (or even in the average
`display_name` as they're normally non-stored computed fields).
`_compute_display_name` previously blanked (blacklisted) just a few
context values, but doing the opposite is probably the better idea.
See also: odoo/odoo#68946
OPW-2453956
Task 2500978
closesodoo/odoo#76469
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Since c53724ebc3, the contact image in contact kanban view for a shipping
or delivery contact type would be the regular placeholder instead of the truck
or money image.
Now, by using the new avatar system, we restore that behavior.
+ we also use that new avatar system to cleanup some code in the kanban in the
form view (`child_ids` field in `Contacts & Addresses` tab). That part was
working fine but wasn't using the new system and needed extra code.
closesodoo/odoo#75709
X-original-commit: a97cbdd033391af75628bed50accfef11c73687c
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
PURPOSE
This commit aims to improve the 'Contact Tags' sections of the 'Contact'
module by adding a color picker (on the list and the form view).
SPECS
- Add a color picker on the 'Contact Tags' sections (i.e: list and form view)
- Add a placeholder for the 'name' field of the form view.
- Update the label of the 'color' field.
LINKS
Task id: 2608410
closesodoo/odoo#74033
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
With commit odoo/odoo@83ffe8b we ensured that while creating a child contact, it
takes language from its parent by default if any, otherwise falls back to DB
lang.
The fix was done with help of `default_get` method. However after merge of
odoo/odoo#55995 `default_get` is now called through the onchange for o2m
fields. Now we don't get the default value of `parent_id` here which
re-introduced the bug.
This commit fixes the behavior by setting the language from onchange
while creating the child contact and thus (once again) making the
language from parent contact prevail on DB lang.
We also re-use default_lang coming from parent in form view, which partially
reverts odoo/odoo@83ffe8b .
TaskID-2416922
closesodoo/odoo#72960
X-original-commit: 4d9b85bd07e487e7843dc458332dede36c2889c2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit: when partner is only created with name(i.e. without
address) and when 'address_inline' is passed in context then partner name shows
with unnecessary commas.
After this commit: partner name will not have unncessary commas, as we removes
unncessary '\n' in case of 'address_inline' passed in context.
task-2502597
closesodoo/odoo#72869
X-original-commit: c08082d89782b7675e8e649cba15ca9e03e40077
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).
In this commit we replace report_footer and report_header field of
"base.document.layout, res.config.settings" model as
they are related fields of res.company models field
report_footer, report_header.
Task Id: 2499504
X-original-commit: 4c474d0d2055efe81fdc21502aa5957fe80af7ef
Description of the issue/feature this PR addresses:
It is currently quite difficult to differentiate users. Most of the time, people
don't take the time to upload an actual avatar so everybody looks the same. This
PR generates a custom avatar with the users initials and random color to
differentiate them. For res.users, res.partner and hr.employee, image fields now
hold the binary image and avatar are used to show the image or svg.
Current behavior before PR:
Avatar had only random colors and was being saved in database, being inefficient
Desired behavior after PR is merged:
A new mixin defines image fields and in case no image is set, it generates an
SVG image with the user's initials and random color.
closesodoo/odoo#69819
Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
The attributes field.depends and field.depends_context are problematic
for sharing fields across registries, because they depend on the model's
registry class, which may vary from one registry to another. In order
to make computed fields shareable, we have to move those values away
from fields.
For the same reason, field.recursive should not be inferred, because its
value may depend on the registry, although it is generally not the case.
Moreover, the flag recursive=True is set on a field when field triggers
are determined (on the registry). A compute method may be called before
the flag is set (if no update has been done yet), and that can lead to
incorrect computations.
This happened in test TestUsers2.test_reified_groups in module 'base'.
The user groups view was apparently determined without the flag being
set, and the view depends on the recursive field 'trans_implied_ids',
which was not correctly computed.
We thus force developers to be explicit about recursive computed fields.
The code now logs a warning when the flag is not set up properly.
set the specify placeholder for company partners from 'placeholder.png' to 'company_image.png'
After this commit, in the res.partner kanban view, if the company image of an individual is not set,
it will be shown as the 'company_image.png'(a company logo) rather than the 'plaeholder.png'(a camera logo).
closesodoo/odoo#68994
Taskid: 2491161
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
Steps to follow to reproduce the bug:
-Go to the Contact app
-Choose any contact
-In the contact form> go to the "sales & purchase" tab and try to assign a user in the "salesperson" fields
Problem:
You can choose any user regardless of their type. While normally we can only choose internal users
Solution:
Add a domain to the "user_id" fields to only see users of the kind "internal type"
opw-2468819
closesodoo/odoo#67642
X-original-commit: 1361686fe502be137a4757c9092fab4223d484f8
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Steps to follow to reproduce the bug:
-Go to sales
-Add a vat number with a '-' like: "123456789-5" to any customer
-Create a new SO
-Search the customer by entering their VAT number
Problem :
When the VAT number contains the character '-' you cannot find the customer with his VAT number.
The problem is the same if the vat number contains a '.'
Because, the "_name_search" method before creating the query to search clients by VAT number, removes all the special characters from user input
Solution :
Do not remove the characters '-' and '.' from the user input for the customer search by vat number.
opw-2457692
closesodoo/odoo#67355
X-original-commit: 3f54c1c7556c5d06759bf5ec74dd83872f0d24d2
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
* Add a new error message upon deleting the partner linked
to an active user.
* Improve the error message wording upon archiving the partner
linked to an active user. Add the linked users names at the end of
the message.
* If the user has 'write' access on res.users, raise a RedirectWarning
instead of a ValidationError, to offer an easy access to the related users :
- If there are multiple Users, redirect to a list view.
- If there is only one User, redirect to the form view.
* Adapt the test_access_deleted_records from test_orm.py to use a more
basic model : `res.partner.category` (with less business logic), because the
new unlink error message is dependent on a condition that will throw an error
in case of multiple unlinks of the same record (MissingError).
* Force close the frontend archive confirmation Dialog since _toggleArchiveState
may be interrupted by another Warning/Error Dialog. If the new Dialog was the
redirectWarning, and the user chose to be redirected, the first Dialog would
stay open even thought the context already changed.
* Modify the placeholders for a partner Name/Company
-> placeholders will change according to an Individual or a Company.
* Adapt the main_flow tour to correctly select the partner name field on
mobile (tested in enterprise).
Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
Before this commit:
When merging the contacts, chances are there that the name of records being
merged are exactly same, and so we might not be able to distinguish them
and so can not tell for sure that which records are being merged to which
destination record.
After this commit:
In the 'Destination Contact' field, now we also show ID of the partner
along with the name, so that end user can easily distinguish between
them. For this, we pass 'partner_show_db_id' on the context for that field from
view, allowing us to get expected result from the name_get by using this
context key.
Task ID-2323060
closesodoo/odoo#66026
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit:
- The precision on geolocalisation fields were set to (16,5) which
caused rounding when data was comming from Goolge.
After this commit:
- The precision on geolocalisation fields are set to (10,7) which is
aligned with what Google does.
This precision of (10,7) is actually already used in the Sign App.
task-2426985
closesodoo/odoo#64401
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Steps:
- Install Contacts
- Have Multi-Companies enabled
- Go to a Contact of type "Company"
- Click "Sales & Purchases"
- Assign it the company you're on
- Save and Edit again
- Remove the assigned company
- Go to a contact of type "Individual" linked to this company
- Click "Sales & Purchases"
Bug:
The company has not been deleted on the linked Individual
Explanation:
When we delete the company of a contact, the value of `vals.get('company_id')` is `False`.
This is why it didn't enter the propagation process.
This fix makes sure we can still remove a company from a contact linked to a user.
Related: https://github.com/odoo/odoo/pull/62418
opw:2391464
closesodoo/odoo#62591
X-original-commit: 59413ad88a97b3221526c2b560178a0f94ddee05
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
Steps:
- Install Contacts
- Have Multi-Companies enabled
- Go to a Contact of type "Company"
- Click "Sales & Purchases"
- Assign it the company you're on
- Save and Edit again
- Remove the assigned company
- Go to a contact of type "Individual" linked to this company
- Click "Sales & Purchases"
Bug:
The company has not been deleted on the linked Individual
Explanation:
When we delete the company of a contact, the value of `vals.get('company_id')` is `False`.
This is why it didn't enter the propagation process.
opw:2391464
closesodoo/odoo#62464
X-original-commit: 80902bee453cf485906bb07be6af9072aee2e76f
Signed-off-by: backspac <backspac@users.noreply.github.com>
The custom vat index name matched the name that the system uses for automatic
indexes (when a field has `index=True`).
But the `vat` field was created with `index=False`, and this means that the
ORM would execute a `DROP INDEX IF EXISTS res_partner_vat_index` when updating
any addon that touches the `res.partner` model. Since this model is so
ubiquitous, this resulted in a ton of unnecessary `DROP INDEX` + `CREATE INDEX`
queries when updating any database.
What's even worse is that dropping or creating an index needs a complete
semaphore lock of the whole table, so if you're updating a high-traffic HA
production instance while it is running, you have a very high rate of concurrency
failures, because almost everybody is going to be using the `res.partner` model
in some way almost all the time.
A deeper investigation reveals that the index itself was useless. It was added in
a6e1eb9 and apparently meant to be used for optimizing name_search(). But even
though a6e1eb9 modified name_search(), it did the substitution in Python[1], so
in practice the database had no way to recognize the pattern and never used the
index. The specificity of that index makes it useless for other cases too, so it
can simply be dropped to save space.
Further, considering that the `vat` field is a common search criterion, it
actually makes sense to enable a normal index on that field, by setting
`index=True`. Neither dropping the index nor creating the default one has any
impact on existing databases, so it's safe in a stable series. A new
installation or a forced update will be necessary to benefit from the changes.
~~Finally, because the bad custom index had the same name as the regular one, an
upgrade script is foreseen to drop the old one before letting the ORM re-create
it properly.~~
Fwd-port note: the upgrade script and version bump were reverted as a
consequence of the unforeseen consequences in #60771.
1: https://github.com/odoo/odoo/blob/a6e1eb9f0ad285fac7d0ca0b9f89f046d78ec9c7/odoo/addons/base/models/res_partner.py#L710
@Tecnativa TT26303
Closes#60346
See also: #60771closesodoo/odoo#60862
X-original-commit: 2f4a7de3d25cec36ac3b85e3f33122728346c206
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Issue
- Change country to Mexico
- Install 'CRM'
- Install 'l10n_mx_edi'
- Try to open any lead in 'CRM'
The same error is present in l10n_pe
Cause
'l10n_mx_edi' and 'l10n_pe' use 'res.partner' in 'ir.ui.view'
Solution
Adding a condition to prevent '_fields_view_get_address' in 'format.address.mixin'
from rewritting the model and let ir.ui.view determine it
opw-2361875
closesodoo/odoo#60463
X-original-commit: 3229239c2a738cc99820dba0fce1bd1c2a3536ea
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
Three cases were not covered:
- If the partner with duplicated VAT is inactive (false negative).
- If there are specific contact record rules that hides some of the results for
that user (false negative).
- If the user have several companies viewed at the same time, but the contacts
don't overlap the company scope (false positive).
We cover all of them with this modification.
Was PR #53701closesodoo/odoo#57859
X-original-commit: 35cd931735e2092e08b2cf59434fb3bd579b12ea
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
In this commit we set tree view of partners (contact) as multi edit enabled.
As some fields still rely on onchange, they are kept readonly in tree
view, notably state_id / country_id, parent_id, is_company.
Email has an onchange used only in form view. It enables gravatar. As it is
not really business critical multi edit on phone is available.
Specifications: Contact (res.partner): base.view_partner_tree
phone
email
company_id
city
state_id
country_id
category_id
date_review_next
grade_id
user_id (+ add a limitation to not share users)
Task ID-2200674
PR #56378
X-original-commit: 5b87603b7620da1badd860abb97d5bcacfc96ad5
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.
Avoid concatenation of translated strings & raw values and/or other
translated values, and use the new _ API (by providing the formatting
values to ensure the fallback on the english terms in case of wrong
translation).
By including the expected values inside the string to translate, we
ensure that the formatted values are included at the right place in the
resulting translated text.
This also provides more information on the string to translate to
the translators, s.t. the chosen terms for the translations can be more
adapted to the translation context.
closesodoo/odoo#54635
Related: odoo/enterprise#11925
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
In 6e25a510b3 `find_or_create` was
modified to return a recordset rather than just an id. This made it
incompatible with the RPC protocol and it was not annotated to
downgrade the return value back to an id.
Fixesodoo/odoo#54466closesodoo/odoo#54476
X-original-commit: a7e3894e20207b714cebefa908be090967866791
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))
Old syntax is still compatible but starts the migration to the new
syntax that catches error.
Part/Fix of commit #e579642
Issue
The condition `default_type not in self._fields['type'].selection`
always evaluate to True as the selection is list of (key, value)
tuples.
Solution
Replace the tuples by a list of possible values.
opw-2256905
closesodoo/odoo#52501
X-original-commit: 1b21c674c6de3ef96d7938c3e99b36d7cb2f2b6e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
Issue
Step done with "CRM" since main kanban view can be
grouped by 'res.partner' model:
- Install "CRM" app
- Go to crm and group by "Customer".
- Add a Column.
Traceback is raised.
Cause
Wrong "default_type" in context ('opportunity' in this case)
when creating new kanban stage and grouped by "Customer".
Solution
On "default_get" for "res.partner", if "default_type" is in
context and not in 'type' selection choices field; then
remove it from context.
Cherry-pick of #47723 in 12.0
opw-2256905
closesodoo/odoo#52282
X-original-commit: e5796429c8adcbb929cb032cdfd2cbaba835b086
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Commit d5d2c5524c improved the UrlWidget s.t. it automatically
prefixes the url with 'http://' if no protocol is specified (except
for own website paths).
In addition, it removed a logic specific to model res.partner that
automatically prefixes the saved website values with 'http://'.
However, the second part should not have been done: those urls can
be displayed without UrlWidget (e.g. on the website), and in this
case, the protocol wouldn't be set, meaning that it would behave
like a relative link.
closesodoo/odoo#52113
X-original-commit: 5a8690bb64cb3dc01ee8d4f9af3a6ab91eee8b99
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Issue
- Install Contacts
- Create a contact: Company A
- Add a contact to that company: John
- Add a private address for John
- Save
- Change John's company
- Go back
- Look for the private address
The display_name contains the old
company name
Cause
The private address display_name is
not recomputed when the contact's
company changes.
Solution
Recompute child_ids display_name
when the company changes.
OPW-2253785
closesodoo/odoo#51450
X-original-commit: b112c8921eec60c63cead37c74946d06b499eb6a
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Steps to reproduce:
- Create a second company
- Enable this company only
- Create a new company
=> Access error is raised because the `intercompany_user_id` is
OdooBot by default and OdooBot's partner cannot be read from
other companies. Hence, the company creation fails.
Like all other internal users/partners, OdooBot's partner should
be shared across companies, even if its user is inactive.
Task 2157039
See also 2390ba6
Task 2157039
closesodoo/odoo#50372
X-original-commit: 379d14d4aa7862176fb7e3f79292a1228c254aa9
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
Purpose
=======
For a tag to be displayed on a kanban card, it needs to have a color set.
We won't be changing that behaviour, since it would mean having
two options > the color, and whether or not to show it in the kanban
The purpose of this task is to set a color on new tags to make the user
save a bit more time, set a color for him as he might not find the feature,
and make sure the tag will be on the kanban cards.
Specification
=============
For each of the following models, at creation, set a random integer between
1 and 11 in field 'color'
Models:
res.partner.category
crm.tag
project.tags
hr.applicant.category
helpdesk.tag
hr.employee.category
event.track.tag
mrp.eco.tag
repair.tags
closesodoo/odoo#49967
Taskid: 2234527
Related: odoo/enterprise#10112
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Purpose
=======
If a user specifies a language on a company (res.partner), chances are children
of said company will speak the same language. It is at least most likely than
having them speak the default DB language.
Specifications
==============
If a language is set on the parent, the child contact created from the o2m
should have by default the same language.
Before this commit, we set lang in the context of the o2m field but it not
taken into account and is overriden by the default DB lang.
After this commit, the default lang value is forced in the default get to
be the same than the parent, if any. Else, we fallback to the default DB lang.
Link
====
Task ID: 2210350
PR #48077
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Rewrite code parsing name (_parse_partner_name) to make it easier to
understand. Tweak find_or_create to return directly a recordset with the
found partner / new partner instead of a name_get result.
Also inherit Partner.find_or_create() in mail in order to benefits from
email_normalized field, allowing to improve the search on matching emails
and avoid duplicates.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
The synchronisation of commercial_partner_id was introduced at
0d68acff8e as a way to ensure the value is always correct.
The order or the operation was not important though.
This synchronisation has a side effect in the following scenario:
0. install base_vat
1. disable vat_check_vies in the settings
2. set an invalid VAT number on a company with at least one contact
3. enable vat_check_vies in the settings
4. correct the VAT number on the company with a valid one
--> an error was raised for an invalid VAT number on the contact
This is because the commercial_partner_id synchronisation is done
before the update of the VAT number. Even if the value has not
changed, this triggers the check_vat method.
Invert both instructions
Courtesy of Wolfgang Taferner
Closesodoo/odoo#43065Closesodoo/odoo#42973closesodoo/odoo#47543
X-original-commit: d9b2605eadc129924d085fffc4056d777cfbbbeb
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
With this commit, the url widget automatically prefixes the href
url by http:// if no protocol is specified, so that clicking on
the url will by default redirect to an external website.
To prevent this behavior, one can still specify the new option
'website_path: true' on the url field node in the view arch.
Thanks to this, we can remove a similar logic (only implemented on
res_partner model) which automatically altered the value saved in
database to force its 'http://' prefix.
task-2153184
closesodoo/odoo#42118
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Steps to reproduce the bug:
- Let's consider a company partner P with company_id = A
- Let's consider an other partner C which is a child of P
- Change the company_id of P to B
Bug:
The company_id of C was not changed even if the field company_id
of C is in readonly as he has a parent.
opw:2179632
closesodoo/odoo#44061
X-original-commit: f41f7dc0f4f2a1682c6f81aba6512306ecf86067
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Bug in 13.0 regarding company_id field of partners when creating them from
their parent contact or when setting their parent.
The field 'company_id' of res.partner is set by an onchange on 'parent_id'
to that of it's parent; unfortunately the field is readonly if parent_id
is set and not set to force_save.
Furthermore, creating a child partner from the main one (in the 'Contact'
tab of the main partner form view) does not follow the same behaviour
(company_id is unset in that case, meaning that children don't have
the same company as their parent).
Since the company_id is already set by an onchange when we change 'parent_id'
and set to readonly in that case, I assume the expected behaviour is actually
that children partners should have the same company as their parent by default.
Fine tuning of 7b49f5836c
opw:2176384,2167106
closesodoo/odoo#43621
X-original-commit: 92737f21acf9b044df99e111fceffc08e05abe65
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
``_split_street_with_params`` method is defined in base, on partner model. It
is redefined in ``base_address_extended`` without calling super. Only that
module use it. That means that the base implementation is not used anywhere
in the codebase, leading to dead code. Let us remove that method.
Task ID 2158302
PR odoo/odoo#42678
Create a new contact (just open the create form)
The "Language" field is missing, because active_lang_count is not
computed before the record is saved, but it is necessary to display the
language field
opw-2149324
closesodoo/odoo#41172
X-original-commit: 4c90fde44e463979de9c6c1f5acb5c5e0c469c21
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>