Skip to content
Browse files

[IMP] base_address_partner: don't re-set street when we just set it

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
      2    0.455    0.228  165.264   82.632

My initial instinct was to just add the country_id to _set_street and
remove the write override but it would break
88ff6be: 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.

Might be that the logic *should* be for `street` to be the computed
fields and the other 3 to be the actual source fields, that seems to be
the more intentional logic.
  • Loading branch information...
xmo-odoo committed Mar 15, 2019
1 parent 5da2669 commit b6995a27873b917eb9cbdcf6e8caf566942deea2
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/base_address_extended/models/
@@ -139,7 +139,7 @@ def _split_street(self):

def write(self, vals):
res = super(Partner, self).write(vals)
if 'country_id' in vals:
if 'country_id' in vals and 'street' not in vals:
return res

0 comments on commit b6995a2

Please sign in to comment.
You can’t perform that action at this time.