GoodERP
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

34 lines
1.4KB

  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 TestPortCheckout(TransactionCase):
  6. def _checkout(self, month, account=None):
  7. period = self.env['finance.period'].create({'year': '2040', 'month': str(month)})
  8. day = '2040-%02d-28' % month
  9. if account:
  10. voucher = self.env['voucher'].create({'date': day, 'line_ids': [
  11. (0, 0, {'name': 'PORT', 'account_id': self.env.ref('finance.account_cash').id, 'debit': 100}),
  12. (0, 0, {'name': 'PORT', 'account_id': account.id, 'credit': 100}),
  13. ]})
  14. voucher.voucher_done()
  15. wizard = self.env['checkout.wizard'].create({'period_id': period.id, 'date': day})
  16. result = wizard.button_checkout()
  17. self.assertTrue(period.is_closed)
  18. vouchers = self.env['voucher'].search([('period_id', '=', period.id), ('is_checkout', '=', True)], order='create_date desc', limit=1)
  19. if vouchers:
  20. self.assertEqual(result['res_id'], vouchers.id)
  21. else:
  22. self.assertFalse(result)
  23. def test_monthly(self):
  24. self._checkout(6, self.env.ref('finance.account_income'))
  25. def test_annual_only(self):
  26. self._checkout(12, self.env.company.profit_account)
  27. def test_no_voucher(self):
  28. self._checkout(6)
上海开阖软件有限公司 沪ICP备12045867号-1