[MERGE] trunk
bzr revid: abo@openerp.com-20121029105213-3eofoz6e0jmwh5r7
This commit is contained in:
commit
d3a09bfcfc
|
@ -7,14 +7,14 @@ msgstr ""
|
|||
"Project-Id-Version: OpenERP Server 5.0.4\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2012-02-08 00:44+0000\n"
|
||||
"PO-Revision-Date: 2012-10-23 18:39+0000\n"
|
||||
"PO-Revision-Date: 2012-10-25 07:14+0000\n"
|
||||
"Last-Translator: Chertykov Denis <chertykov@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2012-10-24 04:55+0000\n"
|
||||
"X-Generator: Launchpad (build 16179)\n"
|
||||
"X-Launchpad-Export-Date: 2012-10-26 04:55+0000\n"
|
||||
"X-Generator: Launchpad (build 16194)\n"
|
||||
|
||||
#. module: base
|
||||
#: model:res.country,name:base.sh
|
||||
|
@ -4520,7 +4520,7 @@ msgstr "Португалия"
|
|||
#. module: base
|
||||
#: model:ir.module.module,shortdesc:base.module_share
|
||||
msgid "Share any Document"
|
||||
msgstr "Совместный доступ r любым документам"
|
||||
msgstr "Совместный доступ к любым документам"
|
||||
|
||||
#. module: base
|
||||
#: field:ir.module.module,certificate:0
|
||||
|
|
|
@ -361,6 +361,7 @@ class res_config_installer(osv.osv_memory):
|
|||
'to install', ['uninstalled'], context=context)
|
||||
cr.commit() #TOFIX: after remove this statement, installation wizard is fail
|
||||
new_db, self.pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||
|
||||
res_config_installer()
|
||||
|
||||
DEPRECATION_MESSAGE = 'You are using an addon using old-style configuration '\
|
||||
|
@ -538,6 +539,10 @@ class res_config_settings(osv.osv_memory):
|
|||
ir_module.button_uninstall(cr, uid, to_uninstall_ids, context=context)
|
||||
ir_module.button_immediate_install(cr, uid, to_install_ids, context=context)
|
||||
|
||||
config = self.pool.get('res.config').next(cr, uid, [], context=context) or {}
|
||||
if config.get('type') not in ('ir.actions.act_window_close',):
|
||||
return config
|
||||
|
||||
# force client-side reload (update user menu and current view)
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
|
|
|
@ -47,7 +47,7 @@ class Country(osv.osv):
|
|||
help='The full name of the country.', required=True, translate=True),
|
||||
'code': fields.char('Country Code', size=2,
|
||||
help='The ISO country code in two chars.\n'
|
||||
'You can use this field for quick search.', required=True),
|
||||
'You can use this field for quick search.'),
|
||||
'address_format': fields.text('Address Format', help="""You can state here the usual format to use for the \
|
||||
addresses belonging to this country.\n\nYou can use the python-style string patern with all the field of the address \
|
||||
(for example, use '%(street)s' to display the field 'street') plus
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
<field name="code"/>
|
||||
</group>
|
||||
</group>
|
||||
<label for="address_format" string="Address Format"/>
|
||||
<field name="address_format" colspan="4" groups="base.group_no_one"/>
|
||||
<field name="address_format" groups="base.group_no_one" placeholder="Address format..."/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import test_ir_values, test_base
|
||||
import test_base, test_expression, test_ir_values
|
||||
|
||||
checks = [
|
||||
test_ir_values, test_base
|
||||
test_base,
|
||||
test_expression,
|
||||
test_ir_values,
|
||||
]
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
import unittest2
|
||||
|
||||
import openerp.tests.common as common
|
||||
|
||||
class test_expression(common.TransactionCase):
|
||||
|
||||
def test_in_not_in_m2m(self):
|
||||
|
||||
registry, cr, uid = self.registry, self.cr, self.uid
|
||||
|
||||
# Create 4 partners with no category, or one or two categories (out of two categories).
|
||||
|
||||
categories = registry('res.partner.category')
|
||||
cat_a = categories.create(cr, uid, {'name': 'test_expression_category_A'})
|
||||
cat_b = categories.create(cr, uid, {'name': 'test_expression_category_B'})
|
||||
|
||||
partners = registry('res.partner')
|
||||
a = partners.create(cr, uid, {'name': 'test_expression_partner_A', 'category_id': [(6, 0, [cat_a])]})
|
||||
b = partners.create(cr, uid, {'name': 'test_expression_partner_B', 'category_id': [(6, 0, [cat_b])]})
|
||||
ab = partners.create(cr, uid, {'name': 'test_expression_partner_AB', 'category_id': [(6, 0, [cat_a, cat_b])]})
|
||||
c = partners.create(cr, uid, {'name': 'test_expression_partner_C'})
|
||||
|
||||
# The tests.
|
||||
|
||||
# On a one2many or many2many field, `in` should be read `contains` (and
|
||||
# `not in` should be read `doesn't contain`.
|
||||
|
||||
with_a = partners.search(cr, uid, [('category_id', 'in', [cat_a])])
|
||||
self.assertEqual(set([a, ab]), set(with_a), "Search for category_id in cat_a failed.")
|
||||
|
||||
with_b = partners.search(cr, uid, [('category_id', 'in', [cat_b])])
|
||||
self.assertEqual(set([ab, b]), set(with_b), "Search for category_id in cat_b failed.")
|
||||
|
||||
# Partners with the category A or the category B.
|
||||
with_a_or_b = partners.search(cr, uid, [('category_id', 'in', [cat_a, cat_b])])
|
||||
self.assertEqual(set([ab, a, b]), set(with_a_or_b), "Search for category_id contains cat_a or cat_b failed.")
|
||||
|
||||
# Show that `contains list` is really `contains element or contains element`.
|
||||
with_a_or_with_b = partners.search(cr, uid, ['|', ('category_id', 'in', [cat_a]), ('category_id', 'in', [cat_b])])
|
||||
self.assertEqual(set([ab, a, b]), set(with_a_or_with_b), "Search for category_id contains cat_a or contains cat_b failed.")
|
||||
|
||||
# If we change the OR in AND...
|
||||
with_a_and_b = partners.search(cr, uid, [('category_id', 'in', [cat_a]), ('category_id', 'in', [cat_b])])
|
||||
self.assertEqual(set([ab]), set(with_a_and_b), "Search for category_id contains cat_a and cat_b failed.")
|
||||
|
||||
# Partners without category A and without category B.
|
||||
without_a_or_b = partners.search(cr, uid, [('category_id', 'not in', [cat_a, cat_b])])
|
||||
self.assertTrue(all(i not in without_a_or_b for i in [a, b, ab]), "Search for category_id doesn't contain cat_a or cat_b failed (1).")
|
||||
self.assertTrue(c in without_a_or_b, "Search for category_id doesn't contain cat_a or cat_b failed (2).")
|
||||
|
||||
# Show that `doesn't contain list` is really `doesn't contain element and doesn't contain element`.
|
||||
without_a_and_without_b = partners.search(cr, uid, [('category_id', 'not in', [cat_a]), ('category_id', 'not in', [cat_b])])
|
||||
self.assertTrue(all(i not in without_a_and_without_b for i in [a, b, ab]), "Search for category_id doesn't contain cat_a and cat_b failed (1).")
|
||||
self.assertTrue(c in without_a_and_without_b, "Search for category_id doesn't contain cat_a and cat_b failed (2).")
|
||||
|
||||
# We can exclude any partner containing the category A.
|
||||
without_a = partners.search(cr, uid, [('category_id', 'not in', [cat_a])])
|
||||
self.assertTrue(a not in without_a, "Search for category_id doesn't contain cat_a failed (1).")
|
||||
self.assertTrue(ab not in without_a, "Search for category_id doesn't contain cat_a failed (2).")
|
||||
self.assertTrue(set([b, c]).issubset(set(without_a)), "Search for category_id doesn't contain cat_a failed (3).")
|
||||
|
||||
# (Obviously we can do the same for cateory B.)
|
||||
without_b = partners.search(cr, uid, [('category_id', 'not in', [cat_b])])
|
||||
self.assertTrue(b not in without_b, "Search for category_id doesn't contain cat_b failed (1).")
|
||||
self.assertTrue(ab not in without_b, "Search for category_id doesn't contain cat_b failed (2).")
|
||||
self.assertTrue(set([a, c]).issubset(set(without_b)), "Search for category_id doesn't contain cat_b failed (3).")
|
||||
|
||||
# We can't express the following: Partners with a category different than A.
|
||||
# with_any_other_than_a = ...
|
||||
# self.assertTrue(a not in with_any_other_than_a, "Search for category_id with any other than cat_a failed (1).")
|
||||
# self.assertTrue(ab in with_any_other_than_a, "Search for category_id with any other than cat_a failed (2).")
|
||||
|
Loading…
Reference in New Issue