[MERGE] forward port of branch 7.0 up to 78a29b3

This commit is contained in:
Christophe Simonis 2014-10-21 13:06:27 +02:00
commit 22c390285f
6 changed files with 22 additions and 9 deletions

View File

@ -293,6 +293,13 @@ class res_partner(osv.osv):
model = 'res.partner', res_id = part.id,
partner_ids = [responsible_partner_id])
return super(res_partner, self).write(cr, uid, ids, vals, context=context)
def copy(self, cr, uid, record_id, default=None, context=None):
if default is None:
default = {}
default.update({'unreconciled_aml_ids': []})
return super(res_partner, self).copy(cr, uid, record_id, default, context)
def action_done(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'payment_next_action_date': False, 'payment_next_action':'', 'payment_responsible_id': False}, context=context)

View File

@ -244,7 +244,7 @@
<para style="terp_default_8">[[o.contract_id.qualif or '_']]</para>
<para style="terp_default_8">[[o.contract_id.niveau or '_']]</para>
<para style="terp_default_8">[[o.contract_id.coef or '_']]</para>
<para style="P5">[[o.contract_id.date_start or '_']] Sortie : [[o.contract_id.date_end or '']] </para>
<para style="P5">[[ formatLang(o.contract_id.date_start, date=True) or '_']] Sortie : [[ formatLang(o.contract_id.date_end, date=True) or '_']] </para>
</td>
</tr>
<tr>

View File

@ -1538,7 +1538,9 @@ class mail_thread(osv.AbstractModel):
# _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:

View File

@ -56,7 +56,7 @@ class pos_order_report(osv.osv):
sum(l.qty * u.factor) as product_qty,
sum(l.qty * l.price_unit) as price_total,
sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount,
(sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price,
(sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal as average_price,
sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation,
s.partner_id as partner_id,
s.state as state,

View File

@ -58,6 +58,9 @@ class sale_advance_payment_inv(osv.osv_memory):
'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 }}
@ -104,16 +107,17 @@ class sale_advance_payment_inv(osv.osv_memory):
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'):
@ -159,7 +163,6 @@ class sale_advance_payment_inv(osv.osv_memory):
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')

View File

@ -233,6 +233,7 @@ class res_partner(osv.osv, format_address):
'date': fields.date('Date', select=1),
'title': fields.many2one('res.partner.title', 'Title'),
'parent_id': fields.many2one('res.partner', 'Related Company', select=True),
'parent_name': fields.related('parent_id', 'name', type='char', readonly=True, string='Parent name'),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Contacts', domain=[('active','=',True)]), # force "active_test" domain to bypass _search() override
'ref': fields.char('Reference', size=64, select=1),
'lang': fields.selection(_lang_get, 'Language',
@ -577,7 +578,7 @@ class res_partner(osv.osv, format_address):
for record in self.browse(cr, uid, ids, context=context):
name = record.name
if record.parent_id and not record.is_company:
name = "%s, %s" % (record.parent_id.name, name)
name = "%s, %s" % (record.parent_name, name)
if context.get('show_address_only'):
name = self._display_address(cr, uid, record, without_company=True, context=context)
if context.get('show_address'):
@ -780,7 +781,7 @@ class res_partner(osv.osv, format_address):
'state_name': address.state_id and address.state_id.name or '',
'country_code': address.country_id and address.country_id.code or '',
'country_name': address.country_id and address.country_id.name or '',
'company_name': address.parent_id and address.parent_id.name or '',
'company_name': address.parent_id and address.parent_name or '',
}
for field in self._address_fields(cr, uid, context=context):
args[field] = getattr(address, field) or ''