parent
500e964ebb
commit
bb3743070d
|
@ -329,10 +329,11 @@ product_template()
|
|||
class product_product(osv.osv):
|
||||
def view_header_get(self, cr, uid, view_id, view_type, context):
|
||||
res = super(product_product, self).view_header_get(cr, uid, view_id, view_type, context)
|
||||
if res: return res
|
||||
if (not context.get('categ_id', False)):
|
||||
return False
|
||||
return _('Products: ')+self.pool.get('product.category').browse(cr, uid, context['categ_id'], context).name
|
||||
if (context.get('categ_id', False)):
|
||||
return _('Products: ')+self.pool.get('product.category').browse(cr, uid, context['categ_id'], context).name
|
||||
if (context.get('location', False)):
|
||||
return _('Products: ')+self.pool.get('stock.location').browse(cr, uid, context['location'], context).name
|
||||
return res
|
||||
|
||||
def _product_price(self, cr, uid, ids, name, arg, context={}):
|
||||
res = {}
|
||||
|
|
|
@ -34,24 +34,27 @@ import time
|
|||
|
||||
def _action_open_window(self, cr, uid, data, context):
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form',
|
||||
'res_model': 'product.product',
|
||||
'type': 'ir.actions.act_window',
|
||||
'context':{'location': data['ids'][0],'from_date':data['form']['from_date'],'to_date':data['form']['to_date']},
|
||||
'domain':[('type','<>','service')]
|
||||
}
|
||||
'name': False,
|
||||
'view_type': 'form',
|
||||
"view_mode": 'tree,form',
|
||||
'res_model': 'product.product',
|
||||
'type': 'ir.actions.act_window',
|
||||
'context':{'location': data['ids'][0],'from_date':data['form']['from_date'],'to_date':data['form']['to_date']},
|
||||
'domain':[('type','<>','service')]
|
||||
}
|
||||
|
||||
|
||||
class product_by_location(wizard.interface):
|
||||
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
<form string="View Stock of Products">
|
||||
<separator string="Stock Location Analysis" colspan="4"/>
|
||||
<field name="from_date"/>
|
||||
<newline/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label string=""/>
|
||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
||||
</form>'''
|
||||
|
||||
form1_fields = {
|
||||
'from_date': {
|
||||
'string': 'From',
|
||||
|
@ -66,13 +69,11 @@ class product_by_location(wizard.interface):
|
|||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [ ('open', 'Open Products'),('end', 'Cancel')]}
|
||||
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Products','gtk-ok')]}
|
||||
},
|
||||
'open': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
product_by_location('stock.location.products')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue