Przeglądaj źródła

Módulo que sirve que no duplique el campo number_invoice factura fisica de kidron.

Sebas 5 lat temu
commit
d0d9a41556
6 zmienionych plików z 96 dodań i 0 usunięć
  1. 24 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 35 0
      __openerp__.py
  4. 37 0
      numberfisico_unique.py
  5. BIN
      numberfisico_unique.pyc
  6. BIN
      static/description/icon.png

+ 24 - 0
__init__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import numberfisico_unique
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

BIN
__init__.pyc


+ 35 - 0
__openerp__.py

@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'Numero fisica Legal Unique',
+    'version': '1.0',
+    'category': 'Tools',
+    'description': """Controla el Numero fisica Legal sea único.""",
+    'author': 'Eiru Software',
+    'website': 'http://www.eiru.com.py/',
+    'depends': ['sale'],
+    'data': [
+    ],
+    'installable': True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 37 - 0
numberfisico_unique.py

@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp import models, api
+from openerp.exceptions import ValidationError
+
+class sale_order(models.Model):
+    _name = 'sale.order'
+    _inherit = 'sale.order'
+
+    @api.one
+    @api.constrains('invoice_number')
+    def _controla_ruc(self):
+
+        if (self.invoice_number):
+        # if not (self.invoice_number is None):
+            part_obj = self.env['sale.order'].search([('invoice_number','=',self.invoice_number)])
+            if len(part_obj) > 1:
+                raise ValidationError('El campo número de factura física ya existe y debe ser único')

BIN
numberfisico_unique.pyc


BIN
static/description/icon.png