from openerp import api, fields, models class AccountPaymentTerm(models.Model): _inherit = 'account.payment.term' @api.model def get_account_payment_terms(self): domain = [('active', '=', True)] terms = [] for term in self.env['account.payment.term'].search(domain): lines = [] for line in term.line_ids: lines.append({ 'id': line.id, 'days': line.days, 'days2': line.days2, 'value': line.value, 'value_amount': line.value_amount }) terms.append({ 'id': term.id, 'name': term.name, 'display_name': term.display_name, 'lines': lines }) return terms