diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index 81394bc926e..8ef17fa886c 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -123,6 +123,8 @@ class account_invoice_line(osv.osv): if a == line['account_id'] and i_line.product_id.id == line['product_id']: uom = i_line.product_id.uos_id or i_line.product_id.uom_id valuation_price_unit = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.standard_price, i_line.uos_id.id) + if inv.currency_id.id != company_currency: + standard_price = self.pool.get('res.currency').compute(cr, uid, company_currency, inv.currency_id.id, standard_price, context={'date': inv.date_invoice}) if i_line.product_id.cost_method != 'standard' and i_line.purchase_line_id: #for average/fifo/lifo costing method, fetch real cost price from incomming moves stock_move_obj = self.pool.get('stock.move') diff --git a/addons/crm_helpdesk/crm_helpdesk_view.xml b/addons/crm_helpdesk/crm_helpdesk_view.xml index 3065d2fa6af..79615715f5f 100644 --- a/addons/crm_helpdesk/crm_helpdesk_view.xml +++ b/addons/crm_helpdesk/crm_helpdesk_view.xml @@ -52,7 +52,7 @@ - + diff --git a/addons/crm_todo/crm_todo_view.xml b/addons/crm_todo/crm_todo_view.xml index b9cbb42a0fa..c0d9067eaf9 100644 --- a/addons/crm_todo/crm_todo_view.xml +++ b/addons/crm_todo/crm_todo_view.xml @@ -38,6 +38,17 @@ + + project.task.form.crm + project.task + 20 + + + + + + + My Tasks diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 5469af23b25..54fbf572eb1 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -395,7 +395,7 @@ class email_template(osv.osv): is taken from template definition) :returns: a dict containing all relevant fields for creating a new mail.mail entry, with one extra key ``attachments``, in the - format expected by :py:meth:`mail_thread.message_post`. + format [(report_name, data)] where data is base64 encoded. """ if context is None: context = {} @@ -447,6 +447,7 @@ class email_template(osv.osv): if template.lang: ctx['lang'] = self.render_template_batch(cr, uid, template.lang, template.model, [res_id], context)[res_id] # take 0 ? result, format = openerp.report.render_report(cr, uid, [res_id], report_service, {'model': template.model}, ctx) + # TODO in trunk, change return format to binary to match message_post expected format result = base64.b64encode(result) if not report_name: report_name = 'report.' + report_service diff --git a/addons/note/note.py b/addons/note/note.py index 00c67c37191..3e419888c28 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -128,16 +128,15 @@ class note_note(osv.osv): current_stage_ids = self.pool.get('note.stage').search(cr,uid,[('user_id','=',uid)], context=context) if current_stage_ids: #if the user have some stages - - #dict of stages: map les ids sur les noms - stage_name = dict(self.pool.get('note.stage').name_get(cr, uid, current_stage_ids, context=context)) + stages = self.pool['note.stage'].browse(cr, uid, current_stage_ids, context=context) result = [{ #notes by stage for stages user '__context': {'group_by': groupby[1:]}, - '__domain': domain + [('stage_ids.id', '=', current_stage_id)], - 'stage_id': (current_stage_id, stage_name[current_stage_id]), - 'stage_id_count': self.search(cr,uid, domain+[('stage_ids', '=', current_stage_id)], context=context, count=True) - } for current_stage_id in current_stage_ids] + '__domain': domain + [('stage_ids.id', '=', stage.id)], + 'stage_id': (stage.id, stage.name), + 'stage_id_count': self.search(cr,uid, domain+[('stage_ids', '=', stage.id)], context=context, count=True), + '__fold': stage.fold, + } for stage in stages] #note without user's stage nb_notes_ws = self.search(cr,uid, domain+[('stage_ids', 'not in', current_stage_ids)], context=context, count=True) @@ -153,8 +152,9 @@ class note_note(osv.osv): result = [{ '__context': {'group_by': groupby[1:]}, '__domain': domain + [dom_not_in], - 'stage_id': (current_stage_ids[0], stage_name[current_stage_ids[0]]), - 'stage_id_count':nb_notes_ws + 'stage_id': (stages[0].id, stages[0].name), + 'stage_id_count':nb_notes_ws, + '__fold': stages[0].name, }] + result else: # if stage_ids is empty diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 7e73d7fcd53..9a77f836f03 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2072,41 +2072,46 @@ class stock_move(osv.osv): if context is None: context = {} seq_obj = self.pool.get('ir.sequence') - for picking, todo in self._chain_compute(cr, uid, moves, context=context).items(): - ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) - if picking: - # name of new picking according to its type - if ptype == 'internal': - new_pick_name = seq_obj.get(cr, uid,'stock.picking') - else : - new_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + ptype) - pickid = self._create_chained_picking(cr, uid, new_pick_name, picking, ptype, todo, context=context) - # Need to check name of old picking because it always considers picking as "OUT" when created from Sales Order - old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id) - if old_ptype != picking.type: - old_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + old_ptype) - self.pool.get('stock.picking').write(cr, uid, [picking.id], {'name': old_pick_name, 'type': old_ptype}, context=context) - else: - pickid = False - for move, (loc, dummy, delay, dummy, company_id, ptype, invoice_state) in todo: - new_id = move_obj.copy(cr, uid, move.id, { - 'location_id': move.location_dest_id.id, - 'location_dest_id': loc.id, - 'date': time.strftime('%Y-%m-%d'), - 'picking_id': pickid, - 'state': 'waiting', - 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) , - 'move_history_ids': [], - 'date_expected': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'), - 'move_history_ids2': []} - ) - move_obj.write(cr, uid, [move.id], { - 'move_dest_id': new_id, - 'move_history_ids': [(4, new_id)] - }) - new_moves.append(self.browse(cr, uid, [new_id])[0]) - if pickid: - self.pool.get('stock.picking').signal_button_confirm(cr, uid, [pickid]) + for picking, chained_moves in self._chain_compute(cr, uid, moves, context=context).items(): + # We group the moves by automatic move type, so it creates different pickings for different types + moves_by_type = {} + for move in chained_moves: + moves_by_type.setdefault(move[1][1], []).append(move) + for todo in moves_by_type.values(): + ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) + if picking: + # name of new picking according to its type + if ptype == 'internal': + new_pick_name = seq_obj.get(cr, uid,'stock.picking') + else : + new_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + ptype) + pickid = self._create_chained_picking(cr, uid, new_pick_name, picking, ptype, todo, context=context) + # Need to check name of old picking because it always considers picking as "OUT" when created from Sales Order + old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id) + if old_ptype != picking.type: + old_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + old_ptype) + self.pool.get('stock.picking').write(cr, uid, [picking.id], {'name': old_pick_name, 'type': old_ptype}, context=context) + else: + pickid = False + for move, (loc, dummy, delay, dummy, company_id, ptype, invoice_state) in todo: + new_id = move_obj.copy(cr, uid, move.id, { + 'location_id': move.location_dest_id.id, + 'location_dest_id': loc.id, + 'date': time.strftime('%Y-%m-%d'), + 'picking_id': pickid, + 'state': 'waiting', + 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) , + 'move_history_ids': [], + 'date_expected': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'), + 'move_history_ids2': []} + ) + move_obj.write(cr, uid, [move.id], { + 'move_dest_id': new_id, + 'move_history_ids': [(4, new_id)] + }) + new_moves.append(self.browse(cr, uid, [new_id])[0]) + if pickid: + self.pool.get('stock.picking').signal_button_confirm(cr, uid, [pickid]) if new_moves: new_moves += self.create_chained_picking(cr, uid, new_moves, context) return new_moves