From 7dd7c9a14046733118fa8ac784337df81279a4c3 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Fri, 9 Dec 2022 09:43:30 +0100 Subject: [PATCH] =?UTF-8?q?asset:=20Feld=20'symbol'=20in=20=C3=BCbersetzte?= =?UTF-8?q?r=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asset.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/asset.py b/asset.py index 329b19e..c33b7bc 100644 --- a/asset.py +++ b/asset.py @@ -236,9 +236,12 @@ class Asset(SymbolMixin, ModelSQL, ModelView): tab_templ = ProdTempl.__table__() tab_prod = Product.__table__() tab_uom = Uom.__table__() - tab_uom2 = Uom.__table__() tab_cur = Currency.__table__() + # get translated symbol-column from UOM + (tab1, join1, col1) = Uom.symbol._get_translation_column(Uom, 'symbol') + tab_symb = join1.select(tab1.id, col1.as_('symbol')) + query = tab_asset.join(tab_prod, condition=tab_asset.product==tab_prod.id, ).join(tab_templ, @@ -247,13 +250,13 @@ class Asset(SymbolMixin, ModelSQL, ModelView): condition=tab_templ.default_uom==tab_uom.id, ).join(tab_cur, condition=tab_asset.currency==tab_cur.id, - ).join(tab_uom2, - condition=tab_asset.uom==tab_uom2.id, + ).join(tab_symb, + condition=tab_asset.uom==tab_symb.id, ).select( tab_asset.id, tab_templ.name, tab_uom.category.as_('product_uom'), - Concat2(tab_cur.symbol, '/', tab_uom2.symbol).as_('symbol'), + Concat2(tab_cur.symbol, '/', tab_symb.symbol).as_('symbol'), ) return (query, tab_asset)