Skip to content

Commit 88c6484

Browse files
OCA git botOCA git bot
OCA git bot
authored and
OCA git bot
committed
Merge remote-tracking branch 'odoo/7.0' into 7.0
2 parents e8281b3 + 1d57a09 commit 88c6484

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

addons/mail/mail_thread.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,9 @@ def message_post(self, cr, uid, thread_id, body='', subject=None, type='notifica
11661166

11671167
# _mail_flat_thread: automatically set free messages to the first posted message
11681168
if self._mail_flat_thread and not parent_id and thread_id:
1169-
message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
1169+
message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model), ('type', '=', 'email')], context=context, order="id ASC", limit=1)
1170+
if not message_ids:
1171+
message_ids = message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
11701172
parent_id = message_ids and message_ids[0] or False
11711173
# 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
11721174
elif parent_id:

addons/sale/wizard/sale_make_invoice_advance.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def _get_advance_product(self, cr, uid, context=None):
5858
'product_id': _get_advance_product,
5959
}
6060

61+
def _translate_advance(self, cr, uid, percentage=False, context=None):
62+
return _("Advance of %s %%") if percentage else _("Advance of %s %s")
63+
6164
def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None):
6265
if advance_payment_method == 'percentage':
6366
return {'value': {'amount':0, 'product_id':False }}
@@ -104,16 +107,17 @@ def _prepare_advance_invoice_vals(self, cr, uid, ids, context=None):
104107
if wizard.advance_payment_method == 'percentage':
105108
inv_amount = sale.amount_total * wizard.amount / 100
106109
if not res.get('name'):
107-
res['name'] = _("Advance of %s %%") % (wizard.amount)
110+
res['name'] = self._translate_advance(cr, uid, percentage=True, context=dict(context, lang=sale.partner_id.lang)) % (wizard.amount)
108111
else:
109112
inv_amount = wizard.amount
110113
if not res.get('name'):
111114
#TODO: should find a way to call formatLang() from rml_parse
112115
symbol = sale.pricelist_id.currency_id.symbol
113116
if sale.pricelist_id.currency_id.position == 'after':
114-
res['name'] = _("Advance of %s %s") % (inv_amount, symbol)
117+
symbol_order = (inv_amount, symbol)
115118
else:
116-
res['name'] = _("Advance of %s %s") % (symbol, inv_amount)
119+
symbol_order = (symbol, inv_amount)
120+
res['name'] = self._translate_advance(cr, uid, context=dict(context, lang=sale.partner_id.lang)) % symbol_order
117121

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

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

0 commit comments

Comments
 (0)