本文整理汇总了Python中odoo.tests.common.Form.balance_end_real方法的典型用法代码示例。如果您正苦于以下问题:Python Form.balance_end_real方法的具体用法?Python Form.balance_end_real怎么用?Python Form.balance_end_real使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类odoo.tests.common.Form
的用法示例。
在下文中一共展示了Form.balance_end_real方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_basic
# 需要导入模块: from odoo.tests.common import Form [as 别名]
# 或者: from odoo.tests.common.Form import balance_end_real [as 别名]
def test_basic(self):
env = self.env(context=dict(self.env.context, journal_type='bank'))
# select the period and journal for the bank statement
journal = env['account.bank.statement'].with_context(
date=time.strftime("%Y/%m/%d"), # ???
)._default_journal()
self.assertTrue(journal, 'Journal has not been selected')
f = Form(env['account.bank.statement'])
# necessary as there may be existing bank statements with a non-zero
# closing balance which will be used to initialise this one.
f.balance_start = 0.0
f.balance_end_real = 0.0
with f.line_ids.new() as line:
line.name = 'EXT001'
line.amount = 1000
line.partner_id = env.ref('base.res_partner_4')
statement_id = f.save()
# process the bank statement line
account = env['account.account'].create({
'name': 'toto',
'code': 'bidule',
'user_type_id': env.ref('account.data_account_type_fixed_assets').id
})
statement_id.line_ids[0].process_reconciliation(new_aml_dicts=[{
'credit': 1000,
'debit': 0,
'name': 'toto',
'account_id': account.id,
}])
with Form(statement_id) as f:
# modify the bank statement and set the Ending Balance.
f.balance_end_real = 1000.0
# confirm the bank statement using Validate button
statement_id.button_confirm_bank()
self.assertEqual(statement_id.state, 'confirm')