[FIX]various usability thing

bzr revid: csn@openerp.com-20140212124646-301rfsr1712cdy18
This commit is contained in:
Cedric Snauwaert 2014-02-12 13:46:46 +01:00
parent 190b701012
commit b8826aaa30
4 changed files with 43 additions and 5 deletions

View File

@ -578,7 +578,7 @@ class product_product(osv.osv):
if context is None:
context = {}
product = self.browse(cr, uid, product_id, context=context)
date = context.get('history_date', time.strftime('%Y-%m-%d %H:%M:%s'))
date = context.get('history_date', time.strftime('%Y-%m-%d %H:%M:%S'))
prices_history_obj = self.pool.get('prices.history')
history_ids = prices_history_obj.search(cr, uid, [('company_id', '=', company_id), ('product_template_id', '=', product.product_tmpl_id.id), ('datetime', '<=', date)], limit=1)
if history_ids:

View File

@ -82,6 +82,26 @@ class stock_location(osv.osv):
context_with_inactive['active_test'] = False
return self.search(cr, uid, [('id', 'child_of', ids)], context=context_with_inactive)
def _name_get(self, cr, uid, browse_location, context=None):
# browse_location = self.browse(cr, uid, id, context=context)
location_type = browse_location.usage
name = ''
while location_type != 'view':
name = browse_location.name + '/' + name
browse_location = browse_location.location_id
location_type = browse_location.usage
name = browse_location.name + '/' + name
return name
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
#reads = self.read(cr, uid, ids, ['name','location_id'], context=context)
res = []
for location in self.browse(cr, uid, ids, context=context):
res.append((location.id, self._name_get(cr, uid, location, context=context)))
return res
_columns = {
'name': fields.char('Location Name', size=64, required=True, translate=True),
'active': fields.boolean('Active', help="By unchecking the active field, you may hide a location without deleting it."),

View File

@ -8,10 +8,12 @@ class wizard_valuation_history(osv.osv_memory):
_name = 'wizard.valuation.history'
_description = 'Wizard that opens the stock valuation history table'
_columns = {
'choose_date': fields.boolean('Choose a particular date'),
'date': fields.datetime('Date', required=True),
}
_defaults = {
'choose_date': False,
'date': fields.datetime.now,
}
@ -27,7 +29,7 @@ class wizard_valuation_history(osv.osv_memory):
'domain': "[('date', '<=', '" + data['date'] + "')]",
'name': _('Stock Value At Date'),
'view_type': 'form',
'view_mode': 'tree',
'view_mode': 'tree,graph',
'res_model': 'stock.history',
'type': 'ir.actions.act_window',
'context': ctx,
@ -68,7 +70,7 @@ class stock_history(osv.osv):
'location_id': fields.many2one('stock.location', 'Location', required=True),
'product_id': fields.many2one('product.product', 'Product', required=True),
'product_categ_id': fields.many2one('product.category', 'Product Category', required=True),
'quantity': fields.integer('Quantity'),
'quantity': fields.integer('Quant quantity'),
'date': fields.datetime('Operation Date'),
'price_unit_on_quant': fields.float('Value'),
'cost_method': fields.char('Cost Method'),

View File

@ -7,14 +7,18 @@
<field name="model">wizard.valuation.history</field>
<field name="arch" type="xml">
<form string="Choose your date" version="7.0">
<p class="oe_gray">
<p class="oe_gray" attrs="{'invisible': [('choose_date', '=', False)]}">
Choose the date for wich you want to get the stock valuation of your products.
This will filter the stock operation that weren't done at the selected date, to retreive the quantity
you had, and gives you the inventory value according to the standard price used at that time.
</p>
<p class="oe_gray" attrs="{'invisible': [('choose_date', '=', True)]}">
Retrieve the stock valuation of your products at current day
</p>
<group>
<field name="date"/>
<field name="choose_date"/>
<field name="date" attrs="{'invisible': [('choose_date', '=', False)]}"/>
</group>
<footer>
<button name="open_table" string="Retrieve the Inventory Value" type="object" class="oe_highlight" />
@ -49,6 +53,18 @@
</tree>
</field>
</record>
<record id="view_stock_history_report_graph" model="ir.ui.view">
<field name="name">stock.history.value.graph</field>
<field name="model">stock.history</field>
<field name="arch" type="xml">
<graph string="Stock Value At Date" type="pivot">
<field name="product_id" type="row"/>
<field name="inventory_value" type="measure"/>
<field name="quantity" type="measure"/>
<field name="location_id" type="row"/>
</graph>
</field>
</record>
<record id="view_stock_history_report_search" model="ir.ui.view">
<field name="name">stock.history.report.search</field>
<field name="model">stock.history</field>