Browse Source

[FIX] comentado funcion que calcula la disponibilidad del producto

Rodney Elpidio Enciso Arias 6 years ago
parent
commit
c324a11718
2 changed files with 58 additions and 59 deletions
  1. 58 59
      models/product.py
  2. BIN
      models/product.pyc

+ 58 - 59
models/product.py

@@ -7,7 +7,6 @@ from openerp.osv import fields as old_fields
 from openerp.exceptions import Warning
 import math
 
-
 class product_product(models.Model):
     _inherit = 'product.product'
 
@@ -24,66 +23,66 @@ class product_product(models.Model):
         help='List of packs where product is used.'
         )
 
-    def _product_available(
-            self, cr, uid, ids, field_names=None, arg=False, context=None):
-        """
-        For product packs we get availability in a different way
-        """
-        pack_product_ids = self.search(cr, uid, [
-            ('pack', '=', True),
-            ('id', 'in', ids),
-        ])
-        res = super(product_product, self)._product_available(
-            cr, uid, list(set(ids) - set(pack_product_ids)),
-            field_names, arg, context)
-        for product in self.browse(cr, uid, pack_product_ids, context=context):
-            pack_qty_available = []
-            pack_virtual_available = []
-            for subproduct in product.pack_line_ids:
-                subproduct_stock = self._product_available(
-                    cr, uid, [subproduct.product_id.id], field_names, arg,
-                    context)[subproduct.product_id.id]
-                sub_qty = subproduct.quantity
-                if sub_qty:
-                    pack_qty_available.append(math.floor(
-                        subproduct_stock['qty_available'] / sub_qty))
-                    pack_virtual_available.append(math.floor(
-                        subproduct_stock['virtual_available'] / sub_qty))
-            # TODO calcular correctamente pack virtual available para negativos
-            res[product.id] = {
-                'qty_available': (
-                    pack_qty_available and min(pack_qty_available) or False),
-                'incoming_qty': 0,
-                'outgoing_qty': 0,
-                'virtual_available': (
-                    pack_virtual_available and
-                    max(min(pack_virtual_available), 0) or False),
-            }
-        return res
+#     def _product_available(
+#             self, cr, uid, ids, field_names=None, arg=False, context=None):
+#         """
+#         For product packs we get availability in a different way
+#         """
+#         pack_product_ids = self.search(cr, uid, [
+#             ('pack', '=', True),
+#             ('id', 'in', ids),
+#         ])
+#         res = super(product_product, self)._product_available(
+#             cr, uid, list(set(ids) - set(pack_product_ids)),
+#             field_names, arg, context)
+#         for product in self.browse(cr, uid, pack_product_ids, context=context):
+#             pack_qty_available = []
+#             pack_virtual_available = []
+#             for subproduct in product.pack_line_ids:
+#                 subproduct_stock = self._product_available(
+#                     cr, uid, [subproduct.product_id.id], field_names, arg,
+#                     context)[subproduct.product_id.id]
+#                 sub_qty = subproduct.quantity
+#                 if sub_qty:
+#                     pack_qty_available.append(math.floor(
+#                         subproduct_stock['qty_available'] / sub_qty))
+#                     pack_virtual_available.append(math.floor(
+#                         subproduct_stock['virtual_available'] / sub_qty))
+#             # TODO calcular correctamente pack virtual available para negativos
+#             res[product.id] = {
+#                 'qty_available': (
+#                     pack_qty_available and min(pack_qty_available) or False),
+#                 'incoming_qty': 0,
+#                 'outgoing_qty': 0,
+#                 'virtual_available': (
+#                     pack_virtual_available and
+#                     max(min(pack_virtual_available), 0) or False),
+#             }
+#         return res
 
-    def _search_product_quantity(self, cr, uid, obj, name, domain, context):
-        """
-        We use original search function
-        """
-        return super(product_product, self)._search_product_quantity(
-            cr, uid, obj, name, domain, context)
+#     def _search_product_quantity(self, cr, uid, obj, name, domain, context):
+#         """
+#         We use original search function
+#         """
+#         return super(product_product, self)._search_product_quantity(
+#             cr, uid, obj, name, domain, context)
 
-    # overwrite ot this fields so that we can modify _product_available
-    # function to support packs
-    _columns = {
-        'qty_available': old_fields.function(
-            _product_available, multi='qty_available',
-            fnct_search=_search_product_quantity),
-        'virtual_available': old_fields.function(
-            _product_available, multi='qty_available',
-            fnct_search=_search_product_quantity),
-        'incoming_qty': old_fields.function(
-            _product_available, multi='qty_available',
-            fnct_search=_search_product_quantity),
-        'outgoing_qty': old_fields.function(
-            _product_available, multi='qty_available',
-            fnct_search=_search_product_quantity),
-    }
+#     # overwrite ot this fields so that we can modify _product_available
+#     # function to support packs
+#     _columns = {
+#         'qty_available': old_fields.function(
+#             _product_available, multi='qty_available',
+#             fnct_search=_search_product_quantity),
+#         'virtual_available': old_fields.function(
+#             _product_available, multi='qty_available',
+#             fnct_search=_search_product_quantity),
+#         'incoming_qty': old_fields.function(
+#             _product_available, multi='qty_available',
+#             fnct_search=_search_product_quantity),
+#         'outgoing_qty': old_fields.function(
+#             _product_available, multi='qty_available',
+#             fnct_search=_search_product_quantity),
+#     }
 
     @api.one
     @api.constrains('pack_line_ids')

BIN
models/product.pyc