summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-02-05 12:02:02 +0100
committerChristophe Simonis <chs@odoo.com>2018-02-05 12:02:02 +0100
commitf22cf5f711d983832a2ce16cdfbfc09e59b6bb07 (patch)
tree98108dc9e4aa71450c51f52f05d0baec2f8510fe /addons
parent7d465aa56cf421d009b25a41fc226f82de7c2192 (diff)
parente5f2e6d3908bc4bfc397ef9ef164219e5fb50acc (diff)
[MERGE] forward port branch 10.0 up to e5f2e6d3908
Diffstat (limited to 'addons')
-rw-r--r--addons/calendar/views/calendar_views.xml4
-rw-r--r--addons/product/models/product_attribute.py7
-rw-r--r--addons/product/tests/test_variants.py37
-rw-r--r--addons/website_forum/views/website_forum.xml2
4 files changed, 43 insertions, 7 deletions
diff --git a/addons/calendar/views/calendar_views.xml b/addons/calendar/views/calendar_views.xml
index 80f231eee97..38ef8d06df4 100644
--- a/addons/calendar/views/calendar_views.xml
+++ b/addons/calendar/views/calendar_views.xml
@@ -75,7 +75,7 @@
<field name="partner_ids"/>
<field name="location"/>
<field name="state" invisible="True"/>
- <field name="duration"/>
+ <field name="duration" widget="float_time"/>
<field name="message_needaction" invisible="1"/>
</tree>
</field>
@@ -372,4 +372,4 @@
<field name="view_id" ref="view_calendar_event_form"/>
</record>
-</odoo> \ No newline at end of file
+</odoo>
diff --git a/addons/product/models/product_attribute.py b/addons/product/models/product_attribute.py
index 20465d47c49..269dc244d1a 100644
--- a/addons/product/models/product_attribute.py
+++ b/addons/product/models/product_attribute.py
@@ -107,7 +107,6 @@ class ProductAttributeLine(models.Model):
# search on a m2o and one on a m2m, probably this will quickly become
# difficult to compute - check if performance optimization is required
if name and operator in ('=', 'ilike', '=ilike', 'like', '=like'):
- new_args = ['|', ('attribute_id', operator, name), ('value_ids', operator, name)]
- else:
- new_args = args
- return super(ProductAttributeLine, self).name_search(name=name, args=new_args, operator=operator, limit=limit)
+ args = ['|', ('attribute_id', operator, name), ('value_ids', operator, name)]
+ return self.search(args, limit=limit).name_get()
+ return super(ProductAttributeLine, self).name_search(name=name, args=args, operator=operator, limit=limit)
diff --git a/addons/product/tests/test_variants.py b/addons/product/tests/test_variants.py
index fbf3073377d..813f5f9e28d 100644
--- a/addons/product/tests/test_variants.py
+++ b/addons/product/tests/test_variants.py
@@ -2,6 +2,43 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import common
+from odoo.tests.common import TransactionCase
+
+class TestVariants(TransactionCase):
+
+ def setUp(self):
+ res = super(TestVariants, self).setUp()
+ self.size_attr = self.env['product.attribute'].create({'name': 'Size'})
+ self.size_attr_value_s = self.env['product.attribute.value'].create({'name': 'S', 'attribute_id': self.size_attr.id})
+ self.size_attr_value_m = self.env['product.attribute.value'].create({'name': 'M', 'attribute_id': self.size_attr.id})
+ self.size_attr_value_l = self.env['product.attribute.value'].create({'name': 'L', 'attribute_id': self.size_attr.id})
+ self.product_shirt_template = self.env['product.template'].create({
+ 'name': 'Shirt',
+ 'attribute_line_ids': [(0, 0, {
+ 'attribute_id': self.size_attr.id,
+ 'value_ids': [(6, 0, [self.size_attr_value_l.id])],
+ })]
+ })
+ return res
+
+ def test_attribute_line_search(self):
+ search_not_to_be_found = self.env['product.template'].search(
+ [('attribute_line_ids', '=', 'M')]
+ )
+ self.assertNotIn(self.product_shirt_template, search_not_to_be_found,
+ 'Shirt should not be found searching M')
+
+ search_attribute = self.env['product.template'].search(
+ [('attribute_line_ids', '=', 'Size')]
+ )
+ self.assertIn(self.product_shirt_template, search_attribute,
+ 'Shirt should be found searching Size')
+
+ search_value = self.env['product.template'].search(
+ [('attribute_line_ids', '=', 'L')]
+ )
+ self.assertIn(self.product_shirt_template, search_value,
+ 'Shirt should be found searching L')
class TestVariants(common.TestProductCommon):
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml
index ce9f37dcf2d..0c7fb6298e5 100644
--- a/addons/website_forum/views/website_forum.xml
+++ b/addons/website_forum/views/website_forum.xml
@@ -685,7 +685,7 @@
<!-- Edition: post a reply -->
<template id="post_reply">
- <div class="css_editable_mode_hidden" groups="base.group_user">
+ <div class="css_editable_mode_hidden">
<form t-attf-id="reply#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse js_website_submit_form"
t-attf-action="/forum/#{ slug(forum) }/#{slug(object)}/reply" method="post" role="form">
<h3 class="mt8">Your Reply</h3>