# -*- coding: utf-8 -*- from openerp import models, fields, api class ResPartner(models.Model): _inherit = 'res.partner' @api.model def getResPartnerMedic(self,domain): ResPartner = self.env['res.partner'].search(domain) values = [] for partner in ResPartner: values.append({ 'id': partner.id, 'name': partner.name, 'ruc': partner.ruc, 'street': partner.street, 'city': partner.city, 'state_id': { 'id':partner.state_id.id, 'name':partner.state_id.name, 'complete_name':partner.state_id.complete_name, }, 'phone': partner.phone, 'mobile': partner.mobile, 'email': partner.email, 'property_product_pricelist': partner.property_product_pricelist.name, 'property_product_pricelist_purchase': partner.property_product_pricelist_purchase.name, 'credit': partner.credit, 'debit': partner.debit, 'supplier': partner.supplier, 'is_medic': partner.is_medic, 'medic': [ partner.medic.id, partner.medic.name, ], }) return values class AccountInvoice(models.Model): _inherit = 'account.invoice' @api.model def getAccountInvoiceOdontoimagen(self,domain): AccountInvoice = self.env['account.invoice'].search(domain) decimal_precision = self.env['decimal.precision'].precision_get('Account') values = [] for invoice in AccountInvoice: values.append({ 'id': invoice.id, 'number': invoice.number, 'date_invoice': invoice.date_invoice, 'journal_id':{ 'id': invoice.journal_id.id, 'name': invoice.journal_id.name, }, 'partner_id':{ 'id':invoice.partner_id.id, 'name':invoice.partner_id.name, 'ruc':invoice.partner_id.ruc, }, 'amount_currency': round(invoice.amount_total * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),decimal_precision), }) return values @api.model def getPosOrderOdontoimagen(self,domain): PosOrder = self.env['pos.order'].search(domain) decimal_precision = self.env['decimal.precision'].precision_get('Account') values = [] for order in PosOrder: values.append({ 'id': order.id, 'number': order.name, 'date_order': order.date_order, 'sale_journal':{ 'id': order.sale_journal.id, 'name': order.sale_journal.name, }, 'partner_id':{ 'id': order.partner_id.id, 'name': order.partner_id.name, 'ruc': order.partner_id.ruc, }, 'amount_currency': round(order.amount_total * (order.company_id.currency_id.rate / order.pricelist_id.currency_id.rate),decimal_precision), }) return values class ResCountryState(models.Model): _inherit = 'res.country.state' @api.model def getResCountryState(self,domain): ResCountryState = self.env['res.country.state'].search(domain) values = [] for state in ResCountryState: values.append({ 'id': state.id, 'name': state.name, 'complete_name':state.complete_name, 'parent_id':{ 'id': state.parent_id.id, 'name': state.parent_id.name, }, }) return values