def __register__(cls, module_name):
pool = Pool()
Property = pool.get('ir.property')
TableHandler = backend.get('TableHandler')
cursor = Transaction().cursor
table = cls.__table__()
super(Party, cls).__register__(module_name)
table_h = TableHandler(cursor, cls, module_name)
if table_h.column_exist('lang'):
cursor.execute(*table.select(table.id, table.lang,
order_by=table.lang))
for lang_id, group in groupby(cursor.fetchall(), lambda r: r[1]):
ids = [id_ for id_, _ in group]
if lang_id is not None:
value = '%s,%s' % (cls.lang.model_name, lang_id)
else:
value = None
Property.set('lang', cls.__name__, ids, value)
table_h.drop_column('lang')
评论列表
文章目录