2
# -*- encoding: utf-8 -*-
3
###########################################################################
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
7
###############Credits######################################################
8
# Coded by: Vauxoo C.A.
9
# Planified by: Nhomar Hernandez
10
# Audited by: Vauxoo C.A.
11
#############################################################################
12
# This program is free software: you can redistribute it and/or modify
13
# it under the terms of the GNU Affero General Public License as published by
14
# the Free Software Foundation, either version 3 of the License, or
15
# (at your option) any later version.
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# GNU Affero General Public License for more details.
22
# You should have received a copy of the GNU Affero General Public License
23
# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
################################################################################
27
from report import report_sxw
31
class rep_conteo_stock2(report_sxw.rml_parse):
35
def __init__(self, cr, uid, name, context):
36
super(rep_conteo_stock2, self).__init__(cr, uid, name, context)
37
self.localcontext.update({
39
'get_data':self.get_data ,
40
'get_tipo':self.get_tipo ,
41
'get_category':self.get_category ,
42
'get_state':self.get_state ,
43
'get_destinado':self.get_destinado ,
44
'get_suministro':self.get_suministro ,
45
'get_qty_available':self.get_qty_available ,
46
'get_code':self.get_code ,
49
def get_tipo(self, stock=None):
50
product= self.pool.get('product.template')
53
if stock.tipo=="almacenable" or stock.tipo=="consumible":
54
cabeza.append("Almacenable/Consumible")
56
if stock.tipo=="servicio":
57
cabeza.append("Servicio")
60
cabeza.append("Almacenable - Consumible / Servicio")
63
def get_category(self, stock=None):
64
product= self.pool.get('product.template')
67
cabeza.append(" %s"%(stock.categoria.name))
69
cabeza.append("Todas las Categorias")
72
def get_state(self, stock=None):
73
product= self.pool.get('product.template')
76
cabeza.append(" %s"%(stock.estado))
78
cabeza.append("Todas los Estados")
81
def get_destinado(self, stock=None):
82
product= self.pool.get('product.template')
89
cabeza =cabeza+" Comprable"
92
cabeza=cabeza + "Alquilable"
94
if not stock.vendible and not stock.comprable and not stock.alquilable:
95
cabeza="Vendible Comprable Alquilable"
98
def get_suministro(self, stock=None):
99
product= self.pool.get('product.template')
102
cabeza.append(" %s"%(stock.suministro))
104
cabeza.append("Todas los Tipos de Suministro")
109
def get_data (self,stock=None ):
110
product= self.pool.get('product.template')
112
##################para el tipo del producto####################
114
if stock.tipo=="almacenable":
115
merge.append( ('type', '=',"product"))
116
if stock.tipo=="consumible":
117
merge.append( ('type', '=',"consut"))
118
if stock.tipo=="servicio":
119
merge.append( ('type', '=',"service") )
121
##################para la categoria####################
124
merge.append( ('categ_id', '=',stock.categoria.id) )
126
##################para el estado####################
128
if stock.estado=="desarrollo":
129
merge.append( ('state', '=',"draft") )
131
if stock.estado=="produccion":
132
merge.append( ('state', '=',"sellable") )
134
if stock.estado=="fin":
135
merge.append( ('state', '=',"end") )
137
if stock.estado=="obsoleto":
138
merge.append( ('state', '=',"obsolete") )
140
if stock.estado=="none":
141
merge.append( ('state', '=',None) )
143
##################destinado a ser: vendible, conyable, alquilable####################
145
merge.append( ('sale_ok', '=',True) )
148
merge.append( ('purchase_ok', '=',True) )
151
merge.append( ('rental', '=',True) )
153
##################tipo de suministro####################
155
if stock.suministro=="comprar":
156
merge.append( ('supply_method', '=','produce') )
158
if stock.suministro=="producir":
159
merge.append( ('supply_method', '=','buy') )
161
id_productos=product.search(self.cr, self.uid, merge, order="name" )
162
data =product.browse(self.cr,self.uid, id_productos) #lista de product_template que cumplen la condicion
166
def get_qty_available (self,id_template ):
169
product= self.pool.get('product.product')
171
id_producto=product.search(self.cr, self.uid, [('product_tmpl_id', '=',id_template.id)])
172
producto=product.browse(self.cr,self.uid, id_producto[0])
173
qty=producto.qty_available
174
qty2=producto.virtual_available
181
def get_code(self,id_template):
183
product= self.pool.get('product.product')
185
id_producto=product.search(self.cr, self.uid, [('product_tmpl_id', '=',id_template.id)])
186
producto=product.browse(self.cr,self.uid, id_producto[0])
193
report_sxw.report_sxw(
196
'addons/inventory_stock_report/report/hoja_conteo_qty2.rml' ,
197
parser=rep_conteo_stock2 ,
200
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: