[MERGE] Forward-port saas-4 up to bf135ad

This commit is contained in:
Olivier Dony 2014-05-28 17:45:31 +02:00
commit e276ac33f6
23 changed files with 157 additions and 86 deletions

View File

@ -65,7 +65,7 @@ class res_partner(osv.osv):
'date_review_next' : fields.date('Next Partner Review'),
# customer implementation
'assigned_partner_id': fields.many2one(
'res.partner', 'Implementedy by',
'res.partner', 'Implemented by',
),
'implemented_partner_ids': fields.one2many(
'res.partner', 'assigned_partner_id',

View File

@ -42,6 +42,7 @@ this event.
'data': [
'event_sale_view.xml',
'event_sale_data.xml',
'security/ir.model.access.csv',
],
'demo': ['event_demo.xml'],
'test': ['test/confirm.yml'],

View File

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_event_ticket_user,event.event.ticket.user,event_sale.model_event_event_ticket,event.group_event_user,1,0,0,0
access_event_event_ticket_admin,event.event.ticket.admin,event_sale.model_event_event_ticket,event.group_event_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_event_event_ticket_user event.event.ticket.user event_sale.model_event_event_ticket event.group_event_user 1 0 0 0
3 access_event_event_ticket_admin event.event.ticket.admin event_sale.model_event_event_ticket event.group_event_manager 1 1 1 1

View File

@ -95,9 +95,12 @@ class AcquirerPaypal(osv.Model):
return 0.0
country = self.pool['res.country'].browse(cr, uid, country_id, context=context)
if country and acquirer.company_id.country_id.id == country.id:
fees = amount * (1 + acquirer.fees_dom_var / 100.0) + acquirer.fees_dom_fixed - amount
percentage = acquirer.fees_dom_var
fixed = acquirer.fees_dom_fixed
else:
fees = amount * (1 + acquirer.fees_int_var / 100.0) + acquirer.fees_int_fixed - amount
percentage = acquirer.fees_int_var
fixed = acquirer.fees_int_fixed
fees = (percentage / 100.0 * amount + fixed ) / (1 - percentage / 100.0)
return fees
def paypal_form_generate_values(self, cr, uid, id, partner_values, tx_values, context=None):

View File

@ -148,7 +148,7 @@ class PaypalForm(PaypalCommon):
for form_input in tree.input:
if form_input.get('name') in ['handling']:
handling_found = True
self.assertEqual(form_input.get('value'), '1.56', 'paypal: wrong computed fees')
self.assertEqual(form_input.get('value'), '1.57', 'paypal: wrong computed fees')
self.assertTrue(handling_found, 'paypal: fees_active did not add handling input in rendered form')
@mute_logger('openerp.addons.payment_paypal.models.paypal', 'ValidationError')

View File

@ -436,16 +436,6 @@ instance.web.ActionManager = instance.web.Widget.extend({
ir_actions_act_window: function (action, options) {
var self = this;
if (action.target === 'current'){
action.context['active_model'] = action.res_model;
if (action.res_id){
action.context['active_id'] = action.res_id;
action.context['active_ids'] = [action.res_id];
} else{
delete action.context['active_id'];
delete action.context['active_ids'];
}
}
return this.ir_actions_common({
widget: function () { return new instance.web.ViewManagerAction(self, action); },
action: action,
@ -895,7 +885,20 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
this._super(parent, null, action.views, flags);
this.session = parent.session;
this.action = action;
var dataset = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain);
var context = action.context;
if (action.target === 'current'){
var active_context = {
active_model: action.res_model,
};
context = new instance.web.CompoundContext(context, active_context).eval();
delete context['active_id'];
delete context['active_ids'];
if (action.res_id){
context['active_id'] = action.res_id;
context['active_ids'] = [action.res_id];
}
}
var dataset = new instance.web.DataSetSearch(this, action.res_model, context, action.domain);
if (action.res_id) {
dataset.ids.push(action.res_id);
dataset.index = 0;

View File

@ -150,3 +150,7 @@ div#blog_angle_down a:hover {
mark + .popover {
cursor: pointer;
}
.discussion_scroll_post {
overflow-x: auto;
}

View File

@ -134,3 +134,6 @@ div#blog_angle_down
mark + .popover
cursor: pointer
.discussion_scroll_post
overflow-x: auto

View File

@ -9,7 +9,7 @@
<button class="btn btn-danger btn-xs js_publish_btn">Not Published</button>
<button class="btn btn-success btn-xs js_publish_btn">Published</button>
</div>
<div class="media-body">
<div class="media-body discussion_scroll_post">
<div t-esc='res.body'/>
<small class="text-muted">
by

View File

@ -236,7 +236,7 @@
"fields": ["name"]
}'/>
<span class="text-muted">on <span t-field="message.date"/></span>
<div t-field="message.body"/>
<div t-field="message.body" class="discussion_scroll_post"/>
</div>
</li>
</ul>

View File

@ -13,6 +13,9 @@ Publish and Assign Partner
'views/partner_grade.xml',
'views/website_crm_partner_assign.xml',
],
'demo': [
'data/res_partner_grade_demo.xml',
],
'qweb': ['static/src/xml/*.xml'],
'installable': True,
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<record id="crm_partner_assign.res_partner_grade_platinium" model="res.partner.grade">
<field name="website_published" eval="True" />
</record>
<record id="crm_partner_assign.res_partner_grade_gold" model="res.partner.grade">
<field name="website_published" eval="True" />
</record>
<record id="crm_partner_assign.res_partner_grade_silver" model="res.partner.grade">
<field name="website_published" eval="True" />
</record>
<record id="crm_partner_assign.res_partner_grade_bronze" model="res.partner.grade">
<field name="website_published" eval="True" />
</record>
</data>
</openerp>

View File

@ -1,5 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_event_ticket_public,event.event.ticket.public,event_sale.model_event_event_ticket,,1,0,0,0
access_event_event_ticket_admin,event.event.ticket.admin,event_sale.model_event_event_ticket,event.group_event_manager,1,1,1,1
access_event_product_product_public,event.product.product.public,product.model_product_product,base.group_public,1,0,0,0
access_event_product_template_public,event.product.template.public,product.model_product_template,base.group_public,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_event_event_ticket_public event.event.ticket.public event_sale.model_event_event_ticket 1 0 0 0
access_event_event_ticket_admin event.event.ticket.admin event_sale.model_event_event_ticket event.group_event_manager 1 1 1 1
3 access_event_product_product_public event.product.product.public product.model_product_product base.group_public 1 0 0 0
4 access_event_product_template_public event.product.template.public product.model_product_template base.group_public 1 0 0 0

View File

@ -81,6 +81,7 @@ class WebsiteMail(http.Controller):
'is_user': uid != public_id,
'email': email,
'is_follower': False,
'alias_name': False,
}
if not obj:
@ -95,8 +96,5 @@ class WebsiteMail(http.Controller):
('res_id', '=', obj_ids[0]),
('partner_id', '=', partner_id.id)
], context=context)) == 1
if post.get('fields'):
record = obj.read(cr, SUPERUSER_ID, obj_ids[0], fields=post.get('fields'), context=context)
values.update(record)
return values

