add vintage to recname and product_list_view #157618
This commit is contained in:
parent
3d7ad58b80
commit
8715a2b0cc
14
product.py
14
product.py
|
@ -128,6 +128,11 @@ class Product(WineMixin, metaclass=PoolMeta):
|
||||||
'get_wine_history', searcher='search_wine_history')
|
'get_wine_history', searcher='search_wine_history')
|
||||||
wine_history_duration = fields.Function(fields.Text("History Duration"),
|
wine_history_duration = fields.Function(fields.Text("History Duration"),
|
||||||
'get_wine_history', searcher='search_wine_history')
|
'get_wine_history', searcher='search_wine_history')
|
||||||
|
vintages_str = fields.Function(fields.Char("Vintage"), 'get_vintages_str')
|
||||||
|
|
||||||
|
def get_vintages_str(self, name):
|
||||||
|
return ', '.join([v.name for v in self.vintages])
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def deactivate_no_stock_variants_cron(cls):
|
def deactivate_no_stock_variants_cron(cls):
|
||||||
|
@ -226,6 +231,15 @@ class Product(WineMixin, metaclass=PoolMeta):
|
||||||
return [('id', 'in', query)]
|
return [('id', 'in', query)]
|
||||||
|
|
||||||
|
|
||||||
|
def get_rec_name(self, name):
|
||||||
|
rec_name = super().get_rec_name(name)
|
||||||
|
if not self.vintages:
|
||||||
|
return rec_name
|
||||||
|
|
||||||
|
aging = ",".join(x.name for x in self.vintages)
|
||||||
|
rec_name = rec_name + "-" + aging
|
||||||
|
return rec_name
|
||||||
|
|
||||||
class Cron(metaclass=PoolMeta):
|
class Cron(metaclass=PoolMeta):
|
||||||
__name__ = 'ir.cron'
|
__name__ = 'ir.cron'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<xpath expr="/tree/field[@name='code']" position="after">
|
||||||
|
<field name="vintages_str"/>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="/tree" position="inside">
|
<xpath expr="/tree" position="inside">
|
||||||
<field name="vintages" tree_invisible="1"/>
|
<field name="vintages" tree_invisible="1"/>
|
||||||
<field name="varieties" tree_invisible="1"/>
|
<field name="varieties" tree_invisible="1"/>
|
||||||
|
|
Loading…
Reference in New Issue