2 Creating a Voucher Receipt for partner Seagate with amount 30000.0
4 !record {model: account.voucher, id: account_voucher_seagate_0, view: view_sale_receipt_form}:
5 account_id: account.a_recv
7 company_id: base.main_company
8 journal_id: account.sales_journal
10 - account_id: account.a_sale
13 partner_id: base.res_partner_19
14 period_id: account.period_9
18 I check that the voucher state is Draft
20 !assert {model: account.voucher, id: account_voucher_seagate_0}:
24 I click on post button to post the voucher
26 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_seagate_0}
29 Check that the voucher state is Posted
31 !assert {model: account.voucher, id: account_voucher_seagate_0}:
35 I check that move lines are validated but not reconciled
37 !python {model: account.voucher}: |
39 for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
43 assert (not reconciled), "Found reconciled move lines, should not be"
45 I create and post a voucher payment of amount 30000.0 for the partner Seagate
47 !python {model: account.voucher}: |
50 journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
51 res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
53 'account_id': ref('account.cash'),
55 'company_id': ref('base.main_company'),
56 'journal_id': ref('account.bank_journal'),
57 'partner_id': ref('base.res_partner_19'),
58 'period_id': ref('account.period_8'),
61 if not res['value']['line_cr_ids']:
62 res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
63 res['value']['line_cr_ids'][0]['amount'] = 30000.0
64 vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
65 id = self.create(cr, uid, vals)
66 voucher_id = self.browse(cr, uid, id)
67 assert (voucher_id.state=='draft'), "Voucher is not in draft state"
68 wf_service = netsvc.LocalService("workflow")
69 wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
71 I check that move lines are reconciled meaning voucher is paid
73 !python {model: account.voucher}: |
75 for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
79 assert reconciled, "Found unreconciled move lines/unpaid voucher"