[IMP] Corrections on pull request

This commit is contained in:
Josse Colpaert 2014-06-18 16:33:53 +02:00
parent ef228f273f
commit ce3645c9d9
4 changed files with 8 additions and 9 deletions

View File

@ -1310,6 +1310,7 @@ class procurement_order(osv.osv):
if available_draft_po_ids:
po_id = available_draft_po_ids[0]
po_rec = po_obj.browse(cr, uid, po_id, context=context)
#if the product has to be ordered earlier those in the existing PO, we replace the purchase date on the order to avoid ordering it too late
if datetime.strptime(po_rec.date_order, DEFAULT_SERVER_DATE_FORMAT) > purchase_date:
po_obj.write(cr, uid, [po_id], {'date_order': purchase_date}, context=context)
#look for any other PO line in the selected PO with same product and UoM to sum quantities instead of creating a new po line
@ -1369,8 +1370,11 @@ class product_template(osv.Model):
_inherit = 'product.template'
def _get_buy_route(self, cr, uid, context=None):
buy_route = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'purchase', 'route_warehouse0_buy')[1]
return [buy_route]
buy_route = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'purchase.route_warehouse0_buy')
if buy_route:
return [buy_route]
return []
def _purchase_count(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0)

View File

@ -79,9 +79,7 @@ class stock_move(osv.osv):
if move.purchase_line_id:
purchase_line = move.purchase_line_id
res['invoice_line_tax_id'] = [(6, 0, [x.id for x in purchase_line.taxes_id])]
#res['account_analytic_id'] = purc_line.order_id.project_id and sale_line.order_id.project_id.id or False
res['price_unit'] = purchase_line.price_unit
#res['discount'] = sale_line.discount
return res
class stock_picking(osv.osv):

View File

@ -346,10 +346,7 @@ class procurement_order(osv.osv):
procurement_obj = self.pool.get('procurement.order')
offset = 0
ids = [1]
if company_id:
dom = [('company_id', '=', company_id)]
else:
dom = []
dom = company_id and [('company_id', '=', company_id)] or False
while ids:
ids = orderpoint_obj.search(cr, uid, dom, offset=offset, limit=100)
for op in orderpoint_obj.browse(cr, uid, ids, context=context):

View File

@ -3823,7 +3823,7 @@ class stock_pack_operation(osv.osv):
if pack_op.qty_done < pack_op.product_qty:
# we split the operation in two
op = self.copy(cr, uid, pack_op.id, {'product_qty': pack_op.qty_done, 'qty_done': pack_op.qty_done}, context=context)
self.write(cr, uid, pack_op.id, {'product_qty': pack_op.product_qty - pack_op.qty_done, 'qty_done': 0, 'lot_id': False}, context=context)
self.write(cr, uid, [pack_op.id], {'product_qty': pack_op.product_qty - pack_op.qty_done, 'qty_done': 0, 'lot_id': False}, context=context)
processed_ids.append(op)
self.write(cr, uid, processed_ids, {'processed': 'true'}, context=context)