for line_id, invoice_id in cursor.fetchall():
res[line_id] = invoice_id
invoice_ids.append(invoice_id)
- invoice_names = {False: ''}
+ invoice_names = {}
for invoice_id, name in invoice_obj.name_get(cursor, user, invoice_ids, context=context):
invoice_names[invoice_id] = name
for line_id in res.keys():
invoice_id = res[line_id]
- res[line_id] = (invoice_id, invoice_names[invoice_id])
+ res[line_id] = invoice_id and (invoice_id, invoice_names[invoice_id]) or False
return res
def name_get(self, cr, uid, ids, context=None):
if inv.currency_id.id != company_currency:
valuation_price_unit = self.pool.get('res.currency').compute(cr, uid, company_currency, inv.currency_id.id, valuation_price_unit, context={'date': inv.date_invoice})
if valuation_price_unit != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc:
- price_diff = round(i_line.price_unit - valuation_price_unit, account_prec)
- line.update({'price': round(valuation_price_unit * line['quantity'], account_prec)})
+ # price with discount and without tax included
+ price_unit = self.pool['account.tax'].compute_all(cr, uid, line['taxes'],
+ i_line.price_unit * (1-(i_line.discount or 0.0)/100.0), line['quantity'])['total']
+ price_line = round(valuation_price_unit * line['quantity'], account_prec)
+ price_diff = round(price_unit - price_line, account_prec)
+ line.update({'price': price_line})
diff_res.append({
'type': 'src',
'name': i_line.name[:64],
- 'price_unit': price_diff,
+ 'price_unit': round(price_diff / line['quantity'], account_prec),
'quantity': line['quantity'],
- 'price': round(price_diff * line['quantity'], account_prec),
+ 'price': price_diff,
'account_id': acc,
'product_id': line['product_id'],
'uos_id': line['uos_id'],
// event: click on 'edit_subtype(pencil)' button to edit subscription
this.$el.on('click', '.oe_edit_subtype', self.on_edit_subtype);
this.$el.on('click', '.oe_remove_follower', self.on_remove_follower);
- this.$el.on('click', '.oe_show_more', self.on_show_more_followers)
+ this.$el.on('click', '.oe_show_more', self.on_show_more_followers);
+ this.$el.on('click', 'a[data-partner]', self.on_follower_clicked);
},
on_edit_subtype: function(event) {
}
},
+ on_follower_clicked: function (event) {
+ event.preventDefault();
+ var partner_id = $(event.target).data('partner');
+ var state = {
+ 'model': 'res.partner',
+ 'id': partner_id,
+ 'title': this.record_name
+ };
+ session.webclient.action_manager.do_push_state(state);
+ var action = {
+ type:'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'res.partner',
+ views: [[false, 'form']],
+ res_id: partner_id,
+ }
+ this.do_action(action);
+ },
+
read_value: function () {
var self = this;
this.displayed_nb = this.displayed_limit;
-->
<div t-name="mail.followers.partner" class='oe_partner'>
<img class="oe_mail_thumbnail oe_mail_frame" t-attf-src="{record.avatar_url}"/>
- <a t-attf-href="#model=res.partner&id=#{record.id}" t-att-title="record.name"><t t-esc="record.name"/></a>
+ <a t-attf-href="#model=res.partner&id=#{record.id}" t-att-title="record.name" t-att-data-partner="record.id"><t t-esc="record.name"/></a>
<span t-if="record.is_editable and (widget.records_length > 1)" class="oe_edit_subtype oe_e oe_hidden" title="Edit subscription" t-att-data-id="record.id">&</span>
<span t-if="widget.view_is_editable" class="oe_remove_follower oe_e" title="Remove this follower" t-att-data-id="record.id">X</span>
</div>
amount = amount.toFixed(decimals);
}
if(this.currency.position === 'after'){
- return amount + ' ' + this.currency.symbol;
+ return amount + ' ' + (this.currency.symbol || '');
}else{
- return this.currency.symbol + ' ' + amount;
+ return (this.currency.symbol || '') + ' ' + amount;
}
}
if vals.get('project_id') and not context.get('default_project_id'):
context['default_project_id'] = vals.get('project_id')
# user_id change: update date_start
- if vals.get('user_id') and not vals.get('start_date'):
+ if vals.get('user_id') and not vals.get('date_start'):
vals['date_start'] = fields.datetime.now()
# context: no_log, because subtype already handle this
##############################################################################
import logging
+import unicodedata
from openerp import tools
import openerp.modules
trad = res and res[0] or u''
if source and not trad:
return tools.ustr(source)
- return trad
+ # Remove control characters
+ return filter(lambda c: unicodedata.category(c) != 'Cc', tools.ustr(trad))
def create(self, cr, uid, vals, context=None):
if context is None:
import openerp.release
import openerp.tools
+from openerp.tools.translate import _
import security