[IMP]procurment:Fixed=>changed the all select queries which bypassed the record rules in procurment.py and schedular.py,and change the output location configuaration with company_id=False because of that it will be access by child company

bzr revid: ron@tinyerp.com-20110705061750-7g73nancsfijk0re
This commit is contained in:
ron@tinyerp.com 2011-07-05 11:47:50 +05:30
parent 6c27f121fb
commit f059576ba8
4 changed files with 6 additions and 13 deletions

View File

@ -371,8 +371,8 @@ class procurement_order(osv.osv):
id = procurement.move_id.id
if not (procurement.move_id.state in ('done','assigned','cancel')):
ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id])
cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,))
res = cr.fetchone()[0]
order_point_id = self.pool.get('stock.warehouse.orderpoint').search(cr, uid, [('product_id', '=', procurement.product_id.id)])
res = len(order_point_id)
if not res and not ok:
message = _("Not enough stock and no minimum orderpoint rule defined.")
elif not res:

View File

@ -67,8 +67,7 @@ class procurement_order(osv.osv):
report_except = 0
report_later = 0
while True:
cr.execute("select id from procurement_order where state='confirmed' and procure_method='make_to_order' order by priority,date_planned limit 500 offset %s", (offset,))
ids = map(lambda x: x[0], cr.fetchall())
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_order')], order='priority,date_planned')
for proc in procurement_obj.browse(cr, uid, ids, context=context):
if maxdate >= proc.date_planned:
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
@ -156,11 +155,7 @@ class procurement_order(osv.osv):
wf_service = netsvc.LocalService("workflow")
warehouse_ids = warehouse_obj.search(cr, uid, [], context=context)
cr.execute('select p.id from product_product p \
join product_template t on (p.product_tmpl_id=t.id) \
where p.active=True and t.purchase_ok=True')
products_id = [x for x, in cr.fetchall()]
products_id = product_obj.search(cr, uid, [('active', '=', True), ('purchase_ok', '=', True)], order='id')
for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context):
context['warehouse'] = warehouse
@ -242,8 +237,7 @@ class procurement_order(osv.osv):
if op.procurement_draft_ids:
# Check draft procurement related to this order point
pro_ids = [x.id for x in op.procurement_draft_ids]
cr.execute('select id, product_qty from procurement_order where id in %s order by product_qty desc', (tuple(pro_ids), ))
procure_datas = cr.dictfetchall()
procure_datas = procurement_obj.read(cr, uid, pro_ids, ['id','product_qty'], context=context)
to_generate = qty
for proc_data in procure_datas:
if to_generate >= proc_data['product_qty']:

View File

@ -824,7 +824,6 @@ class procurement_order(osv.osv):
'partner_address_id': address_id,
'location_id': procurement.location_id.id,
'warehouse_id': wharehouse_obj.search(cr, uid, [('company_id','=',procurement.company_id.id or company)])[0],
'company_id': procurement.company_id.id or company,
'pricelist_id': pricelist_id,
'order_line': [(0,0,line)],
'company_id': procurement.company_id.id,

View File

@ -91,8 +91,8 @@
</record>
<record id="stock_location_output" model="stock.location">
<field name="name">Output</field>
<field name="location_id" ref="stock_location_company"/>
<field name="usage">internal</field>
<field name="company_id"></field>
<field name="chained_location_type">customer</field>
<field name="chained_auto_packing">transparent</field>
<field name="chained_picking_type">out</field>