From 71ebce80184cb142426fa1adcb6f093626afccdc Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Mon, 11 Jun 2012 16:04:25 +0530 Subject: [PATCH 1/5] [IMP]remove res.partner.address and sequence from ir.sequence bzr revid: kjo@tinyerp.com-20120611103425-ekeoso4m1475d6rq --- openerp/addons/base/ir/ir.xml | 1 - openerp/tests/test_ir_sequence.py | 2 +- openerp/tests/test_orm.py | 28 ++++++++++++++-------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/openerp/addons/base/ir/ir.xml b/openerp/addons/base/ir/ir.xml index 837374d371b..c718b8e165a 100644 --- a/openerp/addons/base/ir/ir.xml +++ b/openerp/addons/base/ir/ir.xml @@ -595,7 +595,6 @@ ir.needaction_users_rel.tree ir.needaction_users_rel tree - 10 diff --git a/openerp/tests/test_ir_sequence.py b/openerp/tests/test_ir_sequence.py index fcc5888e47e..2943676d1bc 100644 --- a/openerp/tests/test_ir_sequence.py +++ b/openerp/tests/test_ir_sequence.py @@ -114,7 +114,7 @@ class test_ir_sequence_change_implementation(unittest2.TestCase): d = dict(code='test_sequence_type_3', name='Test sequence type') c = registry('ir.sequence.type').create(cr, ADMIN_USER_ID, d, {}) assert c - d = dict(code='test_sequence_type_3', name='Test sequence') + d = dict(code='test_sequence_type_3', name='Test sequence', 'implementation': 'standard') c = registry('ir.sequence').create(cr, ADMIN_USER_ID, d, {}) assert c d = dict(code='test_sequence_type_4', name='Test sequence type') diff --git a/openerp/tests/test_orm.py b/openerp/tests/test_orm.py index 0c4046df2a4..197694d6552 100644 --- a/openerp/tests/test_orm.py +++ b/openerp/tests/test_orm.py @@ -20,7 +20,7 @@ class TestO2MSerialization(common.TransactionCase): def setUp(self): super(TestO2MSerialization, self).setUp() self.partner = self.registry('res.partner') - self.address = self.registry('res.partner.address') +# self.address = self.registry('res.partner.address') def test_no_command(self): " empty list of commands yields an empty list of records " @@ -43,9 +43,9 @@ class TestO2MSerialization(common.TransactionCase): def test_LINK_TO_command(self): " reads the records from the database, records are returned with their ids. " ids = [ - self.address.create(self.cr, UID, {'name': 'foo'}), - self.address.create(self.cr, UID, {'name': 'bar'}), - self.address.create(self.cr, UID, {'name': 'baz'}) + self.partner.create(self.cr, UID, {'name': 'foo'}), + self.partner.create(self.cr, UID, {'name': 'bar'}), + self.partner.create(self.cr, UID, {'name': 'baz'}) ] commands = map(LINK_TO, ids) @@ -61,9 +61,9 @@ class TestO2MSerialization(common.TransactionCase): def test_bare_ids_command(self): " same as the equivalent LINK_TO commands " ids = [ - self.address.create(self.cr, UID, {'name': 'foo'}), - self.address.create(self.cr, UID, {'name': 'bar'}), - self.address.create(self.cr, UID, {'name': 'baz'}) + self.partner.create(self.cr, UID, {'name': 'foo'}), + self.partner.create(self.cr, UID, {'name': 'bar'}), + self.partner.create(self.cr, UID, {'name': 'baz'}) ] results = self.partner.resolve_o2m_commands_to_record_dicts( @@ -77,9 +77,9 @@ class TestO2MSerialization(common.TransactionCase): def test_UPDATE_command(self): " take the in-db records and merge the provided information in " - id_foo = self.address.create(self.cr, UID, {'name': 'foo'}) - id_bar = self.address.create(self.cr, UID, {'name': 'bar'}) - id_baz = self.address.create(self.cr, UID, {'name': 'baz', 'city': 'tag'}) + id_foo = self.partner.create(self.cr, UID, {'name': 'foo'}) + id_bar = self.partner.create(self.cr, UID, {'name': 'bar'}) + id_baz = self.partner.create(self.cr, UID, {'name': 'baz', 'city': 'tag'}) results = self.partner.resolve_o2m_commands_to_record_dicts( self.cr, UID, 'address', [ @@ -96,7 +96,7 @@ class TestO2MSerialization(common.TransactionCase): def test_mixed_commands(self): ids = [ - self.address.create(self.cr, UID, {'name': name}) + self.partner.create(self.cr, UID, {'name': name}) for name in ['NObar', 'baz', 'qux', 'NOquux', 'NOcorge', 'garply'] ] @@ -126,9 +126,9 @@ class TestO2MSerialization(common.TransactionCase): def test_LINK_TO_pairs(self): "LINK_TO commands can be written as pairs, instead of triplets" ids = [ - self.address.create(self.cr, UID, {'name': 'foo'}), - self.address.create(self.cr, UID, {'name': 'bar'}), - self.address.create(self.cr, UID, {'name': 'baz'}) + self.partner.create(self.cr, UID, {'name': 'foo'}), + self.partner.create(self.cr, UID, {'name': 'bar'}), + self.partner.create(self.cr, UID, {'name': 'baz'}) ] commands = map(lambda id: (4, id), ids) From a153714bcc3b82d0a2e701020d396b10c4204c27 Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Thu, 14 Jun 2012 14:26:46 +0530 Subject: [PATCH 2/5] [IMP] remove res.partner.address bzr revid: kjo@tinyerp.com-20120614085646-vvbx0fegqxar2kot --- openerp/tests/test_orm.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openerp/tests/test_orm.py b/openerp/tests/test_orm.py index 197694d6552..ea9b37e5f3b 100644 --- a/openerp/tests/test_orm.py +++ b/openerp/tests/test_orm.py @@ -20,7 +20,6 @@ class TestO2MSerialization(common.TransactionCase): def setUp(self): super(TestO2MSerialization, self).setUp() self.partner = self.registry('res.partner') -# self.address = self.registry('res.partner.address') def test_no_command(self): " empty list of commands yields an empty list of records " From ff354166b4eab15e0b3fe2e1f9f6d619dcd476d5 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Fri, 15 Jun 2012 17:09:10 +0530 Subject: [PATCH 3/5] [IMP] improve in server side bzr revid: fka@tinyerp.com-20120615113910-qd6xmaistkrioc0y --- .../addons/base/test/test_osv_expression.yml | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml index fa7a69b74e9..0165b61b275 100644 --- a/openerp/addons/base/test/test_osv_expression.yml +++ b/openerp/addons/base/test/test_osv_expression.yml @@ -75,7 +75,7 @@ Trying the "in" operator, for scalar value - !python {model: res.partner }: | - ids = self.search(cr, uid, [('parent_id','in','Agrolait')]) + ids = self.search(cr, uid, [('parent_id','=','Agrolait')]) assert len(ids) >= 1, ids - Trying the "in" operator for list value @@ -229,7 +229,7 @@ res_0.sort() res_1 = self.search(cr, uid, [('parent_id', 'not in', [max_partner_id + 1])]) # get all rows, included null parent_id res_1.sort() - res_2 = self.search(cr, uid, [('parent_id', 'not in', False)]) # get rows with not null parent_id, deprecated syntax + res_2 = self.search(cr, uid, [('parent_id', '!=', False)]) # get rows with not null parent_id, deprecated syntax res_2.sort() res_3 = self.search(cr, uid, [('parent_id', 'not in', [])]) # get all rows, included null parent_id res_3.sort() @@ -249,7 +249,7 @@ res_5.sort() res_6 = self.search(cr, uid, [('parent_id', 'in', [max_partner_id + 1])]) res_6.sort() - res_7 = self.search(cr, uid, [('parent_id', 'in', False)]) + res_7 = self.search(cr, uid, [('parent_id', '=', False)]) res_7.sort() res_8 = self.search(cr, uid, [('parent_id', 'in', [])]) res_8.sort() @@ -270,7 +270,7 @@ res_10.sort() res_11 = self.search(cr, uid, ['!', ('parent_id', 'in', [max_partner_id + 1])]) res_11.sort() - res_12 = self.search(cr, uid, ['!', ('parent_id', 'in', False)]) + res_12 = self.search(cr, uid, ['!', ('parent_id', '=', False)]) res_12.sort() res_13 = self.search(cr, uid, ['!', ('parent_id', 'in', [])]) res_13.sort() @@ -291,7 +291,7 @@ res_16.sort() assert res_16 == partner_ids - res_17 = self.search(cr, uid, [('website', 'not in', False)]) + res_17 = self.search(cr, uid, [('website', '!=', False)]) res_17.sort() assert res_17 == with_website @@ -306,21 +306,21 @@ assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101) assert res_102 == company_ids, 'res_102: expected %r, got %r' % (company_ids, res_102) - - Property of the query (one2many not in False). + Property of the query (one2many != False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'not in', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)])) assert referenced_companies == companies - - Property of the query (one2many in False). + Property of the query (one2many = False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'in', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)])) assert unreferenced_companies == companies - Equivalent queries. @@ -331,7 +331,7 @@ res_1 = self.search(cr, uid, [('name', 'not like', 'probably_unexisting_name')]) res_2 = self.search(cr, uid, [('id', 'not in', [max_currency_id + 1003])]) res_3 = self.search(cr, uid, [('id', 'not in', [])]) - res_4 = self.search(cr, uid, [('id', 'not in', False)]) + res_4 = self.search(cr, uid, [('id', '!=', False)]) res_0.sort() res_1.sort() res_2.sort() @@ -414,7 +414,7 @@ # get the companies referenced by some currency (this is normally the main company) res_10 = self.search(cr, uid, [('currency_ids', 'not like', 'probably_unexisting_name')]) res_11 = self.search(cr, uid, [('currency_ids', 'not in', [max_currency_id + 1])]) - res_12 = self.search(cr, uid, [('currency_ids', 'not in', False)]) + res_12 = self.search(cr, uid, [('currency_ids', '!=', False)]) res_13 = self.search(cr, uid, [('currency_ids', 'not in', [])]) res_10.sort() res_11.sort() @@ -527,3 +527,4 @@ res_ids = self.search(cr, uid, [('child_ids.country_id','=','Belgium'),('active','=',False)]) assert len(res_ids) != 0, "Record not Found with country Belgium and active False." + From 6292e896a186562682757952c27385adf9996592 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Wed, 20 Jun 2012 17:21:42 +0530 Subject: [PATCH 4/5] [IMP] solve Can not `import openerp.tests`. bzr revid: fka@tinyerp.com-20120620115142-euaid51ad2xgwevc --- openerp/tests/test_ir_sequence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tests/test_ir_sequence.py b/openerp/tests/test_ir_sequence.py index 2943676d1bc..fcc5888e47e 100644 --- a/openerp/tests/test_ir_sequence.py +++ b/openerp/tests/test_ir_sequence.py @@ -114,7 +114,7 @@ class test_ir_sequence_change_implementation(unittest2.TestCase): d = dict(code='test_sequence_type_3', name='Test sequence type') c = registry('ir.sequence.type').create(cr, ADMIN_USER_ID, d, {}) assert c - d = dict(code='test_sequence_type_3', name='Test sequence', 'implementation': 'standard') + d = dict(code='test_sequence_type_3', name='Test sequence') c = registry('ir.sequence').create(cr, ADMIN_USER_ID, d, {}) assert c d = dict(code='test_sequence_type_4', name='Test sequence type') From 04448834bab55b53da17314a7400020ec3831a66 Mon Sep 17 00:00:00 2001 From: "Sbh (Openerp)" Date: Thu, 21 Jun 2012 14:54:49 +0530 Subject: [PATCH 5/5] [REVERT] revert changes of test_osv_expression.yml bzr revid: sbh@tinyerp.com-20120621092449-bz1bzdadrl13t50j --- .../addons/base/test/test_osv_expression.yml | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml index 0165b61b275..0fe6c98c359 100644 --- a/openerp/addons/base/test/test_osv_expression.yml +++ b/openerp/addons/base/test/test_osv_expression.yml @@ -75,7 +75,7 @@ Trying the "in" operator, for scalar value - !python {model: res.partner }: | - ids = self.search(cr, uid, [('parent_id','=','Agrolait')]) + ids = self.search(cr, uid, [('parent_id','in','Agrolait')]) assert len(ids) >= 1, ids - Trying the "in" operator for list value @@ -229,7 +229,7 @@ res_0.sort() res_1 = self.search(cr, uid, [('parent_id', 'not in', [max_partner_id + 1])]) # get all rows, included null parent_id res_1.sort() - res_2 = self.search(cr, uid, [('parent_id', '!=', False)]) # get rows with not null parent_id, deprecated syntax + res_2 = self.search(cr, uid, [('parent_id', 'not in', False)]) # get rows with not null parent_id, deprecated syntax res_2.sort() res_3 = self.search(cr, uid, [('parent_id', 'not in', [])]) # get all rows, included null parent_id res_3.sort() @@ -249,7 +249,7 @@ res_5.sort() res_6 = self.search(cr, uid, [('parent_id', 'in', [max_partner_id + 1])]) res_6.sort() - res_7 = self.search(cr, uid, [('parent_id', '=', False)]) + res_7 = self.search(cr, uid, [('parent_id', 'in', False)]) res_7.sort() res_8 = self.search(cr, uid, [('parent_id', 'in', [])]) res_8.sort() @@ -270,7 +270,7 @@ res_10.sort() res_11 = self.search(cr, uid, ['!', ('parent_id', 'in', [max_partner_id + 1])]) res_11.sort() - res_12 = self.search(cr, uid, ['!', ('parent_id', '=', False)]) + res_12 = self.search(cr, uid, ['!', ('parent_id', 'in', False)]) res_12.sort() res_13 = self.search(cr, uid, ['!', ('parent_id', 'in', [])]) res_13.sort() @@ -291,7 +291,7 @@ res_16.sort() assert res_16 == partner_ids - res_17 = self.search(cr, uid, [('website', '!=', False)]) + res_17 = self.search(cr, uid, [('website', 'not in', False)]) res_17.sort() assert res_17 == with_website @@ -306,21 +306,21 @@ assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101) assert res_102 == company_ids, 'res_102: expected %r, got %r' % (company_ids, res_102) - - Property of the query (one2many != False). + Property of the query (one2many not in False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'not in', False)])) assert referenced_companies == companies - - Property of the query (one2many = False). + Property of the query (one2many in False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'in', False)])) assert unreferenced_companies == companies - Equivalent queries. @@ -331,7 +331,7 @@ res_1 = self.search(cr, uid, [('name', 'not like', 'probably_unexisting_name')]) res_2 = self.search(cr, uid, [('id', 'not in', [max_currency_id + 1003])]) res_3 = self.search(cr, uid, [('id', 'not in', [])]) - res_4 = self.search(cr, uid, [('id', '!=', False)]) + res_4 = self.search(cr, uid, [('id', 'not in', False)]) res_0.sort() res_1.sort() res_2.sort() @@ -414,7 +414,7 @@ # get the companies referenced by some currency (this is normally the main company) res_10 = self.search(cr, uid, [('currency_ids', 'not like', 'probably_unexisting_name')]) res_11 = self.search(cr, uid, [('currency_ids', 'not in', [max_currency_id + 1])]) - res_12 = self.search(cr, uid, [('currency_ids', '!=', False)]) + res_12 = self.search(cr, uid, [('currency_ids', 'not in', False)]) res_13 = self.search(cr, uid, [('currency_ids', 'not in', [])]) res_10.sort() res_11.sort() @@ -526,5 +526,3 @@ !python {model: res.partner }: | res_ids = self.search(cr, uid, [('child_ids.country_id','=','Belgium'),('active','=',False)]) assert len(res_ids) != 0, "Record not Found with country Belgium and active False." - -