浏览代码

Evita duplicar la carga de una factura física legal de proveedor

Sebas 5 年之前
当前提交
bdf9ebd1bb
共有 6 个文件被更改,包括 95 次插入0 次删除
  1. 23 0
      __init__.py
  2. 二进制
      __init__.pyc
  3. 35 0
      __openerp__.py
  4. 37 0
      numberfisico_uniquepurchase.py
  5. 二进制
      numberfisico_uniquepurchase.pyc
  6. 二进制
      static/description/icon.png

+ 23 - 0
__init__.py

@@ -0,0 +1,23 @@
+# -*- 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_uniquepurchase
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

二进制
__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': 'Number Fisica Legal Unique in Supplier Invoice',
+    'version': '1.0',
+    'category': 'Tools',
+    'description': """Controla el número fisica Legal sea único en factura de proveedor.""",
+    'author': 'Eiru Software',
+    'website': 'http://www.eiru.com.py/',
+    'depends': ['account'],
+    'data': [
+    ],
+    'installable': True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 37 - 0
numberfisico_uniquepurchase.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 account_invoice(models.Model):
+    _name = 'account.invoice'
+    _inherit = 'account.invoice'
+
+    @api.one
+    @api.constrains('supplier_invoice_number')
+    def _controla_ruc(self):
+
+        if (self.supplier_invoice_number):
+        # if not (self.invoice_number is None):
+            part_obj = self.env['account.invoice'].search([('supplier_invoice_number','=',self.supplier_invoice_number)])
+            if len(part_obj) > 1:
+                raise ValidationError('El campo número de factura física ya existe y debe ser único')

二进制
numberfisico_uniquepurchase.pyc


二进制
static/description/icon.png