2 Creating a Voucher Receipt for partner Seagate with amount 30000.0
4 !record {model: account.voucher, id: account_voucher_seagate_0}:
5 account_id: account.a_recv
7 company_id: base.main_company
9 journal_id: account.sales_journal
11 - account_id: account.a_sale
14 partner_id: base.res_partner_seagate
15 period_id: account.period_9
19 I check that the voucher state is Draft
21 !assert {model: account.voucher, id: account_voucher_seagate_0}:
25 I click on post button to post the voucher
27 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_seagate_0}
30 Check that the voucher state is Posted
32 !assert {model: account.voucher, id: account_voucher_seagate_0}:
36 I check that move lines are validated but not reconciled
38 !python {model: account.voucher}: |
40 for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
44 assert (not reconciled), "Found reconciled move lines, should not be"
46 I create and post a voucher payment of amount 30000.0 for the partner Seagate
48 !python {model: account.voucher}: |
51 journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
52 res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt', date=False)
54 'account_id': ref('account.cash'),
56 'company_id': ref('base.main_company'),
57 'currency_id': ref('base.EUR'),
58 'journal_id': ref('account.bank_journal'),
59 'partner_id': ref('base.res_partner_seagate'),
60 'period_id': ref('account.period_8'),
63 if not res['value']['line_cr_ids']:
64 res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
65 res['value']['line_cr_ids'][0]['amount'] = 30000.0
66 vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
67 id = self.create(cr, uid, vals)
68 voucher_id = self.browse(cr, uid, id)
69 assert (voucher_id.state=='draft'), "Voucher is not in draft state"
70 wf_service = netsvc.LocalService("workflow")
71 wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
73 I check that move lines are reconciled meaning voucher is paid
75 !python {model: account.voucher}: |
77 for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
81 assert reconciled, "Found unreconciled move lines/unpaid voucher"