[MIG] contract_recurring_analytic_distribution: Migration to 10.0

This commit is contained in:
cubells
2017-10-17 12:51:35 +02:00
committed by Pedro M. Baeza
parent 1c908e94b7
commit 5b62aa6943
8 changed files with 30 additions and 491 deletions

View File

@@ -3,49 +3,49 @@
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common
import odoo.tests.common as common
class TestContractRecurringDistribution(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestContractRecurringDistribution, cls).setUpClass()
cls.partner = cls.env['res.partner'].create({'name': 'Test'})
cls.product = cls.env['product.product'].create({
@common.at_install(False)
@common.post_install(True)
class TestContractRecurringDistribution(common.HttpCase):
def setUp(self):
super(TestContractRecurringDistribution, self).setUp()
self.partner = self.env['res.partner'].create({'name': 'Test'})
self.product = self.env['product.product'].create({
'name': 'Test product',
})
cls.account1 = cls.env['account.analytic.account'].create({
self.account1 = self.env['account.analytic.account'].create({
'name': 'Test account #1',
})
cls.account2 = cls.env['account.analytic.account'].create({
self.account2 = self.env['account.analytic.account'].create({
'name': 'Test account #2',
})
cls.uom = cls.env.ref('product.product_uom_hour')
cls.contract = cls.env['account.analytic.account'].create({
self.uom = self.env.ref('product.product_uom_hour')
self.contract = self.env['account.analytic.account'].create({
'name': 'Test contract',
'partner_id': cls.partner.id,
'type': 'contract',
'partner_id': self.partner.id,
'recurring_invoices': 1,
'recurring_interval': 1,
'recurring_invoice_line_ids': [
(0, 0, {'quantity': 2.0,
'price_unit': 100.0,
'name': 'Test',
'product_id': cls.product.id,
'uom_id': cls.uom.id})],
'product_id': self.product.id,
'uom_id': self.uom.id})],
})
cls.distribution = cls.env['account.analytic.distribution'].create({
self.distribution = self.env['account.analytic.distribution'].create({
'name': 'Test distribution',
'rule_ids': [
(0, 0, {
'sequence': 10,
'percent': 75.00,
'analytic_account_id': cls.account1.id,
'analytic_account_id': self.account1.id,
}),
(0, 0, {
'sequence': 20,
'percent': 25.00,
'analytic_account_id': cls.account2.id,
'analytic_account_id': self.account2.id,
}),
]
})