[MREGE]: Merge with lp:~openerp-commiter/openobject-addons/dev-addons2-rha1

bzr revid: rpa@tinyerp.com-20101222123722-0fa3kerln033csfa
This commit is contained in:
rpa (Open ERP)
2010-12-22 18:07:22 +05:30
3 changed files with 22 additions and 16 deletions
@@ -193,16 +193,17 @@ class report_creator(osv.osv):
if context is None:
context = {}
data = context.get('report_id', False)
res = super(report_creator, self).read(cr, user, ids, fields, context, load)
if (not context) or 'report_id' not in context:
return super(report_creator, self).read(cr, user, ids, fields, context, load)
return res
ctx = context or {}
wp = ''
if data:
for data in res:
if not data.get('sql_query'):
return res
if self.model_set_id:
wp = [self._id_get(cr, user, data, context) + (' in (%s)' % (','.join(map(lambda x: "'" + str(x) + "'", ids))))]
report = self._sql_query_get(cr, user, [data], 'sql_query', None, ctx, where_plus = wp)
sql_query = report[data]
cr.execute(sql_query)
cr.execute(data['sql_query'])
res = cr.dictfetchall()
fields_get = self.fields_get(cr, user, None, context)
for r in res:
@@ -216,7 +217,7 @@ class report_creator(osv.osv):
related_name = self.pool.get(field_dict.get('relation')).name_get(cr, user, [r[k]], context)[0]
r[k] = related_name
return res
return res
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
"""
@@ -253,9 +254,8 @@ class report_creator(osv.osv):
newargs += [("count(*) " + a[1] +" " + str(a[2]))]
ctx = context or {}
ctx['getid'] = True
report = self._sql_query_get(cr, user, [context_id], 'sql_query', None, ctx, where_plus = newargs, limit=limit, offset=offset)
query = report[context_id]
cr.execute(query, newargs2)
sql_query = report.sql_query
cr.execute(sql_query, newargs2)
result = cr.fetchall()
return map(lambda x: x[0], result)
+9 -6
View File
@@ -730,12 +730,15 @@
<field name="arch" type="xml">
<search string="Search Production">
<group col='9' colspan='4'>
<filter icon="terp-camera_test" string="Ready"
<filter icon="terp-gtk-media-pause" string="Pending" name="pending"
domain="[('state','=','confirmed')]"
help="Manufacturing Orders which are waiting for raw materials."/>
<filter icon="terp-check" string="In Production" name="inprogress"
domain="[('state','=','in_production')]"
help="Manufacturing Orders which are currently in production."/>
<filter icon="terp-camera_test" string="Ready" name="ready"
domain="[('state','=','ready')]"
help="Non confirmed manufacturing orders"/>
<filter icon="terp-check" string="Current" name="current"
domain="[('state','in',('confirmed','ready','exception','in_production'))]"
help="Manufacturing Orders which are waiting for raw materials, confirmed, ready to start or currently in production."/>
help="Manufacturing Orders which are ready to start production."/>
<separator orientation="vertical"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed', 'ready'))]"
@@ -767,7 +770,7 @@
<field name="view_mode">tree,form,calendar,graph,gantt</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_mrp_production_filter"/>
<field name="context">{'search_default_current':1}</field>
<field name="context">{'search_default_ready':1}</field>
<field name="help">Manufacturing Orders are usually proposed automatically by OpenERP based on the bill of materials and the procurement rules, but you can also create manufacturing orders manually. OpenERP will handle the consumation of the raw materials (stock decrease) and the production of the finished products (stock increase) when the order is processed.</field>
</record>
<menuitem action="mrp_production_action" id="menu_mrp_production_action" parent="menu_mrp_manufacturing" groups="mrp.group_mrp_user,mrp.group_mrp_manager" sequence="1"/>
+4 -1
View File
@@ -99,7 +99,10 @@ class purchase_report(osv.osv):
extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
count(*) as nbr,
(l.price_unit*l.product_qty*u.factor)::decimal(16,2) as price_total,
avg(100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor))::decimal(16,2) as negociation,
avg(case when t.standard_price <= 0 then (l.price_unit*l.product_qty*u.factor)
else
(100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor))
end) as negociation,
sum(t.standard_price*l.product_qty*u.factor)::decimal(16,2) as price_standard,
(sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average
from purchase_order s