1234567891011121314151617181920 |
- # -*- 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 = ""
- limite = 20
- if len(self.order_line) > limite:
- message1 += "La cantidad de Linea supera la cantidad permitida para la venta"
- message1 += "\n Cantidad Actual "+str(len(self.order_line))+" lineas"
- message1 += "\n Cantidad Permitida "+str(limite)+" lineas"
- if message1:
- raise Warning(_(message1.rstrip()))
- return super(sale_order,self).action_button_confirm()
|