From 1b76e5a85e937209f80e394788a3fee7bda6acfd Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Mon, 6 Sep 2010 15:08:00 +0530 Subject: [PATCH] [IMP] Account: improved account_use_model.yml for use_model wizard bzr revid: pap@tinyerp.co.in-20100906093800-l0h3pvihjwz8rq4w --- addons/account/test/account_use_model.yml | 7 +++++-- addons/account/wizard/account_use_model.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/test/account_use_model.yml b/addons/account/test/account_use_model.yml index 492abc929eb..20487fa86f4 100644 --- a/addons/account/test/account_use_model.yml +++ b/addons/account/test/account_use_model.yml @@ -11,7 +11,7 @@ name: test1 sequence: 0.0 quantity: 0.0 - name: My Model on %(year)s + name: My Test Model - I create an account use model record @@ -26,4 +26,7 @@ !python {model: account.use.model}: | self.create_entries(cr, uid, [ref("account_use_model_0")], {"lang": 'en_US', "active_model": "account.model", "active_ids": [ref("account_model_mymodelonyears0")], "tz": - False, "active_id": ref("account_model_mymodelonyears0"), }) \ No newline at end of file + False, "active_id": ref("account_model_mymodelonyears0"), }) + move_obj = self.pool.get('account.move') + ids = move_obj.search(cr, uid, [('ref', '=', 'My Test Model')]) + assert len(ids), "Error:moves not created for model 'My Test Model'" \ No newline at end of file diff --git a/addons/account/wizard/account_use_model.py b/addons/account/wizard/account_use_model.py index 6cadb4b1c3e..69378324eaa 100644 --- a/addons/account/wizard/account_use_model.py +++ b/addons/account/wizard/account_use_model.py @@ -69,7 +69,7 @@ class account_use_model(osv.osv_memory): raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !')) period_id = period_id[0] move_id = account_move_obj.create(cr, uid, { - 'ref': model.ref, + 'ref': model.name, 'period_id': period_id, 'journal_id': model.journal_id.id, })