This question has been flagged

My pos.category table contains a field 'available_for_customer'.

class schakel_category_model(models.Model):

"""The product category model."""

_inherit = 'pos.category'

available_for_customer = fields.Integer('Available', help="The available quantity for the current customer.", default=0)

During a point of sale session, every time the customer is changed, this 'available_for_customer' field is recalculated. 

I show the value of this field in the ProductCategoriesWidget after the categories name.

<templates id="template" xml:space="preserve">

<t t-extend="CategorySimpleButton"> <!-- static/src/xml/pos.xml 190 -->

<!-- Show the available qty next to the category name in the category selector -->

<t t-jquery=".category-simple-button" t-operation="append">

(<t t-esc="category.available_for_customer" /> available for you)

</t>

</t>

</templates>

Everything seems to work, but when I select a customer, the value that is shown is not updated and it always shows the value that is first loaded when the pos session is started. I can however use the correct value to prevent the user from buying too much, but the old value is still displayed.

Is there a way to reload the ProductCategoriesWidget, so the updated values are shown?

Avatar
Discard