How to print the list of customer.payment records, which state are in open using wizard. Here is my module. I am using Odoo 9.
class CustomerPayment(models.Model):
_name = 'customer.payment'
_rec_name = 'name'
name = fields.Char(default="New")
invoice_number = fields.Many2one('account.invoice')
customer = fields.Many2one('res.partner')
application_id = fields.Many2one('admission.form')
date = fields.Date()
reference = fields.Char()
cashier = fields.Many2one('res.users')
journal_item = fields.Many2one('journal.item')
payment_account = fields.Many2one('erp.account', default=default_payment_account)
payment_line = fields.One2many('payment.line','payment_id')
description = fields.Text()
state = fields.Selection([('open','Open'), ('payed','Payed'),('refund','Refund')], default="open")
total = fields.Float(compute="get_total")
due_amount = fields.Float(compute="get_payable")
payed = fields.Float()
course_id = fields.Many2one('student.course')
payable = fields.Float()
discount = fields.Float(compute="get_discount")
journal = fields.Many2one('erp.journal', default=get_default_journal)
type = fields.Selection([('sale','Sale'),('purchase','Purchase')])
class report_wizard(models.TransientModel):
_name = 'report.wizard'
Here is function sample, hope you get what I am trying to do.
Account_report
is module name and payment_report
is a report which print only one record using print button.
@api.multi
def print_report(self)
data = self.env['customer.payment'].search([('state','=','open')])
return self.env['report'].render('account_report.payment_report', data)