|
- """2026-10-05:13 → 18 指定修复的回归用例,使用独立事务。"""
- from odoo.tests import tagged
- from odoo.tests.common import TransactionCase
-
-
- @tagged('post_install', '-at_install', 'port_13_18')
- class TestPortOtherMoney(TransactionCase):
- def test_service_tax_and_manual_override(self):
- for kind in ('other_get', 'other_pay'):
- line = self.env['other.money.order.line'].with_context(order_type=kind).new({'tax_rate': 13})
- service = self.env['service'].create({'name': 'PORT费用', 'price': 100, 'tax_rate': 6})
- line.service = service
- line.onchange_service()
- line.onchange_tax_amount()
- self.assertEqual((line.tax_rate, line.amount, line.tax_amount), (6, 100, 6))
- line.tax_rate = 9
- line.onchange_tax_amount()
- self.assertEqual(line.tax_amount, 9)
- service.tax_rate = 0
- line.onchange_service()
- line.onchange_tax_amount()
- self.assertEqual(line.tax_amount, 0)
- line.service = False
- line.onchange_service()
- self.assertEqual((line.amount, line.tax_rate), (0, 0))
-
- def test_no_company_tax_default(self):
- self.env.company.import_tax_rate = 13
- self.assertEqual(self.env['other.money.order.line'].new({}).tax_rate, 0)
|