[MERGE]: Merge with lp:~openerp-dev/openobject-addons/rpa-dev-addons2

bzr revid: rpa@tinyerp.com-20101209120556-62c111plck5qtqry
This commit is contained in:
rpa (Open ERP)
2010-12-09 17:35:56 +05:30
10 changed files with 32 additions and 21 deletions
+3
View File
@@ -113,6 +113,9 @@ class StockMove(osv.osv):
production_obj.force_production(cr, uid, [prod.id])
wf_service.trg_validate(uid, 'mrp.production', prod.id, 'button_produce', cr)
for new_move in new_moves:
if new_move == move.id:
#This move is already there in move lines of production order
continue
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
res.append(new_move)
return res
+1 -1
View File
@@ -760,7 +760,7 @@ class pricelist_partnerinfo(osv.osv):
'name': fields.char('Description', size=64),
'suppinfo_id': fields.many2one('product.supplierinfo', 'Partner Information', required=True, ondelete='cascade'),
'min_quantity': fields.float('Quantity', required=True),
'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price')),
'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price'), help="This price will be considered as a price for default Unit of Measure of the product"),
}
_order = 'min_quantity asc'
pricelist_partnerinfo()
+7 -4
View File
@@ -649,7 +649,7 @@ class purchase_order_line(osv.osv):
'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}}
prod= self.pool.get('product.product').browse(cr, uid, product)
product_uom_pool = self.pool.get('product.uom')
lang=False
if partner_id:
lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang']
@@ -670,15 +670,18 @@ class purchase_order_line(osv.osv):
for s in prod.seller_ids:
if s.name.id == partner_id:
seller_delay = s.delay
temp_qty = s.qty # supplier _qty assigned to temp
temp_qty = s.min_qty # supplier _qty assigned to temp
if s.product_uom:
qty = product_uom_pool._compute_qty(cr, uid, s.product_uom.id, s.min_qty, to_uom_id=prod_uom_po)
uom = prod_uom_po
if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal.
qty = temp_qty
if price_unit:
price = price_unit
else:
price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist],
product, qty or 1.0, partner_id, {
'uom': uom,
product, 1.0, partner_id, {
'uom': prod_uom_po,
'date': date_order,
})[pricelist]
dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
+4
View File
@@ -56,6 +56,10 @@
<workflow action="purchase_confirm" model="purchase.order" ref="order_purchase2"/>
<record id="stock.res_company_tinyshop0" model="res.company">
<field eval="1.0" name="po_lead"/>
<field eval="80.0" name="schedule_range"/>
</record>
</data>
</openerp>
+2 -1
View File
@@ -31,7 +31,8 @@
"depends" : ["purchase","mrp"],
"init_xml" : [],
"demo_xml" : ['purchase_requisition_demo.xml'],
"update_xml" : ["wizard/purchase_requisition_partner_view.xml",
"update_xml" : ["security/purchase_tender.xml",
"wizard/purchase_requisition_partner_view.xml",
"purchase_requisition_data.xml",
"purchase_requisition_view.xml",
"purchase_requisition_report.xml",
@@ -9,7 +9,6 @@
<!--Resource: purchase.requisition-->
<record id="order_purchase_requisition1" model="purchase.requisition">
<field name="name">TE0001</field>
<field name="user_id" model="res.users"/>
<field name="exclusive">multiple</field>
<field name="date_start">2010/09/16 15:56:14</field>
@@ -85,28 +85,28 @@ class purchase_requisition_partner(osv.osv_memory):
partner_list = sorted([(partner.sequence, partner) for partner in line.product_id.seller_ids if partner])
partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False
uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False
newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
newdate = newdate - relativedelta(days=company.po_lead)
if tender.date_start:
newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') - relativedelta(days=company.po_lead)
else:
newdate = datetime.today() - relativedelta(days=company.po_lead)
delay = partner_rec and partner_rec.delay or 0.0
newdate = newdate -(delay and relativedelta(days=delay) or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
if delay:
newdate -= relativedelta(days=delay)
partner = partner_rec and partner_rec.name or supplier_data
pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False
price = pricelist_obj.price_get(cr, uid, [pricelist_id], line.product_id.id, line.product_qty, False, {'uom': uom_id})[pricelist_id]
product = prod_obj.browse(cr, uid, line.product_id.id, context=context)
location_id = self.pool.get('stock.warehouse').read(cr, uid, [tender.warehouse_id.id], ['lot_input_id'])[0]['lot_input_id'][0]
if not newdate:
date_planned = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
else:
date_planned = newdate.strftime('%Y-%m-%d %H:%M:%S')
purchase_order_line= {
'name': product.partner_ref,
'product_qty': line.product_qty,
'product_id': line.product_id.id,
'product_uom': uom_id,
'price_unit': price,
'date_planned': date_planned,
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
'notes': product.description_purchase,
}
taxes_ids = line.product_id.product_tmpl_id.supplier_taxes_id
+1 -1
View File
@@ -138,7 +138,7 @@
<field groups="product.group_uos" name="product_uos_qty"/>
<field groups="product.group_uos" name="product_uos"/>
<field name="product_uom"
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)" domain="[('category_id','=', product_id.uom_id.category_id.id)]"/>
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/>
<field
name="product_packaging"
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
+5 -2
View File
@@ -114,8 +114,11 @@ class stock_location(osv.osv):
product_product_obj = self.pool.get('product.product')
cr.execute('select distinct product_id, location_id from stock_move where location_id in %s or location_dest_id in %s', (tuple(ids), tuple(ids)))
res_products_by_location = sorted(cr.dictfetchall(), key=itemgetter('location_id'))
cr.execute('select distinct product_id, location_id from stock_move where location_id in %s', (tuple(ids), ))
dict1 = cr.dictfetchall()
cr.execute('select distinct product_id, location_dest_id as location_id from stock_move where location_dest_id in %s', (tuple(ids), ))
dict2 = cr.dictfetchall()
res_products_by_location = sorted(dict1+dict2, key=itemgetter('location_id'))
products_by_location = dict((k, [v['product_id'] for v in itr]) for k, itr in groupby(res_products_by_location, itemgetter('location_id')))
result = dict([(i, {}.fromkeys(field_names, 0.0)) for i in ids])
-2
View File
@@ -212,10 +212,8 @@
</record>
<record id="res_company_tinyshop0" model="res.company">
<field name="currency_id" ref="base.EUR"/>
<field eval="1.0" name="po_lead"/>
<field name="partner_id" ref="res_partner_tinyshop1"/>
<field name="parent_id" ref="base.main_company"/>
<field eval="80.0" name="schedule_range"/>
<field eval="&quot;&quot;&quot;Shop 2&quot;&quot;&quot;" name="name"/>
</record>
<record id="stock_location_shop0" model="stock.location">