diff --git a/sine_motoscoot_stock/__init__.py b/sine_motoscoot_stock/__init__.py index ece648f..9562bd4 100644 --- a/sine_motoscoot_stock/__init__.py +++ b/sine_motoscoot_stock/__init__.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- import product_motoscoot import picking_extension +import stock_inventory + #import stock_fill_inventory_filter # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/sine_motoscoot_stock/__openerp__.py b/sine_motoscoot_stock/__openerp__.py index 7662ffd..2328d1a 100644 --- a/sine_motoscoot_stock/__openerp__.py +++ b/sine_motoscoot_stock/__openerp__.py @@ -6,8 +6,11 @@ "category": "Generic Modules/Others", "website": "http://sinergiainformatica.net", "description": "Extension.", - "depends": ["product", "stock_location", "stock", "sale"], - "update_xml": ["product_motoscoot_view.xml","picking_extension_view.xml"], + "depends": ["product", "stock_location", "stock", "sale"], + "update_xml": ["product_motoscoot_view.xml", + "picking_extension_view.xml", + "stock_inventory_form_view.xml", + ], "active": True, "installable": True } diff --git a/sine_motoscoot_stock/product_motoscoot.py b/sine_motoscoot_stock/product_motoscoot.py index a0d0ca8..9b9ac2e 100644 --- a/sine_motoscoot_stock/product_motoscoot.py +++ b/sine_motoscoot_stock/product_motoscoot.py @@ -59,8 +59,9 @@ def StockByLocation(self, cr, uid, ids, name, args, context=None): WHEN location_id='12' THEN 'G' WHEN location_id='19' THEN 'B' WHEN location_id='15' THEN 'P' + WHEN location_id='27' THEN 'T' END AS LOC FROM stock_report_prodlots - WHERE (location_id ='12' OR location_id ='19' OR location_id='15') + WHERE (location_id ='12' OR location_id ='19' OR location_id='15' OR location_id='27') AND product_id = '%s' ORDER BY location_id""" % i) res[i] = cr.dictfetchall() @@ -88,7 +89,7 @@ def compute_total_qty(self,cr, uid, ids, name, args, context=None): res = {} for i in ids: cr.execute(""" SELECT sum(qty) as SUMA FROM stock_report_prodlots - WHERE (location_id ='12' OR location_id ='19' OR location_id='15') + WHERE (location_id ='12' OR location_id ='19' OR location_id='15' OR location_id='27') AND product_id = '%s' """ % i) for r in cr.fetchone(): @@ -96,8 +97,8 @@ def compute_total_qty(self,cr, uid, ids, name, args, context=None): if res[i]: return res else: - return 0.0 - + res[i] = 0.0 + return res _columns = { diff --git a/sine_motoscoot_stock/stock_inventory.py b/sine_motoscoot_stock/stock_inventory.py new file mode 100644 index 0000000..081e387 --- /dev/null +++ b/sine_motoscoot_stock/stock_inventory.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +from openerp.osv import fields, osv, orm + + +class stock_inventory_line(osv.osv): + + _inherit = 'stock.inventory.line' + + _columns = { + + 'inv':fields.boolean('Inventariado', help="Marcar para asegurar que el producto está inventariado"), + } + +stock_inventory_line() diff --git a/sine_motoscoot_stock/stock_inventory_form_view.xml b/sine_motoscoot_stock/stock_inventory_form_view.xml new file mode 100644 index 0000000..0b685a7 --- /dev/null +++ b/sine_motoscoot_stock/stock_inventory_form_view.xml @@ -0,0 +1,34 @@ + + + + + stock.inventory.line.inh + stock.inventory.line + + + + + + + + #008000:inv == 'True'; + + + + + + + + stock.inventory.line.form.inh + stock.inventory.line + + + + + + + + + + + \ No newline at end of file diff --git a/sine_wyomind_stock_update/wyomind_update.py b/sine_wyomind_stock_update/wyomind_update.py index 225225e..bbd8037 100644 --- a/sine_wyomind_stock_update/wyomind_update.py +++ b/sine_wyomind_stock_update/wyomind_update.py @@ -49,13 +49,12 @@ class WyomindStockSync(osv.TransientModel): _description = 'Syncronize Stock' def wyomind_sync(self, cr, uid, ids, context=None): - # Wyomind Config - - #db_obj = self.pool['base.external.dbsource'] cr.execute(""" SELECT qty , product_id , location_id FROM stock_report_prodlots WHERE (location_id ='12' OR location_id ='19' OR location_id='15') - ORDER BY location_id""") + ORDER BY location_id""") + ## OR location_id='27')-->?? + res = cr.dictfetchall() result = {} conf_obj = self.pool.get('wyomind.config') @@ -78,12 +77,9 @@ def wyomind_sync(self, cr, uid, ids, context=None): # If product is linked to magento if mag_id is not None: - #if r['location_id'] == 12: - # ads = db_obj.get_stock(cr, SUPERUSER_ID, ids, r['product_id'], r['location_id'], - # context=context) - - # q = r['qty'] - ads - + # Si es ubicacion tienda, sumar stock ubicacion stock Girona + Ubicación stock tienda + #if r['location_id'] == 27: + # q = r[12] + r[27] #else: q = r['qty'] @@ -95,7 +91,9 @@ def wyomind_sync(self, cr, uid, ids, context=None): } location = 0 + # Si ubicacion es girona o tienda, location Magento = 2 if r['location_id'] == 12: + ##or r['location_id'] == 27: location = 2 if r['location_id'] == 15: location = 4 @@ -166,6 +164,8 @@ def action_done(self, cr, uid, ids, context=None): location = 4 if move.location_id.id == 19: location = 3 + #if move.location_id.id == 27: + # location = 2 location2 = 0 if move.location_dest_id.id == 12: @@ -174,13 +174,15 @@ def action_done(self, cr, uid, ids, context=None): location2 = 4 if move.location_dest_id.id == 19: location2 = 3 + #if move.location_dest_id.id == 27: + # location2 = 2 """ Update dest stock location for partial in movements""" # If product is linked to magento - if move.product_id.magento_bind_ids and move.location_dest_id.id not in (0, 22, 24, 25,27) and move.picking_id: + if move.product_id.magento_bind_ids and move.location_dest_id.id not in (0, 22, 24, 25) and move.picking_id: # product stock - if move.location_dest_id.id in (12, 15, 19): + if move.location_dest_id.id in (12, 15, 19,27): cr.execute("""SELECT qty FROM stock_report_prodlots WHERE location_id =%s AND product_id = %s""" % (move.location_dest_id.id, move.product_id.id))