def impl(ctx, line_number, level, policy_name): assert_true(ctx.invoice) policy = model('credit.control.policy').get([('name', '=', policy_name)]) assert_true(policy) lines = model('credit.control.line').search([('invoice_id', '=', ctx.invoice.id), ('level', '=', level), ('policy_id', '=', policy.id)]) assert_equal(len(lines), line_number)
def impl(ctx, line_number, level, policy_name): assert_true(ctx.invoice) policy = model('credit.control.policy').get([('name', '=', policy_name)]) assert_true(policy) lines = model('credit.control.line').search([ ('invoice_id', '=', ctx.invoice.id), ('level', '=', level), ('policy_id', '=', policy.id) ]) assert_equal(len(lines), line_number)
def impl(ctx, partner, number, level, move_line_name, amount): to_check = model('credit.control.line').search([('partner_id.name', '=', partner), ('level', '=', level), ('amount_due', '=', amount), ('move_line_id.name', '=', move_line_name), ('state', 'in', ('draft', 'ignored'))]) assert_equal(len(to_check), int(number), msg="More than %s found" % number) lines = model('credit.control.line').browse(to_check) assert set(['ignored', 'draft']) == set(lines.state)
def impl(ctx, invoice_name, level_name, policy_name): invoice = model('account.invoice').get([('number', '=', invoice_name)]) assert_true(invoice, msg='No invoices found') level = model('credit.control.policy.level').get([('name', '=', level_name)]) assert_true(level, 'level not found') policy = model('credit.control.policy').get([('name', '=', policy_name)]) assert_true(policy, 'Policy not found') assert_equal(policy.id, level.policy_id.id) context = {'active_ids': [invoice.id]} data = {'new_policy_id': policy.id, 'new_policy_level_id': level.id} wizard = model('credit.control.policy.changer').create(data, context=context) ctx.wizard = wizard
def impl(ctx, invoice_name, level_name, policy_name): invoice = model('account.invoice').get([('number', '=', invoice_name)]) assert_true(invoice, msg='No invoices found') level = model('credit.control.policy.level').get([('name', '=', level_name) ]) assert_true(level, 'level not found') policy = model('credit.control.policy').get([('name', '=', policy_name)]) assert_true(policy, 'Policy not found') assert_equal(policy.id, level.policy_id.id) context = {'active_ids': [invoice.id]} data = {'new_policy_id': policy.id, 'new_policy_level_id': level.id} wizard = model('credit.control.policy.changer').create(data, context=context) ctx.wizard = wizard
def impl(ctx, level_name, invoice_name): invoice = model('account.invoice').get([('number', '=', invoice_name)]) assert_true(invoice, msg='No invoices found') level = model('credit.control.policy.level').get([('name', '=', level_name)]) assert_true(level, 'level not found') assert_true(ctx.wizard) move_ids = [x.id for x in ctx.wizard.move_line_ids] created_id = model('credit.control.line').search([('move_line_id', 'in', move_ids), ('manually_overridden', '=', False)]) assert len(created_id) == 1 created = model('credit.control.line').get(created_id[0]) ctx.created = created assert_equal(created.policy_level_id.id, level.id) assert_equal(created.invoice_id.id, invoice.id) assert_equal(created.invoice_id.credit_policy_id.id, level.policy_id.id)
def impl(ctx, level_name, invoice_name): invoice = model('account.invoice').get([('number', '=', invoice_name)]) assert_true(invoice, msg='No invoices found') level = model('credit.control.policy.level').get([('name', '=', level_name) ]) assert_true(level, 'level not found') assert_true(ctx.wizard) move_ids = [x.id for x in ctx.wizard.move_line_ids] created_id = model('credit.control.line').search([ ('move_line_id', 'in', move_ids), ('manually_overridden', '=', False) ]) assert len(created_id) == 1 created = model('credit.control.line').get(created_id[0]) ctx.created = created assert_equal(created.policy_level_id.id, level.id) assert_equal(created.invoice_id.id, invoice.id) assert_equal(created.invoice_id.credit_policy_id.id, level.policy_id.id)
def impl(ctx): logins = [row['login'] for row in ctx.table] ctx.found_items = model('res.users').browse([('login', 'in', logins)]) assert_equal(len(ctx.found_items), len(logins))
def impl(ctx, inv_name, state, amount): invoice = model('account.invoice').get([('name', '=', inv_name)]) assert_almost_equal(invoice.residual, amount) assert_equal(invoice.state, state)