Steps to reproduce the bug:
- Create a german contact C with street1 = 'Istanbulstraße 22-26'
- Install base_address_extended
- Go to C and edit it
Bug:
'Istanbulstraße' was displayed in the number of the street
PS: A post init hook is needed otherwise the default street_format
'%(street_number)s/%(street_number2)s %(street_name)s' was always used.
opw:2320385
closesodoo/odoo#58905
X-original-commit: a97d981b9dd96b0066e09d763eff10a6ca70819c
Signed-off-by: Simon Goffin (sig) <sig@openerp.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.
Purpose is to make code follow guidelines so that we understand that
some methods are used for computed stored inverse fields.
Task ID 2158302
PR odoo/odoo#42678
Purpose is to reorganize code according to guidelines and split the main
badly named python file, to understand that 3 models are impacted: res.company,
res.country and res.partner.
Task ID 2158302
PR odoo/odoo#42678
Purpose is to make tests easier to understand and more data oriented. We
now understand more clearly what is an input and what is expected.
Tests about company / partner address fields are added to ensure coherency.
Task ID 2158302
PR odoo/odoo#42678
Currently when writing on street field of company model, its sub-fields
(notably street_name, street_number and street_number2) are not correctly
computed again in cache.
Indeed address sub fields have no direct trigger as it depends on its
partner_id and its partner_id children (see ``res_partner.address_get()`` and
``res_company._compute_address()``).
When writing on address fields from the company record, we then invalidate
all address fields cache in order to force their computation.
This commit adds a new tool method giving the list of fields coming from the
address partner to copy upon the company.
Task ID 2158302
PR #42678
This commit reverts commit 44221cffac called "[FIX] base_address_extended:
Fix cache miss bug" .
Indeed it fixes the cache miss bug but introduces another one which completely
breaks address encoding.
How to reproduce
* create a company with address bits (street_name, street_number,
street_number2);
* update one of those fields, e.g. street_number2;
* other fields are emptied once saved, e.g. street_name and street_number are
False;
* both company and its partner records are now incorrect;
This is probably due to the unique inverse method introduced by the reverted
patch that sends only the updated value to the inverse method, leading to
other values being reset.
Original task ID 2068145
PR odoo/odoo#42701
X-original-commit: 3f4862ee8c9193719abd8e6dd647e6584f232103
Co-authored-by: Thibault Delavallée <tde@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Followup of a425695e
The terms were back in 12.0
Courtesy of Juan José Scarafía
closesodoo/odoo#41624
X-original-commit: 85d0c7001a997748d7691205bbb8d066597591a5
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Before this commit:
-The company have 3 street fields have separate inverse method this all method is update same partner fields
-Partner also has same 3 street fields but have the same inverse method for all street fields
-Now the problem is when user company street inverse call then partner inverse also call at that time partner inverse try to access other street fields that not available in a cache so an error occurred.
After this commit:
-Company 3 street fields have the same inverse method so no cache problem when accessing all street fields in partner inverse method
task-2068145
Closes#36568
Signed-off-by: Josse Colpaert <jco@openerp.com>
This branch is the combination of several optimizations in the ORM:
* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;
* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;
* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);
* make method `modified` take advantage of inverse fields to inverse
dependencies;
* filter records by evaluating a domain on records in Python;
* a computed field with `readonly=False` behaves like a normal field
with an onchange method;
* computed fields are computed in superuser mode by default.
Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.
closesodoo/odoo#35659
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.
Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
- specify the correct separators on the language
- add the address format
- add street addres format for croatia
closesodoo/odoo#33205
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
In 6c2b54ff there was an optimization that removed extended addresses
fields syncing on parent_id, or concerning field update or creation.
But the list of fields was also used partly for formatting address which
had been supporting extended addresses fields and now does not.
With this changeset, we have the extended fields back but only for
formatting in a new "_formatting_address_fields".
opw-1984608
closes#33144
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Mostly a concern during bulk import of partners with parents.
First remove syncing extended fields, that seems completely
unnecessary since the street gets sync'd and will get split through the
normal process (updating the sub-fields), by also syncing the split
fields we're redundantly calling _set_steet and rewriting the address
we just sync'd.
Second if write()ing both the country and street, the override would
then go and re-write the street based on what had *just* been split
into sub-street fields, which could waste a lot of time during the
import post-process as address fields get moved back and forth between
parents and children leading to *lots* of writing both country and
address together, we're talking:
ncalls tottime percall cumtime percall filename:lineno(function)
10002/2 0.111 0.000 344.390 172.195 res_partner.py:181(write)
[...]
2 0.455 0.228 165.264 82.632 base_address_extended.py:41(_set_street)
My initial instinct was to just add the country_id to _set_street and
remove the write override but it would break
88ff6beb01: if the country alone is
updated on a partner, we do want to re-format the "unified" address
based on individual fields and the new country's format.
Note: it might be that the logic would be more sensible by inversing
the entire thing, such that the split fields are the proper
source (regular stored fields) and street is converted to a computed
field instead, but that'd be a larger model change. Seems like it'd
make more sense though, at least given what the modules attempts to
do (OTOH the module probably fails
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/
in just about all the ways).
After this fix, the field `partner.street` is correcly rendered,
but as the test shows the `street_name` and `street_number` fields
are not correct.
But as there are tests that validate that wrong use case, I
consider it a *feature* and not a bug.
opw-1896773
closesodoo/odoo#29520
opw-1916148
The city, state and zip code are shown behind the street name and
street number, and not in a new line.
This only occurs in the read-only view.
This was changed to use the field 'street', which is a text of the
street name, number and door number in the street formatted in the
format of the partner's country. This only for the read-only view,
leaving the 3 fields separated for the edit.
closesodoo/odoo#29467