Commit Graph
193 Commits
Author SHA1 Message Date
Yannick Tivisse 232d66069a [IMP] sale: Make some field precomputed 2021-12-02 12:12:03 +01:00
Florent de Labarre 49a23bb3fa [FIX] base: simplify field dependencies to avoid costly invalidation
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).

closes odoo/odoo#80251

X-original-commit: b7f9d0b7c3dfbca0f4897a650983a298da811ce1
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-23 13:55:01 +00:00
Florent de Labarre d9300962c1 [REF] base: add _is_public on partner
To be use in mail, ... and prevent issue with archived partner

closes odoo/odoo#70665

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 14:07:43 +00:00
Leonardo Pavan Rocha e5024ead26 [FIX] base: fixes layout designer not containing company data
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/78942

closes odoo/odoo#79097

X-original-commit: 3cdc770c4966cef88362f8119a96de5501d21b18
Signed-off-by: Leonardo Pavan Rocha <lpr@odoo.com>
2021-10-27 19:23:47 +00:00
Xavier MorelandRaphael Collet 97a1568db3 [FIX] base: completely wipe context in res.partner's display_name
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

closes odoo/odoo#76469

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2021-09-20 19:03:53 +00:00
Xavier Morel 5e81361f80 [FIX] *: opt parent_path fields out of unaccent
closes odoo/odoo#76436

Related: odoo/enterprise#20822
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-09-20 12:53:01 +00:00
wan a0f38c6d97 [IMP] *: partner back2basics 15.0
Review the whole view generally

task-2605931

Part-of: odoo/odoo#75862
2021-09-07 15:50:00 +00:00
Romain Derie 23c88405a9 [FIX] base: restore delivery and shipping image on contact in kanban
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.

closes odoo/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>
2021-08-31 08:47:14 +00:00
Julien Banken 58dc01a9a0 [IMP] contact: Add a color picker on the 'Contact Tags' sections
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

closes odoo/odoo#74033

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-20 11:34:40 +00:00
Anjali 02fbc24024 [FW][FIX] base: make parent contact lang prevail on DB lang
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

closes odoo/odoo#72960

X-original-commit: 4d9b85bd07e487e7843dc458332dede36c2889c2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-29 17:43:39 +00:00
Mohammed Shekha f9629c546d [FIX] base: partner name displayed with unnecessary comma
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

closes odoo/odoo#72869

X-original-commit: c08082d89782b7675e8e649cba15ca9e03e40077
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-06-28 12:55:24 +00:00
dht-odoo 1ef6fd9098 [IMP] web, {base}_setup: improves field type from text to html
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
2021-06-07 05:21:40 +00:00
Leonardo Pavan Rocha c53724ebc3 [IMP] *: adds generic user avatar
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.

closes odoo/odoo#69819

Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-01 14:36:23 +00:00
Raphael Collet 34d6f87d54 [REF] core: put field.depends on registry and make field.recursive explicit
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.
2021-05-03 12:33:29 +00:00
Chong Wang (cwg) 85e1c447df [IMP] base: specify placeholder for company partners
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).

closes odoo/odoo#68994

Taskid: 2491161
Signed-off-by: Arnaud Joset <arj-odoo@users.noreply.github.com>
2021-04-16 09:01:46 +00:00
Laurent Smet 6db346767e [ADD] account_edi_ubl_bis3,l10n_nl_edi : added bis3 and nlcius formats
closes odoo/odoo#68514

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-01 14:58:20 +00:00
Yannick Tivisse e896f4a3cf Revert "[FIX]base: fix domain of "user_id" field in res.partner"
This reverts commit a6c26aedf4c8043ac79b241acf6d69d1498f0acd.

closes odoo/odoo#68466

X-original-commit: 18281db9c918ff7b2b0c2fba841ffd8a141f046f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-29 11:42:19 +00:00
Djamel (otd) a8f8999409 [FIX]base: fix domain of "user_id" field in res.partner
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

closes odoo/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>
2021-03-11 09:29:51 +00:00
Djamel (otd) 313bd0a2be [FIX] base: fix the customer search by vat number
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

closes odoo/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>
2021-03-05 14:27:38 +00:00
Damien Abeloos 162f3059d5 [IMP] base: modify some displayed texts for res_partner
* 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
2021-03-03 12:12:47 +00:00
ijas ahammed eca92a97be [IMP] base: display db ID along with name in partner merge wizard
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

closes odoo/odoo#66026

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-02 14:12:50 +00:00
Laurent Stukkens (LTU) fe5a6cc5e8 [IMP] base, website_crm_partner_assign: increase geoloc precision
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

closes odoo/odoo#64401

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-12 12:11:29 +00:00
nie 2e24fd383e [FIX] base: company not deleted on linked partners
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

closes odoo/odoo#62591

X-original-commit: 59413ad88a97b3221526c2b560178a0f94ddee05
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-11-30 10:28:35 +00:00
Julien Castiaux 90b52d144a [REF] base: Use Command helper for x2many
Task: 2366606
2020-11-30 10:16:09 +00:00
nie f94b490508 [FIX] base: company not deleted on linked partners
This reverts commit 80902bee453cf485906bb07be6af9072aee2e76f as the
backport to 12.0 did not apply.

closes odoo/odoo#62523

Related: https://github.com/odoo/odoo/pull/62418
X-original-commit: d6b50b76432d620a86f3a1c63523cb4122b95709
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-11-27 12:31:04 +00:00
nie 9d0773b6ab [FIX] base: company not deleted on linked partners
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

closes odoo/odoo#62464

X-original-commit: 80902bee453cf485906bb07be6af9072aee2e76f
Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-11-26 17:54:26 +00:00
Ivan Yelizariev 6851e20027 [FIX] base: add sudo on reading ir.ui.view
STEPS:

