-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Labels
Description
There's nothing specific for on_change events in ERPpeek.
The way to mimic the OpenERP client (6.1) is:
# on_change with ERPpeek for invoice creation
@step('this customer has {nb:d} invoices')
def impl(ctx, nb):
assert_true(ctx.data['partner'])
partner = ctx.data['partner']
account_invoice_obj = model('account.invoice')
for idx in xrange(1, nb + 1):
# On change
data = {
'name': "Invoice # %d" % idx,
'type': "out_invoice",
'address_invoice_id': partner.address[0].id,
'partner_id': partner.id,
}
rv = account_invoice_obj.onchange_partner_id([], 'out_invoice', partner.id, date.today(), False, False)
data.update(rv['value'])
inv = account_invoice_obj.create(data)
if partner.contract_ids:
inv.write({'contract_id': partner.contract_ids[0].id})
ctx.data['invoice'] = invTo be added to the documentation.