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 (closed)
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'