diff --git a/product.py b/product.py index e43887b..7914228 100644 --- a/product.py +++ b/product.py @@ -29,6 +29,22 @@ class Product: "Product extension for Nereid" __name__ = "product.product" + def serialize(self, purpose=None): + """ + Downstream implementation which adds a key called inventory_status + to the dictionary if purpose is 'variant_selection'. + + :param purpose: String which decides structure of dictionary + """ + res = super(Product, self).serialize(purpose=purpose) + + if purpose == 'variant_selection': + res.update({ + 'inventory_status': self.inventory_status(), + }) + + return res + def get_default_image(self, name): "Returns default product image" ModelData = Pool().get('ir.model.data') diff --git a/templates/webshop/product.jinja b/templates/webshop/product.jinja index d37104a..f048d19 100644 --- a/templates/webshop/product.jinja +++ b/templates/webshop/product.jinja @@ -105,9 +105,6 @@ {% endblock product_description %} -
@@ -155,10 +152,12 @@
{% if product.type == 'goods' %} + {% set status = product.inventory_status() %}
-
- - {{ product.inventory_status()[1] }} +
+ + + {{ status[1] }}
{% endif %} @@ -304,6 +303,12 @@
+ +