Skip to content

Commit

Permalink
[IMP] account_invoice_partner basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon committed Feb 9, 2015
1 parent fad9802 commit 3a05a2e
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
23 changes: 23 additions & 0 deletions account_invoice_partner/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Invoice partner test module for OpenERP
# Copyright (C) 2015 ACSONE SA/NV (http://acsone.eu)
# @author Laurent Mignon <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import test_account_invoice_partner
50 changes: 50 additions & 0 deletions account_invoice_partner/tests/test_account_invoice_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Invoice partner test module for OpenERP
# Copyright (C) 2015 ACSONE SA/NV (http://acsone.eu)
# @author Laurent Mignon <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import openerp.tests.common as common


class TestAccountInvoiceParner(common.TransactionCase):

def setUp(self):
super(TestAccountInvoiceParner, self).setUp()
self.inv_model = self.env['account.invoice']
self.partner_model = self.env['res.partner']
self.partner_2 = self.ref('base.res_partner_2')
self.partner_address_3 = self.ref('base.res_partner_address_3')

def test_0(self):
# partner_2 has no address defined for invoice
addr_ids = self.partner_model.search(
[('parent_id', '=', self.partner_2),
('type', '=', 'invoice')])
self.assertFalse(addr_ids)
res = self.inv_model.onchange_partner_id(
invoice_type='in_invoice', partner_id=self.partner_2)
self.assertFalse('partner_id' in res['value'])

# declare partner_address3 as invoice address
self.partner_model.browse(self.partner_address_3).write(
{'type': 'invoice'})
res = self.inv_model.onchange_partner_id(
invoice_type='in_invoice', partner_id=self.partner_2)
self.assertEqual(self.partner_address_3, res['value']['partner_id'])

0 comments on commit 3a05a2e

Please sign in to comment.