mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] Contract Payment Mode to 12.0
This commit is contained in:
committed by
sbejaoui
parent
ea361628f0
commit
c9018e7fe0
@@ -32,11 +32,11 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
|
||||
self.product = self.env['product.product'].create({
|
||||
'name': 'Custom Service',
|
||||
'type': 'service',
|
||||
'uom_id': self.env.ref('product.product_uom_hour').id,
|
||||
'uom_po_id': self.env.ref('product.product_uom_hour').id,
|
||||
'uom_id': self.env.ref('uom.product_uom_hour').id,
|
||||
'uom_po_id': self.env.ref('uom.product_uom_hour').id,
|
||||
'sale_ok': True,
|
||||
})
|
||||
self.contract = self.env['account.analytic.account'].create({
|
||||
self.contract = self.env['contract.contract'].create({
|
||||
'name': 'Maintenance of Servers',
|
||||
})
|
||||
company = self.env.ref('base.main_company')
|
||||
@@ -47,7 +47,7 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
|
||||
'company_id': company.id})
|
||||
|
||||
def test_post_init_hook(self):
|
||||
contract = self.env['account.analytic.account'].create({
|
||||
contract = self.env['contract.contract'].create({
|
||||
'name': 'Test contract',
|
||||
'partner_id': self.partner.id,
|
||||
'payment_mode_id': self.payment_mode.id,
|
||||
@@ -68,20 +68,22 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
|
||||
self.assertEqual(self.contract.payment_mode_id,
|
||||
self.contract.partner_id.customer_payment_mode_id)
|
||||
self.contract.write({
|
||||
'recurring_invoices': True,
|
||||
'recurring_interval': 1,
|
||||
'recurring_invoice_line_ids': [(0, 0, {
|
||||
'quantity': 2.0,
|
||||
'price_unit': 200.0,
|
||||
'name': 'Database Administration 25',
|
||||
'contract_line_ids': [(0, 0, {
|
||||
'product_id': self.product.id,
|
||||
'name': 'Database Administration 25',
|
||||
'quantity': 2.0,
|
||||
'uom_id': self.product.uom_id.id,
|
||||
'price_unit': 200.0,
|
||||
'recurring_rule_type': 'monthly',
|
||||
'recurring_interval': 1,
|
||||
'date_start': '2018-01-01',
|
||||
'recurring_next_date': '2018-01-15',
|
||||
'is_auto_renew': False,
|
||||
})]
|
||||
})
|
||||
self.contract.recurring_create_invoice()
|
||||
new_invoice = self.env['account.invoice'].search([
|
||||
('contract_id', '=', self.contract.id)
|
||||
])
|
||||
new_invoice = self.contract._get_related_invoices()
|
||||
self.assertTrue(new_invoice)
|
||||
self.assertEqual(new_invoice.partner_id, self.contract.partner_id)
|
||||
self.assertEqual(new_invoice.payment_mode_id,
|
||||
self.contract.payment_mode_id)
|
||||
|
||||
Reference in New Issue
Block a user