Skip to content

Commit

Permalink
Merge remote-tracking branch 'odoo/7.0' into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
OCA git bot authored and OCA git bot committed Oct 16, 2014
2 parents e8281b3 + 1d57a09 commit 88c6484
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion addons/mail/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,9 @@ def message_post(self, cr, uid, thread_id, body='', subject=None, type='notifica

# _mail_flat_thread: automatically set free messages to the first posted message
if self._mail_flat_thread and not parent_id and thread_id:
message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model), ('type', '=', 'email')], context=context, order="id ASC", limit=1)
if not message_ids:
message_ids = message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
parent_id = message_ids and message_ids[0] or False
# we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread
elif parent_id:
Expand Down
11 changes: 7 additions & 4 deletions addons/sale/wizard/sale_make_invoice_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def _get_advance_product(self, cr, uid, context=None):
'product_id': _get_advance_product,
}

def _translate_advance(self, cr, uid, percentage=False, context=None):
return _("Advance of %s %%") if percentage else _("Advance of %s %s")

def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None):
if advance_payment_method == 'percentage':
return {'value': {'amount':0, 'product_id':False }}
Expand Down Expand Up @@ -104,16 +107,17 @@ def _prepare_advance_invoice_vals(self, cr, uid, ids, context=None):
if wizard.advance_payment_method == 'percentage':
inv_amount = sale.amount_total * wizard.amount / 100
if not res.get('name'):
res['name'] = _("Advance of %s %%") % (wizard.amount)
res['name'] = self._translate_advance(cr, uid, percentage=True, context=dict(context, lang=sale.partner_id.lang)) % (wizard.amount)
else:
inv_amount = wizard.amount
if not res.get('name'):
#TODO: should find a way to call formatLang() from rml_parse
symbol = sale.pricelist_id.currency_id.symbol
if sale.pricelist_id.currency_id.position == 'after':
res['name'] = _("Advance of %s %s") % (inv_amount, symbol)
symbol_order = (inv_amount, symbol)
else:
res['name'] = _("Advance of %s %s") % (symbol, inv_amount)
symbol_order = (symbol, inv_amount)
res['name'] = self._translate_advance(cr, uid, context=dict(context, lang=sale.partner_id.lang)) % symbol_order

# determine taxes
if res.get('invoice_line_tax_id'):
Expand Down Expand Up @@ -159,7 +163,6 @@ def _create_invoices(self, cr, uid, inv_values, sale_id, context=None):
sale_obj.write(cr, uid, sale_id, {'invoice_ids': [(4, inv_id)]}, context=context)
return inv_id


def create_invoices(self, cr, uid, ids, context=None):
""" create invoices for the active sales orders """
sale_obj = self.pool.get('sale.order')
Expand Down

0 comments on commit 88c6484

Please sign in to comment.