odoo/addons/account_payment/test/account_payment_order_wiz.yml

38 lines
1.8 KiB
YAML

-
In order to test the Select invoice to pay wizard
-
I create a record for payment order.
-
!record {model: payment.order.create, id: payment_order_create_0}:
duedate: !eval time.strftime('%Y-%m-%d')
-
I perform a action to search the entries for create a payment line
-
!python {model: payment.order.create}: |
self.search_entries(cr, uid, [ref("payment_order_create_0")], {
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
"active_id": ref("payment_order_1"), })
-
In order to make entries in payment line, I create a entries.
-
!python {model: payment.order.create}: |
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
move_line = invoice.move_id.line_id[0]
self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]})
self.create_payment(cr, uid, [ref("payment_order_create_0")], {
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
"active_id": ref("payment_order_1")})
-
I check a payment line is created with proper data.
-
!python {model: payment.order}: |
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
payment = self.browse(cr, uid, ref("payment_order_1"))
payment_line = payment.line_ids[0]
assert payment_line.move_line_id, "move line is not created in payment line."
assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created."
assert invoice.partner_id == payment_line.partner_id, "partner is not same created."
assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created."
assert invoice.amount_total == payment_line.amount, "payment amount is not same created."