4
2.1 I create a sale invoice
6
!record {model: account.invoice, id: islr_inv02}:
7
company_id: base.main_company
9
date_invoice: !eval time.strftime('%Y-%m-%d')
10
address_contact_id: base.res_partner_address_3
11
address_invoice_id: base.res_partner_address_3
12
account_id: account.a_recv
14
- product_id: product.product_product_pc3
16
uos_id: product.product_uom_unit
19
account_id: account.a_sale
20
concept_id: islr_wh_concept_demo2
23
- product_id: product.product_product_pc4
25
uos_id: product.product_uom_unit
28
concept_id: islr_wh_concept_demo2
29
account_id: account.a_sale
32
journal_id: account.sales_journal
33
partner_id: base.res_partner_notsotinysarl0
38
2.2 I click on Calculate taxes button
40
!python {model: account.invoice}: |
41
acc_brw=self.browse(cr, uid, ref("islr_inv02"))
42
self.button_reset_taxes(cr, uid, [ref("islr_inv02")])
44
2.3 I update check total before validating the invoice
46
!record {model: account.invoice, id: islr_inv02}:
49
2.4 I create invoice by clicking on Create button
51
!workflow {model: account.invoice, action: invoice_open, ref: islr_inv02}
53
2.5 I create wh document
55
!python {model: islr.wh.doc}: |
56
vals = self.onchange_partner_id(cr, uid, [], 'out_invoice', ref('base.res_partner_notsotinysarl0'))
58
{ 'journal_id': ref('withholding_sale_journal'),
59
'name': 'test islr sale',
61
'company_id': ref('base.main_company'),
62
'account_id':ref('withholding_sale_journal'),
64
'partner_id': ref('base.res_partner_notsotinysarl0'),
65
'type': 'out_invoice',
67
res = self.create(cr, uid, vals)
68
assert res, "Wh documents was not created"
69
ai_obj = self.pool.get('account.invoice')
70
ai_obj.write(cr, uid, [ref('islr_inv02')], {'islr_wh_doc_id': res})
72
2.6 check if wh document was asociated wth the invoice (it must be))
74
!assert {model: account.invoice, id: islr_inv02}:
77
2.7 I create validate wh document clicking the Progress button
79
!python {model: account.invoice}: |
81
ai_brw = self.browse(cr, uid, ref('islr_inv02'))
82
wf = netsvc.LocalService("workflow")
83
wf.trg_validate(uid, 'islr.wh.doc', ai_brw.islr_wh_doc_id.id, 'act_progress', cr)
85
2.8 Search for the wh lines
87
!python {model: account.invoice}: |
90
ai_brw = self.browse(cr, uid, ref("islr_inv02"))
91
assert ai_brw.islr_wh_doc_id.amount_total_ret == 750.0, "Bad value for retention amount"