Forward port of branch saas-3 up to fc9fc3e

This commit is contained in:
Martin Trigaux 2014-10-06 15:52:23 +02:00
commit 8843974d04
8 changed files with 40 additions and 12 deletions

View File

@ -332,12 +332,12 @@ class account_move_line(osv.osv):
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):

View File

@ -121,14 +121,18 @@ class account_invoice_line(osv.osv):
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'],

View File

@ -86,7 +86,8 @@ openerp_mail_followers = function(session, mail) {
// 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) {
@ -144,6 +145,26 @@ openerp_mail_followers = function(session, mail) {
}
},
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;

View File

@ -36,7 +36,7 @@
-->
<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&amp;id=#{record.id}" t-att-title="record.name"><t t-esc="record.name"/></a>
<a t-attf-href="#model=res.partner&amp;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 &gt; 1)" class="oe_edit_subtype oe_e oe_hidden" title="Edit subscription" t-att-data-id="record.id">&amp;</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>

View File

@ -33,9 +33,9 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
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;
}
}

View File

@ -1002,7 +1002,7 @@ class task(osv.osv):
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

View File

@ -20,6 +20,7 @@
##############################################################################
import logging
import unicodedata
from openerp import tools
import openerp.modules
@ -351,7 +352,8 @@ class ir_translation(osv.osv):
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:

View File

@ -4,6 +4,7 @@ import logging
import openerp.release
import openerp.tools
from openerp.tools.translate import _
import security