deisy hace 5 años
padre
commit
de7b6ab9bc
Se han modificado 3 ficheros con 44 adiciones y 29 borrados
  1. 1 0
      models/__init__.py
  2. 16 0
      models/sale_order.py
  3. 27 29
      models/stock_transfer_order.py

+ 1 - 0
models/__init__.py

@@ -1,2 +1,3 @@
 # -*- coding : utf-8 -*-
 import stock_transfer_order
+import sale_order

+ 16 - 0
models/sale_order.py

@@ -0,0 +1,16 @@
+# -*- encoding: utf-8 -*-
+from openerp import models, fields, api, _
+from openerp.exceptions import Warning
+import openerp.addons.decimal_precision as dp
+from datetime import datetime
+from openerp.tools import float_compare
+
+
+class sale_order(models.Model):
+    _inherit = 'sale.order'
+
+    @api.one
+    def action_wait(self):
+        res = super(sale_order, self).action_wait()
+        self.write({'state': 'progress'})
+        return res

+ 27 - 29
models/stock_transfer_order.py

@@ -164,35 +164,33 @@ class sale_order(models.Model):
                 self.env['stock.transfer.order.details.items'].create(items)
             return self.env['stock.transfer.order.details'].wizard_view(created_id)
 
-class stock_location(models.Model):
-    _inherit = "stock.location"
-
-    # @api.multi
-    # def name_get(self):
-    #     if self._context is None:
-    #         self._context = {}
-    #     res = []
-    #     if self._context.get('nombre_para_stock_transfer', False):
-    #         product = self._context.get('transfer_product_id')
-    #         for location in self:
-    #             suma = 0
-    #             quant_ids = self.env['stock.quant'].search([('product_id','=', product),('location_id','=',location.id)])
-    #             if quant_ids:
-    #                 for quant_id in quant_ids:
-    #                     suma = suma + quant_id.qty
-    #
-    #             res.append((location.id, ("%(location_parent)s/%(location_name)s  %(location_qty)s") % {
-    #                 'location_parent': location.location_id.name,
-    #                 'location_name': location.name,
-    #                 'location_qty': suma
-    #             }))
-    #     else:
-    #         for record in self:
-    #             res.append((record.id, ("%(location_parent)s/%(location_name)s") % {
-    #                 'location_parent': record.location_id.name or "",
-    #                 'location_name': record.name
-    #             }))
-    #     return res
+class stock_warehouse(models.Model):
+    _inherit = "stock.warehouse"
+
+    @api.multi
+    def name_get(self):
+        if self._context is None:
+            self._context = {}
+        res = []
+        if self._context.get('nombre_para_stock_transfer', False):
+            product = self._context.get('transfer_product_id')
+            for location in self:
+                suma = 0
+                quant_ids = self.env['stock.quant'].search([('product_id','=', product),('location_id','=',location.lot_stock_id.id)])
+                if quant_ids:
+                    for quant_id in quant_ids:
+                        suma = suma + quant_id.qty
+
+                res.append((location.id, ("%(location_name)s  %(location_qty)s") % {
+                    'location_name': location.name,
+                    'location_qty': suma
+                }))
+        else:
+            for record in self:
+                res.append((record.id, ("%(location_name)s") % {
+                    'location_name': record.name
+                }))
+        return res
 
 class stock_picking(models.Model):
     _inherit = 'stock.picking'