Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
seb-odoo committed Apr 11, 2019
1 parent ed587ea commit 6927112
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/product/models/product_attribute.py
Expand Up @@ -73,7 +73,7 @@ def write(self, vals):
if invalidate_cache:
# prefetched o2m have to be resequenced
# (eg. product.template: attribute_line_ids)
self.invalidate_cache()
self.env['product.template'].invalidate_cache(fnames=['attribute_line_ids'])
return res

@api.multi
Expand Down
4 changes: 2 additions & 2 deletions addons/product/models/product_template.py
Expand Up @@ -921,7 +921,7 @@ def _get_variant_for_combination(self, combination):
return self.env['product.product'].browse(self._get_variant_id_for_combination(attribute_values))

@api.multi
@tools.ormcache('self', 'attribute_values')
@tools.ormcache('self.id', 'attribute_values.ids')
def _get_variant_id_for_combination(self, attribute_values):
"""See `_get_variant_for_combination`. This method returns an ID
so it can be cached."""
Expand All @@ -943,7 +943,7 @@ def _get_variant_id_for_combination(self, attribute_values):
)[:1].id

@api.multi
@tools.ormcache('self')
@tools.ormcache('self.id')
def _get_first_possible_variant_id(self):
"""See `_create_first_product_variant`. This method returns an ID
so it can be cached."""
Expand Down
1 change: 1 addition & 0 deletions addons/product/tests/test_variants.py
Expand Up @@ -23,6 +23,7 @@ def setUp(self):
return res

def test_attribute_line_search(self):
import pudb; pudb.set_trace()
search_not_to_be_found = self.env['product.template'].search(
[('attribute_line_ids', '=', 'M')]
)
Expand Down

0 comments on commit 6927112

Please sign in to comment.