View File

@ -493,53 +493,5 @@
</template>
<template id="subscribe" inherit_id="website.snippets" name="Snippet Subscribe">
<xpath expr="//div[@id='snippet_content']" position="inside">
<div>
<div class="oe_snippet_thumbnail">
<img class="oe_snippet_thumbnail_img" src="/website/static/src/img/blocks/block_button.png"/>
<span class="oe_snippet_thumbnail_title">Subscribe Button</span>
</div>
<div class="oe_snippet_body js_follow"
data-id="0"
data-object="mail.group"
data-follow="off">
<div class="input-group js_mg_follow_form">
<input
type="email"
name="email"
class="js_follow_email form-control"
placeholder="your email..."/>
<span class="input-group-btn">
<button href="#" class="btn btn-primary js_follow_btn">Subscribe</button>
</span>
</div>
<p class="js_mg_details hidden well well-sm">
<i class="fa fa-envelope-o"/><a href="#" class="js_mg_email"> send mail</a> -
<i class="fa fa-file-o"/><a href="#" class="js_mg_link"> archives</a> -
<i class="fa fa-times"/><a href="#" class="js_unfollow_btn"> unsubscribe</a>
</p>
</div>
</div>
</xpath>
<xpath expr="//div[@id='snippet_options']" position="inside">
<div data-snippet-option-id='subscribe'
data-selector=".js_follow"
data-selector-siblings="p, h1, h2, h3, blockquote, .well, .panel"
>
<li>
<a href="#" class="button js_mailing_list">Change mailing list</a>
</li>
</div>
</xpath>
</template>
</data>
</openerp>

