Rodney Elpidio Enciso Arias 7 gadi atpakaļ
revīzija
50cce6e056
11 mainītis faili ar 200 papildinājumiem un 0 dzēšanām
  1. 14 0
      README.rst
  2. 19 0
      __init__.py
  3. BIN
      __init__.pyc
  4. 33 0
      __openerp__.py
  5. 23 0
      i18n/es.po
  6. 23 0
      i18n/pt_BR.po
  7. 23 0
      i18n/sl.po
  8. 19 0
      models/__init__.py
  9. BIN
      models/__init__.pyc
  10. 46 0
      models/product.py
  11. BIN
      models/product.pyc

+ 14 - 0
README.rst

@@ -0,0 +1,14 @@
+
+Product Unit Of Measure change fix
+==================================
+This module fix the issue #5695. Product UoM change not working when product
+has no moves.
+
+Credits
+=======
+
+Contributors
+------------
+* Daniel Campos <danielcampos@avanzosc.es>
+* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
+* Ana Juaristi <anajuaristi@avanzosc.es>

+ 19 - 0
__init__.py

@@ -0,0 +1,19 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    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 . import models

BIN
__init__.pyc


+ 33 - 0
__openerp__.py

@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    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": "Product Unit Of Measure change fix",
+    "version": "1.0",
+    "depends": ["product"],
+    "author": "OdooMRP team,"
+              "AvanzOSC,"
+              "Serv. Tecnol. Avanzados - Pedro M. Baeza",
+    'website': "http://www.odoomrp.com",
+    'contributors': ["Daniel Campos <danielcampos@avanzosc.es>",
+                     "Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
+                     "Ana Juaristi <anajuaristi@avanzosc.es>"],
+    'category': 'Sales Management',
+    "data": [],
+    "installable": True
+}

+ 23 - 0
i18n/es.po

@@ -0,0 +1,23 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_uom_change_fix
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: odoomrp-utils (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-10-08 08:45+0000\n"
+"PO-Revision-Date: 2015-09-11 10:23+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: Spanish (http://www.transifex.com/oca/odoomrp-utils-8-0/language/es/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: es\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. module: product_uom_change_fix
+#: model:ir.model,name:product_uom_change_fix.model_product_template
+msgid "Product Template"
+msgstr "Plantilla de producto"

+ 23 - 0
i18n/pt_BR.po

@@ -0,0 +1,23 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_uom_change_fix
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: odoomrp-utils (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-10-08 08:45+0000\n"
+"PO-Revision-Date: 2015-10-09 01:28+0000\n"
+"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
+"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/odoomrp-utils-8-0/language/pt_BR/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: pt_BR\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#. module: product_uom_change_fix
+#: model:ir.model,name:product_uom_change_fix.model_product_template
+msgid "Product Template"
+msgstr "Produto"

+ 23 - 0
i18n/sl.po

@@ -0,0 +1,23 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_uom_change_fix
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: odoomrp-utils (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-10-08 08:45+0000\n"
+"PO-Revision-Date: 2015-09-26 07:43+0000\n"
+"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
+"Language-Team: Slovenian (http://www.transifex.com/oca/odoomrp-utils-8-0/language/sl/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: sl\n"
+"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
+
+#. module: product_uom_change_fix
+#: model:ir.model,name:product_uom_change_fix.model_product_template
+msgid "Product Template"
+msgstr "Predloga proizvoda"

+ 19 - 0
models/__init__.py

@@ -0,0 +1,19 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    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 . import product

BIN
models/__init__.pyc


+ 46 - 0
models/product.py

@@ -0,0 +1,46 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, api
+
+
+class ProductTemplate(models.Model):
+    _inherit = 'product.template'
+
+    @api.multi
+    def write(self, vals):
+        res = {}
+        for product_tmpl in self:
+            write_vals = {}
+            if 'uom_po_id' in vals:
+                write_vals['uom_po_id'] = vals.pop("uom_po_id", None)
+                write_vals['uom_id'] = vals.pop("uom_id", None)
+            if vals:
+                res = super(ProductTemplate, self).write(vals)
+            if write_vals:
+                product_obj = self.env['product.product']
+                st_mv_obj = self.env['stock.move']
+                product_lst = product_obj.search([('product_tmpl_id', '=',
+                                                   product_tmpl.id)])
+                if not st_mv_obj.search([('product_id', 'in',
+                                          product_lst.ids)]):
+                    models.Model.write(self, write_vals)
+                else:
+                    res = super(ProductTemplate, self).write(write_vals)
+            return res

BIN
models/product.pyc