1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (c) 2009 Netquatro C.A. (http://openerp.netquatro.com/) All Rights Reserved.
5
# Javier Duran <javier.duran@netquatro.com>
8
# WARNING: This program as such is intended to be used by professional
9
# programmers who take the whole responsability of assessing all potential
10
# consequences resulting from its eventual inadequacies and bugs
11
# End users who are looking for a ready-to-use solution with commercial
12
# garantees and support are strongly adviced to contract a Free Software
15
# This program is Free Software; you can redistribute it and/or
16
# modify it under the terms of the GNU General Public License
17
# as published by the Free Software Foundation; either version 2
18
# of the License, or (at your option) any later version.
20
# This program is distributed in the hope that it will be useful,
21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
# GNU General Public License for more details.
25
# You should have received a copy of the GNU General Public License
26
# along with this program; if not, write to the Free Software
27
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29
##############################################################################
31
from osv import osv, fields
32
from tools.translate import _
35
class sale_order(osv.osv):
36
_inherit = "sale.order"
39
('o_ref_partner_uniq', 'unique (client_order_ref,partner_id)', 'La orden de compra debe ser unica por Cliente !')
44
def test_ocreq(self, cr, uid, ids):
46
for os in self.browse(cr, uid, ids):
48
raise osv.except_osv(_('Error, No hay Cliente !'),
49
_('Por favor seleccione un cliente, si desea generar la factura.'))
51
valor = os.client_order_ref and os.client_order_ref.strip()
52
if os.partner_id.ocreq and not valor:
53
raise osv.except_osv(_('Error, No hay Orden de Compra !'),
54
_('Por introduzca el Nro. de la orden de compra del cliente, si desea generar la factura.'))