[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9991 revid:dle@openerp.com-20140417110435-u8uwwcf5ji1b54ao
bzr revid: dle@openerp.com-20140417112655-eeaiokbqzokpwx4i
This commit is contained in:
commit
2b2153bc39
|
@ -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')
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
</group>
|
||||
<group string="Categorization">
|
||||
<field name="priority"/>
|
||||
<field name="categ_id" domain="[('object_id.model', '=', 'crm.helpdesk')]"/>
|
||||
<field name="categ_id" domain="[('object_id.model', '=', 'crm.helpdesk')]" context="{'object_name': 'crm.helpdesk'}"/>
|
||||
<field name="channel_id"/>
|
||||
</group>
|
||||
</group>
|
||||
|
|
|
@ -38,6 +38,17 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="project_task_crm_form">
|
||||
<field name="name">project.task.form.crm</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="inherit_id" ref="project.view_task_form2" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="lead_id" invisible="not context.get('lead_id', False)"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_todo_action">
|
||||
<field name="name">My Tasks</field>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue