GoodERP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.3KB

  1. """2026-10-05:13 → 18 指定修复的回归用例,使用独立事务。"""
  2. from odoo.tests import tagged
  3. from odoo.tests.common import TransactionCase
  4. @tagged('post_install', '-at_install', 'port_13_18')
  5. class TestPortOtherMoney(TransactionCase):
  6. def test_service_tax_and_manual_override(self):
  7. for kind in ('other_get', 'other_pay'):
  8. line = self.env['other.money.order.line'].with_context(order_type=kind).new({'tax_rate': 13})
  9. service = self.env['service'].create({'name': 'PORT费用', 'price': 100, 'tax_rate': 6})
  10. line.service = service
  11. line.onchange_service()
  12. line.onchange_tax_amount()
  13. self.assertEqual((line.tax_rate, line.amount, line.tax_amount), (6, 100, 6))
  14. line.tax_rate = 9
  15. line.onchange_tax_amount()
  16. self.assertEqual(line.tax_amount, 9)
  17. service.tax_rate = 0
  18. line.onchange_service()
  19. line.onchange_tax_amount()
  20. self.assertEqual(line.tax_amount, 0)
  21. line.service = False
  22. line.onchange_service()
  23. self.assertEqual((line.amount, line.tax_rate), (0, 0))
  24. def test_no_company_tax_default(self):
  25. self.env.company.import_tax_rate = 13
  26. self.assertEqual(self.env['other.money.order.line'].new({}).tax_rate, 0)
上海开阖软件有限公司 沪ICP备12045867号-1