View File

@ -21,7 +21,6 @@
<template id="head" inherit_id="website.assets_frontend" name="Mail customization">
<xpath expr="/t" position="inside">
<script type="text/javascript" src="/website_mail/static/src/js/website_mail.js"></script>
<link rel='stylesheet' href='/website_mail/static/src/css/website_mail.css'/>
</xpath>
</template>

View File

@ -11,7 +11,8 @@ OpenERP Mail Group : Mailing List Archives
'author': 'OpenERP SA',
'depends': ['website_mail'],
'data': [
'views/website_mail_group.xml'
'views/website_mail_group.xml',
'views/snippets.xml',
],
'qweb': [],
'installable': True,

View File

@ -129,3 +129,9 @@ class MailGroup(http.Controller):
'replies_per_page': self._replies_per_page,
}
return request.registry['ir.ui.view'].render(request.cr, request.uid, 'website_mail_group.messages_short', values, engine='ir.qweb', context=request.context)
@http.route("/groups/<model('mail.group'):group>/get_alias_info", type='json', auth='public', website=True)
def get_alias_info(self, group, **post):
return {
'alias_name': group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain and '%s@%s' % (group.alias_id.alias_name, group.alias_id.alias_domain) or False
}

View File

@ -12,15 +12,12 @@
openerp.jsonRpc('/website_mail/is_follower', 'call', {
model: this.$target.data('object'),
id: this.$target.data('id'),
fields: ['name', 'alias_id'],
get_alias_info: true,
}).always(function (data) {
self.is_user = data.is_user;
self.$target.find('.js_mg_email').attr('href', 'mailto:' + data.alias_id[1]);
self.$target.find('.js_mg_link').attr('href', '/groups/' + data.id);
self.toggle_subscription(data.is_follower);
self.$target.find('input.js_follow_email')
.val(data.email ? data.email : "")
.attr("disabled", data.is_follower || (data.email.length && self.is_user) ? "disabled" : false);
self.email = data.email;
self.$target.find('.js_mg_link').attr('href', '/groups/' + self.$target.data('id'));
self.toggle_subscription(data.is_follower, data.email);
self.$target.removeClass("hidden");
});
@ -36,6 +33,7 @@
return;
},
on_click: function () {
event.preventDefault();
var self = this;
var $email = this.$target.find(".js_follow_email");
@ -51,10 +49,11 @@
'message_is_follower': this.$target.attr("data-follow") || "off",
'email': $email.length ? $email.val() : false,
}).then(function (follow) {
self.toggle_subscription(follow);
self.toggle_subscription(follow, self.email);
});
},
toggle_subscription: function(follow) {
toggle_subscription: function(follow, email) {
var alias_done = this.get_alias_info();
if (follow) {
this.$target.find(".js_mg_follow_form").addClass("hidden");
this.$target.find(".js_mg_details").removeClass("hidden");
@ -63,9 +62,27 @@
this.$target.find(".js_mg_follow_form").removeClass("hidden");
this.$target.find(".js_mg_details").addClass("hidden");
}
this.$target.find('input.js_follow_email').attr("disabled", follow || this.is_user ? "disabled" : false);
this.$target.find('input.js_follow_email')
.val(email ? email : "")
.attr("disabled", follow || (email.length && this.is_user) ? "disabled" : false);
this.$target.attr("data-follow", follow ? 'on' : 'off');
return $.when(alias_done);
},
get_alias_info: function() {
var self = this;
if (! this.$target.data('id')) {
return $.Deferred().resolve();
}
return openerp.jsonRpc('/groups/' + this.$target.data('id') + '/get_alias_info', 'call', {}).then(function (data) {
if (data.alias_name) {
self.$target.find('.js_mg_email').attr('href', 'mailto:' + data.alias_name);
self.$target.find('.js_mg_email').removeClass('hidden');
}
else {
self.$target.find('.js_mg_email').addClass('hidden');
}
});
}
});
$(document).ready(function () {

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="subscribe" inherit_id="website.snippets" name="Snippet Subscribe">
<xpath expr="//div[@id='snippet_content']" position="inside">
<div>
<div class="oe_snippet_thumbnail">
<img class="oe_snippet_thumbnail_img" src="/website_mail/static/src/img/blocks/button_group_subscribe.png"/>
<span class="oe_snippet_thumbnail_title">Discussion Group</span>
</div>
<div class="oe_snippet_body js_follow"
data-id="0"
data-object="mail.group"
data-follow="off">
<div class="input-group js_mg_follow_form">
<input
type="email"
name="email"
class="js_follow_email form-control"
placeholder="your email..."/>
<span class="input-group-btn">
<button href="#" class="btn btn-primary js_follow_btn">Subscribe</button>
</span>
</div>
<p class="js_mg_details hidden well well-sm">
<span class="js_mg_email hidden"><i class="fa fa-envelope-o"/><a href="#" class="js_mg_email"> send mail</a> - </span>
<i class="fa fa-file-o"/><a href="#" class="js_mg_link"> archives</a> -
<i class="fa fa-times"/><a href="#" class="js_unfollow_btn"> unsubscribe</a>
</p>
</div>
</div>
</xpath>
<xpath expr="//div[@id='snippet_options']" position="inside">
<div data-snippet-option-id='subscribe'
data-selector=".js_follow"
data-selector-siblings="p, h1, h2, h3, blockquote, .well, .panel"
>
<li>
<a href="#" class="button js_mailing_list">Change Discussion List</a>
</li>
</div>
</xpath>
</template>
</data>
</openerp>

View File

@ -8,6 +8,13 @@
</xpath>
</template>
<template id="head" inherit_id="website.layout" name="Mail Group Customization">
<xpath expr="//head" position="inside">
<script type="text/javascript" src="/website_mail_group/static/src/js/website_mail_group.editor.js" groups="base.group_website_publisher"></script>
<script type="text/javascript" src="/website_mail_group/static/src/js/website_mail_group.snippet.js"></script>
</xpath>
</template>
<template id="mail_groups" name="Mailing Lists">
<t t-call="website.layout">
<div id="wrap" class="oe_structure oe_empty">
@ -23,8 +30,10 @@
<div class="col-md-3">
<img t-att-src="'/website/image?model=mail.group&amp;field=image_small&amp;id='+str(group['id'])" class="pull-left"/>
<strong><a t-attf-href="/groups/#{ slug(group) }" t-esc="group.name"/></strong><br />
<i class='fa fa-envelope-o'/>
<a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
<t t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
<i class='fa fa-envelope-o'/>
<a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
</t>
</div>
<div class="col-md-4">
<div t-esc="group.description" class="text-muted"/>
@ -59,7 +68,7 @@
<div class="row">
<h1 class="text-center">
<t t-esc="group.name"/> mailing list archives
</h1><h4 class="text-center text-muted">
</h1><h4 class="text-center text-muted" t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
<i class='fa fa-envelope-o'/>
<a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
</h4>
@ -123,7 +132,7 @@
<div class="row">
<h1 class="text-center">
<t t-esc="group.name"/> mailing list archives
</h1><h4 class="text-center text-muted">
</h1><h4 class="text-center text-muted" t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
<i class='fa fa-envelope-o'/>
<a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
</h4>

View File

@ -20,7 +20,7 @@
<div t-if="fax and 'fax' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-file-text-o'/> <span itemprop="faxNumber" t-esc="fax"/></div>
<div t-if="website and 'website' in fields" class='css_editable_mode_hidden'>
<i t-if="not options.get('no_marker')" class='fa fa-globe'/>
<a t-att-href="website"><span itemprop="website" t-esc="website"/></a>
<a t-att-href="website and '%s%s' % ('http://' if '://' not in website else '',website)"><span itemprop="website" t-esc="website"/></a>
</div>
<div t-if="email and 'email' in fields" class='css_editable_mode_hidden'><i t-if="not options.get('no_marker')" class='fa fa-envelope'/> <span itemprop="email" t-esc="email"/></div>
</div>