party address formats are not auto-updated, thus missing the district -> subdivision rename
In Tryton 4\.4 I get an error similar to what got reported here\: #6111 \
\
The problem seems to be that address formats are not auto\-updated\: \
http://hg.tryton.org/modules/party/file/1bb95be2e171/address.xml#l89 \
\
So despite the above fix\, when you upgrade from 4\.2 to 4\.4\, you still have \"\$\{district\}\" in many address formats and you end up with traceback such as the one show below when trying to generate an invoice\. \
\
Either the address formats needs to be marked as auto\-updatable\, or you need to add migration code to replace \"\$\{district\}\" with \"\$\{subdivision\}\"\. \
\
Traceback \(most recent call last\)\: \
File \"\/trytond\/wsgi\.py\"\, line 47\, in dispatch\_request \
return endpoint\(request\, \*\*request\.view\_args\) \
File \"\/trytond\/protocols\/dispatcher\.py\"\, line 41\, in rpc \
request\, database\_name\, \*request\.rpc\_params\) \
File \"\/trytond\/wsgi\.py\"\, line 39\, in auth\_required \
return wrapped\(\*args\, \*\*kwargs\) \
File \"\/trytond\/protocols\/wrappers\.py\"\, line 105\, in wrapper \
return func\(request\, pool\, \*args\, \*\*kwargs\) \
File \"\/trytond\/protocols\/dispatcher\.py\"\, line 165\, in \_dispatch \
result \= rpc\.result\(meth\(\*c\_args\, \*\*c\_kwargs\)\) \
File \"\/trytond\/model\/modelview\.py\"\, line 619\, in wrapper \
return func\(cls\, records\, \*args\, \*\*kwargs\) \
File \"\/trytond\/model\/workflow\.py\"\, line 34\, in wrapper \
result \= func\(cls\, filtered\, \*args\, \*\*kwargs\) \
File \"\/trytond\/modules\/account\_invoice\/invoice\.py\"\, line 1341\, in post \
invoice\.print\_invoice\(\) \
File \"\/trytond\/modules\/account\_invoice\/invoice\.py\"\, line 1250\, in print\_invoice \
InvoiceReport\.execute\(\[self\.id\]\, \{\}\) \
File \"\/trytond\/modules\/account\_invoice\/invoice\.py\"\, line 2366\, in execute \
result \= super\(InvoiceReport\, cls\)\.execute\(ids\, data\) \
File \"\/trytond\/report\/report\.py\"\, line 153\, in execute \
cls\.render\(action\_report\, report\_context\)\) \
File \"\/trytond\/report\/report\.py\"\, line 238\, in render \
data \= rel\_report\(\*\*report\_context\)\.render\(\) \
File \"\/relatorio\/templates\/base\.py\"\, line 34\, in render \
return self\.serializer\(self\.events\) \
File \"\/relatorio\/templates\/opendocument\.py\"\, line 893\, in \_call\_ \
for kind\, data\, pos in stream\: \
File \"\/genshi\/core\.py\"\, line 289\, in \_ensure \
for event in stream\: \
File \"\/genshi\/filters\/i18n\.py\"\, line 690\, in \_call\_ \
for kind\, data\, pos in stream\: \
File \"\/genshi\/template\/base\.py\"\, line 617\, in \_include \
for event in stream\: \
File \"\/genshi\/template\/markup\.py\"\, line 326\, in \_match \
for event in stream\: \
File \"\/genshi\/template\/base\.py\"\, line 557\, in \_flatten \
for kind\, data\, pos in stream\: \
File \"\/genshi\/template\/directives\.py\"\, line 359\, in \_call\_ \
iterable \= \_eval\_expr\(self\.expr\, ctxt\, vars\) \
File \"\/genshi\/template\/base\.py\"\, line 289\, in \_eval\_expr \
retval \= expr\.evaluate\(ctxt\) \
File \"\/genshi\/template\/eval\.py\"\, line 178\, in evaluate \
return eval\(self\.code\, \_globals\, \{\'\_\_data\_\_\'\: data\}\) \
File \"\"\, line 1\, in \
File \"\/genshi\/template\/eval\.py\"\, line 318\, in lookup\_attr \
val \= getattr\(obj\, key\) \
File \"\/trytond\/model\/fields\/field\.py\"\, line 282\, in \_get\_ \
return inst\.\_\_getattr\_\_\(self\.name\) \
File \"\/trytond\/model\/modelstorage\.py\"\, line 1369\, in \_getattr\_ \
read\_data \= self\.read\(list\(ids\)\, list\(ffields\.keys\(\)\)\) \
File \"\/trytond\/model\/modelsql\.py\"\, line 778\, in read \
getter\_results \= field\.get\(ids\, cls\, field\_list\, values\=result\) \
File \"\/trytond\/model\/fields\/function\.py\"\, line 102\, in get \
return dict\(\(name\, call\(name\)\) for name in names\) \
File \"\/trytond\/model\/fields\/function\.py\"\, line 102\, in \
return dict\(\(name\, call\(name\)\) for name in names\) \
File \"\/trytond\/model\/fields\/function\.py\"\, line 96\, in call \
return dict\(\(r\.id\, method\(r\, name\)\) for r in records\) \
File \"\/trytond\/model\/fields\/function\.py\"\, line 96\, in \
return dict\(\(r\.id\, method\(r\, name\)\) for r in records\) \
File \"\/trytond\/modules\/party\/address\.py\"\, line 126\, in get\_full\_address \
\*\*self\.\_get\_address\_substitutions\(\)\) \
File \"\/string\.py\"\, line 121\, in substitute \
return self\.pattern\.sub\(convert\, self\.template\) \
File \"\/string\.py\"\, line 111\, in convert \
val \= mapping\[named\] \
KeyError\: \'district\'
issue