5
I create a supplier invoice
7
!record {model: account.invoice, id: account_invoice_supplier_tax1}:
8
account_id: account.a_pay
10
company_id: base.main_company
13
- account_id: account.a_expense
14
name: '[PC1] Basic PC'
16
product_id: product.product_product_5
20
journal_id: account.expenses_journal
21
partner_id: base.res_partner_23
26
I change the state of invoice to open by clicking Validate button
28
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier_tax1}
30
I check that the invoice state is now "Open"
32
!assert {model: account.invoice, id: account_invoice_supplier_tax1}:
36
I create the first voucher of payment with values 3091.4
38
!record {model: account.voucher, id: account_voucher_tax2, view: False}:
39
company_id: base.main_company
40
account_id: account.cash
43
journal_id: account.bank_journal
44
name: 'First Partial payment: with tax'
45
partner_id: base.res_partner_23
46
period_id: account.period_7
47
date: !eval time.strftime("%Y-%m-%d")
53
!python {model: account.voucher}: |
54
voucher_id = self.search(cr, uid, [('id', '=', ref('account_voucher_tax2'))])
55
voucher = self.browse(cr, uid, voucher_id[0])
56
res=self.onchange_journal(cr, uid, [voucher.id], journal_id=ref('account.bank_journal'), line_ids=[], tax_id=False, partner_id=voucher.partner_id.id, date=voucher.date, amount=3091.4, ttype='payment', company_id=voucher.company_id.id, context=None)
57
onchange_journal_value=res.get('value', {}) or {}
58
lines=onchange_journal_value.pop('line_dr_ids')[0]
60
lines_format.append(lines)
61
onchange_journal_value['line_dr_ids']=[tuple(lines_format)]
62
self.write(cr,uid, [voucher.id], onchange_journal_value)
63
assert (voucher.amount==3091.4) , "check amount"
65
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_tax2}
69
I create the second voucher of payment with values 3091.4
71
!record {model: account.voucher, id: account_voucher_tax3, view: False}:
72
company_id: base.main_company
73
account_id: account.cash
76
journal_id: account.bank_journal
77
name: 'Second Partial payment: with tax'
78
partner_id: base.res_partner_c2c
79
period_id: account.period_7
80
date: !eval time.strftime("%Y-%m-%d")
86
!python {model: account.voucher}: |
87
voucher_id = self.search(cr, uid, [('id', '=', ref('account_voucher_tax3'))])
88
voucher = self.browse(cr, uid, voucher_id[0])
89
res=self.onchange_journal(cr, uid, [voucher.id], journal_id=ref('account.bank_journal'), line_ids=[], tax_id=False, partner_id=voucher.partner_id.id, date=voucher.date, amount=3091.4, ttype='payment', company_id=voucher.company_id.id, context=None)
90
onchange_journal_value=res.get('value', {}) or {}
91
lines=onchange_journal_value.pop('line_dr_ids')[0]
93
lines_format.append(lines)
94
onchange_journal_value['line_dr_ids']=[tuple(lines_format)]
95
self.write(cr,uid, [voucher.id], onchange_journal_value)
96
assert (voucher.amount==3091.4) , "check amount"
98
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_tax3}