# -*- coding: utf-8 -*- from openerp import models,fields,api,_ from openerp.exceptions import Warning class sale_order(models.Model): _inherit = 'sale.order' @api.multi def action_button_confirm(self): message1 = "" moneda = self.env['res.currency.rate'].search([('currency_id', '=', self.currency_id.id)], order ='id') xrate = moneda[len(moneda) - 1] xcambio = xrate.rate for xorden in self.order_line: if (xorden.price_unit) < ((xorden.product_id.product_tmpl_id.standard_price) * xcambio): message1 += "\n Producto "+str(xorden.name) message1 += "\t Precio de Venta ("+str(xorden.price_unit)+")" message1 += "\t Precio mínimo ("+str((xorden.product_id.product_tmpl_id.standard_price)*xcambio)+")" message = "¡Precio de venta no permitido!\n¡El monto ingresado es menor al precio de costo!" message += message1 if message1: raise Warning(_(message.rstrip())) return super(sale_order,self).action_button_confirm()