1/ Fresh copy of base runbot 14.0
2/ Change country on the company to 'Mexico'
3/ Install apps Sales and Contacts
4/ Login as 'Demo' and try to access Contacts

BEFORE: Access Error

AFTER: No errors

WHY:
* since Odoo 14 only admin can read ir.ui.view: https://github.com/odoo/odoo/commit/ccc98e01691b88c2da9c484c0e6de235b9d18548
* https://github.com/odoo/odoo/pull/60329

---

opw-2378336

closes odoo/odoo#62110

X-original-commit: 7ae0e00738a0bcedb4b36049ce4364f46c7d899e
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2020-11-20 16:07:42 +00:00
Jairo Llopis c84c17fea3 [FIX] base: replace useless vat index with regular one
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: #60771

closes odoo/odoo#60862

X-original-commit: 2f4a7de3d25cec36ac3b85e3f33122728346c206
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-10-27 17:34:40 +00:00
Achraf (abz) e37b0707e6 [FIX] base: Invalid parent_id field in crm.lead for Mexico
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

closes odoo/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>
2020-10-21 14:40:12 +00:00
Pedro M. Baeza be86b5afa8 [FIX] base: More rigorous duplicated VAT check in contacts
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 #53701

closes odoo/odoo#57859

X-original-commit: 35cd931735e2092e08b2cf59434fb3bd579b12ea
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-09-16 14:04:05 +00:00
Mehdi Outagant 14198a25cb [REF] base: allow multi edit on partner tree view on a subset of fields
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
2020-08-25 15:43:44 +00:00
Raphael Collet 1f48130d2b [REF] core: _name_search() now returns a list of ids
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.
2020-08-18 13:02:41 +00:00
Victor Feyens e8893f84ab [IMP] *: translations improvements
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.

closes odoo/odoo#54635

Related: odoo/enterprise#11925
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-07-23 12:13:19 +00:00
Xavier Morel 470fb905a9 [FIX] base, mail: properly annotate Partner.find_or_create
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.

Fixes odoo/odoo#54466

closes odoo/odoo#54476

X-original-commit: a7e3894e20207b714cebefa908be090967866791
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-07-15 07:36:23 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
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.
2020-06-18 13:03:34 +02:00
Nasreddin (bon) feb07b02e4 [FIX] base: Fix condition on selection field always evaluating to True
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

closes odoo/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>
2020-06-05 11:28:30 +00:00
Swapnesh Shah 2c62d1bc22 [FIX] base: Wrong 'default_type' on create kanban stage grouped by 'Customer'
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

closes odoo/odoo#52282

X-original-commit: e5796429c8adcbb929cb032cdfd2cbaba835b086
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-06-02 16:13:30 +00:00
Aaron Bohy c8f4098a51 [FIX] base: restore _clean_website on res.partner
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.

closes odoo/odoo#52113

X-original-commit: 5a8690bb64cb3dc01ee8d4f9af3a6ab91eee8b99
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-05-28 14:30:57 +00:00
jvm-odoo 39e93532c7 [FIX] base: fix partner childs display_name not recomputed
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

closes odoo/odoo#51450

X-original-commit: b112c8921eec60c63cead37c74946d06b499eb6a
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-05-18 12:55:10 +00:00
Lucas Lefèvre 63e47974bc [FIX] base: Make OdooBot partner cross company
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

closes odoo/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>
2020-04-29 09:13:07 +00:00
Yannick Tivisse 85b199b9be [IMP] various: Set a default random color on certain tags
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

closes odoo/odoo#49967

Taskid: 2234527
Related: odoo/enterprise#10112
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-22 11:32:35 +00:00
Robin Heinz fba2f5d331 [FIX] point_of_sale: barcode from pos to base.
Switch the declaration of the field barcode to the base module instead of the point_of_sale module.

closes odoo/odoo#41658

Task-id: 2069831
Related: odoo/enterprise#6736
Related: odoo/upgrade#984
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-03-30 08:42:26 +00:00
David Beguin 83ffe8b50b [FIX] base: make parent contact lang prevail on DB lang
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>
2020-03-23 09:57:09 +00:00
Thibault Delavallée 6e25a510b3 [REF] base, mail: improve partner creation from name / email
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
2020-03-24 10:24:14 +00:00
Martin Trigaux b53614fcc5 [FIX] base_vat: apply child changes before propagation
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

Closes odoo/odoo#43065
Closes odoo/odoo#42973

closes odoo/odoo#47543

X-original-commit: d9b2605eadc129924d085fffc4056d777cfbbbeb
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-13 08:20:32 +00:00
Dhruv Patel d5d2c5524c [FIX] base,web: url widget: add protocol in href
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

closes odoo/odoo#42118

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-30 14:03:36 +00:00
Goffin Simon edb9dad5f2 [FIX] base: Changing company_id of a partner with child_ids
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

closes odoo/odoo#44061

X-original-commit: f41f7dc0f4f2a1682c6f81aba6512306ecf86067
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-01-28 08:48:06 +00:00
Damien Bouvy 2f900d4f1c [FIX] account, base: Creating contacts from their parent or setting their parent
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

closes odoo/odoo#43621

X-original-commit: 92737f21acf9b044df99e111fceffc08e05abe65
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-01-21 10:00:55 +00:00
Thibault Delavallée fecea95ed8 [IMP] base: remove dead code from partner model
``_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
2020-01-07 14:53:45 +00:00
Andrea Grazioso (agr-odoo) ae9c2487c8 [FIX] base: force compute active_lang_count
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

closes odoo/odoo#41172

X-original-commit: 4c90fde44e463979de9c6c1f5acb5c5e0c469c21
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-12-02 09:08:49 +00:00