summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-06-19 16:23:32 +0200
committerChristophe Simonis <chs@odoo.com>2014-06-19 16:23:32 +0200
commiteef6330c55bc7d829359fbb733a1adc4c149309b (patch)
tree11dede8d58d1db5d3f2998e79b3ecd9dd0e76776
parentdc4178a9624e49b6bad7dc924206b22fc23d435e (diff)
parentadf07a9490436211d16da8b1355c3bae4448a54a (diff)
[MERGE] forward port of branch saas-5 up to adf07a9
-rw-r--r--addons/account/account_invoice.py3
-rw-r--r--addons/account/views/report_agedpartnerbalance.xml2
-rw-r--r--addons/account_analytic_analysis/account_analytic_analysis.py51
-rw-r--r--addons/account_voucher/voucher_sales_purchase_view.xml2
-rw-r--r--addons/auth_oauth/controllers/main.py4
-rw-r--r--addons/calendar/static/src/js/base_calendar.js2
-rw-r--r--addons/event/report/report_event_registration.py4
-rw-r--r--addons/event/static/src/css/event.css2
-rw-r--r--addons/event_sale/event_sale.py3
-rw-r--r--addons/gamification/models/challenge.py2
-rw-r--r--addons/google_calendar/google_calendar.py9
-rw-r--r--addons/hr/hr.py2
-rw-r--r--addons/hr/hr_view.xml8
-rw-r--r--addons/hr_holidays/hr_holidays.py2
-rw-r--r--addons/l10n_be_invoice_bba/invoice.py2
-rw-r--r--addons/mail/mail_followers.py4
-rw-r--r--addons/mail/mail_group.py13
-rw-r--r--addons/mail/mail_mail.py10
-rw-r--r--addons/mail/mail_thread.py19
-rw-r--r--addons/mail/wizard/mail_compose_message.py5
-rw-r--r--addons/mass_mailing/models/mail_mail.py3
-rw-r--r--addons/mass_mailing/views/mass_mailing.xml1
-rw-r--r--addons/mrp/mrp.py4
-rw-r--r--addons/product/product.py11
-rw-r--r--addons/product_email_template/models/invoice.py2
-rw-r--r--addons/project/project_demo.xml4
-rw-r--r--addons/stock/stock_view.xml4
-rw-r--r--addons/web/static/src/css/base.css5
-rw-r--r--addons/web/static/src/css/base.sass4
-rw-r--r--addons/web/static/src/js/formats.js13
-rw-r--r--addons/web/static/src/js/search.js4
-rw-r--r--addons/web/static/src/js/view_form.js5
-rw-r--r--addons/web/static/src/js/view_list_editable.js43
-rw-r--r--addons/web_calendar/static/src/js/web_calendar.js14
-rw-r--r--addons/website/static/src/js/website.editor.js9
-rw-r--r--addons/website/static/src/js/website.mobile.js2
-rw-r--r--addons/website_forum/controllers/main.py2
-rw-r--r--addons/website_forum/static/src/js/website_forum.js2
-rw-r--r--addons/website_mail/controllers/main.py3
-rw-r--r--addons/website_mail/static/src/js/follow.js68
-rw-r--r--addons/website_mail/views/website_mail.xml1
-rw-r--r--addons/website_mail_group/__init__.py1
-rw-r--r--addons/website_mail_group/controllers/main.py16
-rw-r--r--addons/website_mail_group/models/__init__.py1
-rw-r--r--addons/website_mail_group/models/mail_group.py18
-rw-r--r--addons/website_mail_group/static/src/js/website_mail_group.snippet.js8
-rw-r--r--addons/website_mail_group/views/snippets.xml4
-rw-r--r--addons/website_mail_group/views/website_mail_group.xml2
-rw-r--r--addons/website_sale/controllers/main.py4
-rw-r--r--addons/website_sale/views/templates.xml2
-rw-r--r--openerp/addons/base/ir/ir_actions.py7
-rw-r--r--openerp/addons/base/ir/ir_actions.xml3
-rw-r--r--openerp/osv/fields.py2
-rw-r--r--openerp/osv/orm.py2
54 files changed, 295 insertions, 128 deletions
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index eb43830f8f6..96d63c545c6 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -295,7 +295,8 @@ class account_invoice(osv.osv):
},
multi='all'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
- 'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]},
+ domain="[('type', 'in', {'out_invoice': ['sale'], 'out_refund': ['sale_refund'], 'in_refund': ['purchase_refund'], 'in_invoice': ['purchase']}.get(type, [])), ('company_id', '=', company_id)]"),
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
diff --git a/addons/account/views/report_agedpartnerbalance.xml b/addons/account/views/report_agedpartnerbalance.xml
index 019f32a35de..c1f9047e330 100644
--- a/addons/account/views/report_agedpartnerbalance.xml
+++ b/addons/account/views/report_agedpartnerbalance.xml
@@ -99,7 +99,7 @@
</tr>
<tr t-foreach="get_lines_with_out_partner(data['form'])" t-as="not_partner">
<td>
- <span t-esc="partner['name']"/>
+ <span t-esc="not_partner['name']"/>
</td>
<td class="text-right">
<span t-esc="formatLang(not_partner['direction'], currency_obj=res_company.currency_id)"/>
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 519660fb708..9550f77bcab 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -22,7 +22,6 @@ from dateutil.relativedelta import relativedelta
import datetime
import logging
import time
-import traceback
from openerp.osv import osv, fields
from openerp.osv.orm import intersect, except_orm
@@ -73,6 +72,7 @@ class account_analytic_invoice_line(osv.osv):
result = {}
res = self.pool.get('product.product').browse(cr, uid, product, context=local_context)
+ price = False
if price_unit is not False:
price = price_unit
elif pricelist_id:
@@ -746,29 +746,32 @@ class account_analytic_account(osv.osv):
contract_ids = ids
else:
contract_ids = self.search(cr, uid, [('recurring_next_date','<=', current_date), ('state','=', 'open'), ('recurring_invoices','=', True), ('type', '=', 'contract')])
- for contract in self.browse(cr, uid, contract_ids, context=context):
- try:
- invoice_values = self._prepare_invoice(cr, uid, contract, context=context)
- invoice_ids.append(self.pool['account.invoice'].create(cr, uid, invoice_values, context=context))
- next_date = datetime.datetime.strptime(contract.recurring_next_date or current_date, "%Y-%m-%d")
- interval = contract.recurring_interval
- if contract.recurring_rule_type == 'daily':
- new_date = next_date+relativedelta(days=+interval)
- elif contract.recurring_rule_type == 'weekly':
- new_date = next_date+relativedelta(weeks=+interval)
- elif contract.recurring_rule_type == 'monthly':
- new_date = next_date+relativedelta(months=+interval)
- else:
- new_date = next_date+relativedelta(years=+interval)
- self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
- if automatic:
- cr.commit()
- except Exception:
- if automatic:
- cr.rollback()
- _logger.error(traceback.format_exc())
- else:
- raise
+ if contract_ids:
+ cr.execute('SELECT company_id, array_agg(id) as ids FROM account_analytic_account WHERE id IN %s GROUP BY company_id', (tuple(contract_ids),))
+ for company_id, ids in cr.fetchall():
+ for contract in self.browse(cr, uid, ids, context=dict(context, company_id=company_id, force_company=company_id)):
+ try:
+ invoice_values = self._prepare_invoice(cr, uid, contract, context=context)
+ invoice_ids.append(self.pool['account.invoice'].create(cr, uid, invoice_values, context=context))
+ next_date = datetime.datetime.strptime(contract.recurring_next_date or current_date, "%Y-%m-%d")
+ interval = contract.recurring_interval
+ if contract.recurring_rule_type == 'daily':
+ new_date = next_date+relativedelta(days=+interval)
+ elif contract.recurring_rule_type == 'weekly':
+ new_date = next_date+relativedelta(weeks=+interval)
+ elif contract.recurring_rule_type == 'monthly':
+ new_date = next_date+relativedelta(months=+interval)
+ else:
+ new_date = next_date+relativedelta(years=+interval)
+ self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
+ if automatic:
+ cr.commit()
+ except Exception:
+ if automatic:
+ cr.rollback()
+ _logger.exception('Fail to create recurring invoice for contract %s', contract.code)
+ else:
+ raise
return invoice_ids
class account_analytic_account_summary_user(osv.osv):
diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml
index d0064d6336c..f8c2d65f63b 100644
--- a/addons/account_voucher/voucher_sales_purchase_view.xml
+++ b/addons/account_voucher/voucher_sales_purchase_view.xml
@@ -248,7 +248,7 @@
<page string="Bill Information">
<field name="line_dr_ids" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" context="{'journal_id':journal_id,'partner_id':partner_id}">
<tree string="Expense Lines" editable="bottom">
- <field name="account_id" widget="selection" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
+ <field name="account_id" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
<field name="name"/>
<field name="amount"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py
index 99f134a5cbd..7652420d7c6 100644
--- a/addons/auth_oauth/controllers/main.py
+++ b/addons/auth_oauth/controllers/main.py
@@ -74,7 +74,7 @@ class OAuthLogin(Home):
state = dict(
d=request.session.db,
p=provider['id'],
- r=redirect,
+ r=werkzeug.url_quote_plus(redirect),
)
token = request.params.get('token')
if token:
@@ -143,7 +143,7 @@ class OAuthController(http.Controller):
cr.commit()
action = state.get('a')
menu = state.get('m')
- redirect = state.get('r')
+ redirect = werkzeug.url_unquote_plus(state['r']) if state.get('r') else False
url = '/web'
if redirect:
url = redirect
diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js
index eed958e20d9..37669840818 100644
--- a/addons/calendar/static/src/js/base_calendar.js
+++ b/addons/calendar/static/src/js/base_calendar.js
@@ -102,7 +102,7 @@ openerp.calendar = function(instance) {
var self = this;
var action_url = '';
- action_url = _.str.sprintf('/?db=%s#id=%s&view_type=form&model=calendar.event', db, meeting_id);
+ action_url = _.str.sprintf('/web?db=%s#id=%s&view_type=form&model=calendar.event', db, meeting_id);
var reload_page = function(){
return location.replace(action_url);
diff --git a/addons/event/report/report_event_registration.py b/addons/event/report/report_event_registration.py
index e76b5c60d1f..c4a4dfd6b2d 100644
--- a/addons/event/report/report_event_registration.py
+++ b/addons/event/report/report_event_registration.py
@@ -32,7 +32,7 @@ class report_event_registration(osv.osv):
'draft_state': fields.integer(' # No of Draft Registrations', size=20),
'confirm_state': fields.integer(' # No of Confirmed Registrations', size=20),
'seats_max': fields.integer('Max Seats'),
- 'nbevent': fields.integer('Number Of Events'),
+ 'nbevent': fields.integer('Number of Registrations'),
'event_type': fields.many2one('event.type', 'Event Type'),
'registration_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Attended'), ('cancel', 'Cancelled')], 'Registration State', readonly=True, required=True),
'event_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Event State', readonly=True, required=True),
@@ -59,7 +59,7 @@ class report_event_registration(osv.osv):
r.name AS name_registration,
e.company_id AS company_id,
e.date_begin AS event_date,
- count(e.id) AS nbevent,
+ count(r.id) AS nbevent,
CASE WHEN r.state IN ('draft') THEN r.nb_register ELSE 0 END AS draft_state,
CASE WHEN r.state IN ('open','done') THEN r.nb_register ELSE 0 END AS confirm_state,
e.type AS event_type,
diff --git a/addons/event/static/src/css/event.css b/addons/event/static/src/css/event.css
index ff5bfaba19b..53c03cc03f0 100644
--- a/addons/event/static/src/css/event.css
+++ b/addons/event/static/src/css/event.css
@@ -1,7 +1,7 @@
.oe_event_date{
border-top-left-radius:3px;
border-top-right-radius:3px;
- font-size: 48px;
+ font-size: 36px;
height: auto;
font-weight: bold;
text-align: center;
diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py
index ed99e6a39cc..69ad0cb6af6 100644
--- a/addons/event_sale/event_sale.py
+++ b/addons/event_sale/event_sale.py
@@ -245,7 +245,8 @@ class event_ticket(osv.osv):
]
def onchange_product_id(self, cr, uid, ids, product_id=False, context=None):
- return {'value': {'price': self.pool.get("product.product").browse(cr, uid, product_id).list_price or 0}}
+ price = self.pool.get("product.product").browse(cr, uid, product_id).list_price if product_id else 0
+ return {'value': {'price': price}}
class event_registration(osv.osv):
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index ddc08336293..faed62f8da9 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -58,7 +58,7 @@ def start_end_date_for_period(period, default_start_date=False, default_end_date
end_date = default_end_date
if start_date and end_date:
- return (start_date.strftime(DF), end_date.strftime(DF))
+ return (datetime.strftime(start_date, DF), datetime.strftime(end_date, DF))
else:
return (start_date, end_date)
diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py
index 543c81977aa..dd1d45c05fe 100644
--- a/addons/google_calendar/google_calendar.py
+++ b/addons/google_calendar/google_calendar.py
@@ -699,7 +699,7 @@ class google_calendar(osv.AbstractModel):
for att in att_obj.browse(cr, uid, my_att_ids, context=context):
event = att.event_id
- base_event_id = att.google_internal_event_id.split('_')[0]
+ base_event_id = att.google_internal_event_id.rsplit('_', 1)[0]
if base_event_id not in event_to_synchronize:
event_to_synchronize[base_event_id] = {}
@@ -721,7 +721,7 @@ class google_calendar(osv.AbstractModel):
for event in all_event_from_google.values():
event_id = event.get('id')
- base_event_id = event_id.split('_')[0]
+ base_event_id = event_id.rsplit('_', 1)[0]
if base_event_id not in event_to_synchronize:
event_to_synchronize[base_event_id] = {}
@@ -786,7 +786,7 @@ class google_calendar(osv.AbstractModel):
if actSrc == 'OE':
self.delete_an_event(cr, uid, current_event[0], context=context)
elif actSrc == 'GG':
- new_google_event_id = event.GG.event['id'].split('_')[1]
+ new_google_event_id = event.GG.event['id'].rsplit('_', 1)[1]
if 'T' in new_google_event_id:
new_google_event_id = new_google_event_id.replace('T', '')[:-1]
else:
@@ -795,7 +795,8 @@ class google_calendar(osv.AbstractModel):
if event.GG.status:
parent_event = {}
if not event_to_synchronize[base_event][0][1].OE.event_id:
- event_to_synchronize[base_event][0][1].OE.event_id = att_obj.search_read(cr, uid, [('google_internal_event_id', '=', event.GG.event['id'].split('_')[0])], ['event_id'], context=context_novirtual)[0].get('event_id')[0]
+ main_ev = att_obj.search_read(cr, uid, [('google_internal_event_id', '=', event.GG.event['id'].rsplit('_', 1)[0])], fields=['event_id'], context=context_novirtual)
+ event_to_synchronize[base_event][0][1].OE.event_id = main_ev[0].get('event_id')[0]
parent_event['id'] = "%s-%s" % (event_to_synchronize[base_event][0][1].OE.event_id, new_google_event_id)
res = self.update_from_google(cr, uid, parent_event, event.GG.event, "copy", context)
diff --git a/addons/hr/hr.py b/addons/hr/hr.py
index 85366adfe3b..f4719f572f0 100644
--- a/addons/hr/hr.py
+++ b/addons/hr/hr.py
@@ -225,7 +225,7 @@ class hr_employee(osv.osv):
"resized as a 128x128px image, with aspect ratio preserved. "\
"Use this field in form views or some kanban views."),
'image_small': fields.function(_get_image, fnct_inv=_set_image,
- string="Smal-sized photo", type="binary", multi="_get_image",
+ string="Small-sized photo", type="binary", multi="_get_image",
store = {
'hr.employee': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml
index 09e7373384e..0c356706407 100644
--- a/addons/hr/hr_view.xml
+++ b/addons/hr/hr_view.xml
@@ -40,7 +40,9 @@
<page string="Public Information">
<group>
<group string="Contact Information">
- <field name="address_id" on_change="onchange_address_id(address_id)" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
+ <field name="address_id" on_change="onchange_address_id(address_id)"
+ context="{'show_address': 1, 'default_customer': False}"
+ options='{"always_reload": True, "highlight_first_line": True}'/>
<field name="mobile_phone"/>
<field name="work_location"/>
</group>
@@ -68,7 +70,9 @@
<field name="otherid" groups="base.group_hr_user"/>
</group>
<group string="Contact Information">
- <field name="address_home_id" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
+ <field name="address_home_id"
+ context="{'show_address': 1, 'default_customer': False}"
+ options='{"always_reload": True, "highlight_first_line": True}'/>
</group>
<group string="Status">
<field name="gender"/>
diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py
index 3d467e0b065..ed25b75aa83 100644
--- a/addons/hr_holidays/hr_holidays.py
+++ b/addons/hr_holidays/hr_holidays.py
@@ -99,7 +99,7 @@ class hr_holidays_status(osv.osv):
for record in self.browse(cr, uid, ids, context=context):
name = record.name
if not record.limit:
- name = name + (' (%d/%d)' % (record.leaves_taken or 0.0, record.max_leaves or 0.0))
+ name = name + (' (%g/%g)' % (record.leaves_taken or 0.0, record.max_leaves or 0.0))
res.append((record.id, name))
return res
diff --git a/addons/l10n_be_invoice_bba/invoice.py b/addons/l10n_be_invoice_bba/invoice.py
index 854593a87cc..499e6e6c4ac 100644
--- a/addons/l10n_be_invoice_bba/invoice.py
+++ b/addons/l10n_be_invoice_bba/invoice.py
@@ -141,7 +141,7 @@ class account_invoice(osv.osv):
elif algorithm == 'random':
if not self.check_bbacomm(reference):
base = random.randint(1, 9999999999)
- bbacomm = str(base).rjust(7, '0')
+ bbacomm = str(base).rjust(10, '0')
base = int(bbacomm)
mod = base % 97 or 97
mod = str(mod).rjust(2, '0')
diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py
index ffc49414b2e..e4028111a73 100644
--- a/addons/mail/mail_followers.py
+++ b/addons/mail/mail_followers.py
@@ -176,7 +176,7 @@ class mail_notification(osv.Model):
references = message.parent_id.message_id if message.parent_id else False
# create email values
- max_recipients = 100
+ max_recipients = 50
chunks = [email_pids[x:x + max_recipients] for x in xrange(0, len(email_pids), max_recipients)]
email_ids = []
for chunk in chunks:
@@ -188,7 +188,7 @@ class mail_notification(osv.Model):
'references': references,
}
email_ids.append(self.pool.get('mail.mail').create(cr, uid, mail_values, context=context))
- if force_send and len(chunks) < 6: # for more than 500 followers, use the queue system
+ if force_send and len(chunks) < 2: # for more than 50 followers, use the queue system
self.pool.get('mail.mail').send(cr, uid, email_ids, context=context)
return True
diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py
index 4ae47a96774..186787c121a 100644
--- a/addons/mail/mail_group.py
+++ b/addons/mail/mail_group.py
@@ -211,3 +211,16 @@ class mail_group(osv.Model):
return []
else:
return super(mail_group, self).get_suggested_thread(cr, uid, removed_suggested_threads, context)
+
+ def message_get_email_values(self, cr, uid, id, notif_mail=None, context=None):
+ res = super(mail_group, self).message_get_email_values(cr, uid, id, notif_mail=notif_mail, context=context)
+ group = self.browse(cr, uid, id, context=context)
+ res.update({
+ 'headers': {
+ 'Precedence': 'list',
+ }
+ })
+ if group.alias_domain:
+ res['headers']['List-Id'] = '%s.%s' % (group.alias_name, group.alias_domain)
+ res['headers']['List-Post'] = '<mailto:%s@%s>' % (group.alias_name, group.alias_domain)
+ return res
diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py
index a4814140479..cc12bde2436 100644
--- a/addons/mail/mail_mail.py
+++ b/addons/mail/mail_mail.py
@@ -204,12 +204,15 @@ class mail_mail(osv.Model):
"""
body = self.send_get_mail_body(cr, uid, mail, partner=partner, context=context)
body_alternative = tools.html2plaintext(body)
- return {
+ res = {
'body': body,
'body_alternative': body_alternative,
'subject': self.send_get_mail_subject(cr, uid, mail, partner=partner, context=context),
'email_to': self.send_get_mail_to(cr, uid, mail, partner=partner, context=context),
}
+ if mail.model and mail.res_id and self.pool.get(mail.model) and hasattr(self.pool[mail.model], 'message_get_email_values'):
+ res.update(self.pool[mail.model].message_get_email_values(cr, uid, mail.res_id, mail, context=context))
+ return res
def send(self, cr, uid, ids, auto_commit=False, raise_exception=False, context=None):
""" Sends the selected emails immediately, ignoring their current
@@ -268,6 +271,9 @@ class mail_mail(osv.Model):
# build an RFC2822 email.message.Message object and send it without queuing
res = None
for email in email_list:
+ email_headers = dict(headers)
+ if email.get('headers'):
+ email_headers.update(email['headers'])
msg = ir_mail_server.build_email(
email_from=mail.email_from,
email_to=email.get('email_to'),
@@ -282,7 +288,7 @@ class mail_mail(osv.Model):
object_id=mail.res_id and ('%s-%s' % (mail.res_id, mail.model)),
subtype='html',
subtype_alternative='plain',
- headers=headers)
+ headers=email_headers)
res = ir_mail_server.send_email(cr, uid, msg,
mail_server_id=mail.mail_server_id.id,
context=context)
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index dc2b98fdc93..76d3ab744d5 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -34,6 +34,7 @@ import pytz
import socket
import time
import xmlrpclib
+import re
from email.message import Message
from urllib import urlencode
@@ -48,6 +49,8 @@ from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
+mail_header_msgid_re = re.compile('<[^<>]+>')
+
def decode_header(message, header, separator=' '):
return separator.join(map(decode, filter(None, message.get_all(header, []))))
@@ -694,6 +697,16 @@ class mail_thread(osv.AbstractModel):
if record.alias_domain and record.alias_name else False
for record in self.browse(cr, SUPERUSER_ID, ids, context=context)]
+ def message_get_email_values(self, cr, uid, id, notif_mail=None, context=None):
+ """ Temporary method to create custom notification email values for a given
+ model and document. This should be better to have a headers field on
+ the mail.mail model, computed when creating the notification email, but
+ this cannot be done in a stable version.
+
+ TDE FIXME: rethink this ulgy thing. """
+ res = dict()
+ return res
+
#------------------------------------------------------
# Mail gateway
#------------------------------------------------------
@@ -1301,13 +1314,13 @@ class mail_thread(osv.AbstractModel):
msg_dict['date'] = stored_date.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
if message.get('In-Reply-To'):
- parent_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', '=', decode(message['In-Reply-To']))])
+ parent_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', '=', decode(message['In-Reply-To'].strip()))])
if parent_ids:
msg_dict['parent_id'] = parent_ids[0]
if message.get('References') and 'parent_id' not in msg_dict:
- parent_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', 'in',
- [x.strip() for x in decode(message['References']).split()])])
+ msg_list = mail_header_msgid_re.findall(decode(message['References']))
+ parent_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', 'in', [x.strip() for x in msg_list])])
if parent_ids:
msg_dict['parent_id'] = parent_ids[0]
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index cb068d566c1..e14a8f3dfe5 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -267,10 +267,7 @@ class mail_compose_message(osv.TransientModel):
# mass mailing: rendering override wizard static values
if mass_mail_mode and wizard.model:
# always keep a copy, reset record name (avoid browsing records)
- mail_values.update(notification=True, record_name=False)
- if hasattr(self.pool[wizard.model], 'message_new'):
- mail_values['model'] = wizard.model
- mail_values['res_id'] = res_id
+ mail_values.update(notification=True, model=wizard.model, res_id=res_id, record_name=False)
# auto deletion of mail_mail
if 'mail_auto_delete' in context:
mail_values['auto_delete'] = context.get('mail_auto_delete')
diff --git a/addons/mass_mailing/models/mail_mail.py b/addons/mass_mailing/models/mail_mail.py
index a67f88a2a28..0e44399a256 100644
--- a/addons/mass_mailing/models/mail_mail.py
+++ b/addons/mass_mailing/models/mail_mail.py
@@ -84,7 +84,8 @@ class MailMail(osv.Model):
def send_get_email_dict(self, cr, uid, mail, partner=None, context=None):
res = super(MailMail, self).send_get_email_dict(cr, uid, mail, partner, context=context)
if mail.mailing_id and res.get('body') and res.get('email_to'):
- email_to = tools.email_split(res.get('email_to')[0])
+ emails = tools.email_split(res.get('email_to')[0])
+ email_to = emails and emails[0] or False
unsubscribe_url = self._get_unsubscribe_url(cr, uid, mail, email_to, context=context)
if unsubscribe_url:
res['body'] = tools.append_content_to_html(res['body'], unsubscribe_url, plaintext=False, container_tag='p')
diff --git a/addons/mass_mailing/views/mass_mailing.xml b/addons/mass_mailing/views/mass_mailing.xml
index 9806022498a..2939ebc3711 100644
--- a/addons/mass_mailing/views/mass_mailing.xml
+++ b/addons/mass_mailing/views/mass_mailing.xml
@@ -591,6 +591,7 @@
<field name="mail_mail_id"/>
<field name="message_id"/>
<field name="sent"/>
+ <field name="exception"/>
<field name="opened"/>
<field name="replied"/>
<field name="bounced"/>
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index f5b6cf466a5..ca4109c1b9a 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -1071,8 +1071,8 @@ class mrp_production(osv.osv):
return False
# Take routing location as a Source Location.
source_location_id = production.location_src_id.id
- if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
- source_location_id = production.bom_id.routing_id.location_id.id
+ if production.routing_id and production.routing_id.location_id:
+ source_location_id = production.routing_id.location_id.id
destination_location_id = production.product_id.property_stock_production.id
if not source_location_id:
diff --git a/addons/product/product.py b/addons/product/product.py
index eaed55c0b41..6fa0627db2c 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -678,6 +678,17 @@ class product_template(osv.osv):
if not context or "create_product_product" not in context:
self.create_variant_ids(cr, uid, [product_template_id], context=context)
self._set_standard_price(cr, uid, product_template_id, vals.get('standard_price', 0.0), context=context)
+
+ # TODO: this is needed to set given values to first variant after creation
+ # these fields should be moved to product as lead to confusion
+ related_vals = {}
+ if vals.get('ean13'):
+ related_vals['ean13'] = vals['ean13']
+ if vals.get('default_code'):
+ related_vals['default_code'] = vals['default_code']
+ if related_vals:
+ self.write(cr, uid, product_template_id, related_vals, context=context)
+
return product_template_id
def write(self, cr, uid, ids, vals, context=None):
diff --git a/addons/product_email_template/models/invoice.py b/addons/product_email_template/models/invoice.py
index d9e82e42012..d5876b510f1 100644
--- a/addons/product_email_template/models/invoice.py
+++ b/addons/product_email_template/models/invoice.py
@@ -27,7 +27,7 @@ class account_invoice(osv.Model):
template_values = Composer.onchange_template_id(
cr, uid, composer_id, line.product_id.email_template_id.id, 'comment', 'account.invoice', invoice.id
)['value']
- template_values['attachment_ids'] = [(4, id) for id in template_values.get('attachment_ids', '[]')]
+ template_values['attachment_ids'] = [(4, id) for id in template_values.get('attachment_ids', [])]
Composer.write(cr, uid, [composer_id], template_values, context=context)
Composer.send_mail(cr, uid, [composer_id], context=context)
return True
diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml
index 54f78ba8c8b..695aa80af2a 100644
--- a/addons/project/project_demo.xml
+++ b/addons/project/project_demo.xml
@@ -50,8 +50,8 @@
<field name="user_id" ref="base.user_demo"/>
<field name="alias_model">project.task</field>
<field name="message_follower_ids" eval="[(6, 0, [
- ref('base.user_root'),
- ref('base.user_demo')])]"/>
+ ref('base.partner_root'),
+ ref('base.partner_demo')])]"/>
</record>
<!-- We assign after so that default values applies -->
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index fc7a94fc51f..e2673b1ab1f 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -749,7 +749,7 @@
</tree>
</field>
-->
- <field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'view_move_picking_tree', 'default_picking_type_id': picking_type_id,'default_picking_id': active_id}"/>
+ <field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree', 'default_picking_type_id': picking_type_id,'default_picking_id': active_id}"/>
<field name="pack_operation_exist" invisible="1"/>
<field name="note" placeholder="Add an internal note..." class="oe_inline"/>
</page>
@@ -1288,7 +1288,7 @@
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
- <field name="domain" eval="['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.picking_type_id.code','=','outgoing')]"/>
+ <field name="domain" eval="[('picking_id.picking_type_id.code','=','incoming'), ('location_id.usage','!=','internal'), ('location_dest_id.usage', '=', 'internal')]"/>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context">{'product_receive': True, 'search_default_future': True}</field>
<field name="help" type="html">
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index b234e2738df..9988e7eae74 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -2373,7 +2373,7 @@
}
.openerp .oe_fileupload .oe_add button.oe_attach .oe_e {
position: relative;
- top: -1px;
+ top: -10px;
left: -9px;
}
.openerp .oe_fileupload .oe_add input.oe_form_binary_file {
@@ -3324,6 +3324,9 @@ body.oe_single_form .oe_single_form_container {
.openerp_ie ul.oe_form_status li.oe_active > .arrow span, .openerp_ie ul.oe_form_status_clickable li.oe_active > .arrow span {
background-color: #729fcf !important;
}
+}
+.openerp_ie .oe_webclient {
+ height: auto !important;
@media print {
.openerp {
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index 093ebf6cb0b..b85346a2c8f 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -1939,7 +1939,7 @@ $sheet-padding: 16px
text-shadow: none
.oe_e
position: relative
- top: -1px
+ top: -10px
left: -9px
input.oe_form_binary_file
display: inline-block
@@ -2691,6 +2691,8 @@ body.oe_single_form
> .arrow span
background-color: #729fcf !important
+ .oe_webclient
+ height: auto !important
// }}}
// @media print {{{
diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js
index 3c32dbe0426..f08dc31021a 100644
--- a/addons/web/static/src/js/formats.js
+++ b/addons/web/static/src/js/formats.js
@@ -233,7 +233,8 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
value = value.replace(instance.web._t.database.parameters.thousands_sep, "");
} while(tmp !== value);
tmp = Number(value);
- if (isNaN(tmp))
+ // do not accept not numbers or float values
+ if (isNaN(tmp) || tmp % 1)
throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value));
return tmp;
case 'float':
@@ -270,6 +271,11 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
value, (date_pattern + ' ' + time_pattern));
if (datetime !== null)
return instance.web.datetime_to_str(datetime);
+ datetime = Date.parseExact(value.replace(/\d+/g, function(m){
+ return m.length === 1 ? "0" + m : m ;
+ }), (date_pattern + ' ' + time_pattern));
+ if (datetime !== null)
+ return instance.web.datetime_to_str(datetime);
datetime = Date.parse(value);
if (datetime !== null)
return instance.web.datetime_to_str(datetime);
@@ -278,6 +284,11 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
var date = Date.parseExact(value, date_pattern);
if (date !== null)
return instance.web.date_to_str(date);
+ date = Date.parseExact(value.replace(/\d+/g, function(m){
+ return m.length === 1 ? "0" + m : m ;
+ }), date_pattern);
+ if (date !== null)
+ return instance.web.date_to_str(date);
date = Date.parse(value);
if (date !== null)
return instance.web.date_to_str(date);
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index 5653447566b..ac441d8eed6 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -346,11 +346,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
'keydown .oe_searchview_input, .oe_searchview_facet': function (e) {
switch(e.which) {
case $.ui.keyCode.LEFT:
- this.focusPreceding(this);
+ this.focusPreceding(e.target);
e.preventDefault();
break;
case $.ui.keyCode.RIGHT:
- this.focusFollowing(this);
+ this.focusFollowing(e.target);
e.preventDefault();
break;
}
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index e276a5e3995..cb0b2e8ea80 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2632,6 +2632,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({
type_of_date: "datetime",
events: {
'change .oe_datepicker_master': 'change_datetime',
+ 'keypress .oe_datepicker_master': 'change_datetime',
},
init: function(parent) {
this._super(parent);
@@ -2750,8 +2751,8 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({
format_client: function(v) {
return instance.web.format_value(v, {"widget": this.type_of_date});
},
- change_datetime: function() {
- if (this.is_valid_()) {
+ change_datetime: function(e) {
+ if ((e.type !== "keypress" || e.which === 13) && this.is_valid_()) {
this.set_value_from_ui_();
this.trigger("datetime_changed");
}
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index e2c63eb191a..ea2c28d9c3f 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -130,15 +130,7 @@
if (this.editable()) {
this.$el.find('table:first').show();
this.$el.find('.oe_view_nocontent').remove();
- this.start_edition().then(function(){
- var fields = self.editor.form.fields;
- self.editor.form.fields_order.some(function(field){
- if (fields[field].$el.is(':visible')){
- fields[field].$el.find("input").select();
- return true;
- }
- });
- });
+ this.start_edition();
} else {
this._super();
}
@@ -243,6 +235,7 @@
return this.ensure_saved().then(function () {
var $recordRow = self.groups.get_row_for(record);
var cells = self.get_cells_for($recordRow);
+ var fields = {};
self.fields_for_resize.splice(0, self.fields_for_resize.length);
return self.with_event('edit', {
record: record.attributes,
@@ -256,10 +249,16 @@
// FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow
field.$el.attr('data-fieldname', field_name);
+ fields[field_name] = field;
self.fields_for_resize.push({field: field, cell: cell});
}, options).then(function () {
$recordRow.addClass('oe_edition');
self.resize_fields();
+ var focus_field = options && options.focus_field ? options.focus_field : undefined;
+ if (!focus_field){
+ focus_field = _.find(self.editor.form.fields_order, function(field){ return fields[field] && fields[field].$el.is(':visible:has(input)'); });
+ }
+ if (focus_field) fields[focus_field].$el.find('input').select();
return record.attributes;
});
}).fail(function () {
@@ -749,31 +748,6 @@
throw new Error("is_editing's state filter must be either `new` or" +
" `edit` if provided");
},
- _focus_setup: function (focus_field) {
- var form = this.form;
-
- var field;
- // If a field to focus was specified
- if (focus_field
- // Is actually in the form
- && (field = form.fields[focus_field])
- // And is visible
- && field.$el.is(':visible')) {
- // focus it
- field.focus();
- return;
- }
-
- _(form.fields_order).detect(function (name) {
- // look for first visible field in fields_order, focus it
- var field = form.fields[name];
- if (!field.$el.is(':visible')) {
- return false;
- }
- // Stop as soon as a field got focused
- return field.focus() !== false;
- });
- },
edit: function (record, configureField, options) {
// TODO: specify sequence of edit calls
var self = this;
@@ -788,7 +762,6 @@
_(form.fields).each(function (field, name) {
configureField(name, field);
});
- self._focus_setup(options && options.focus_field);
return form;
});
},
diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js
index 23b11254b53..a7cff99f436 100644
--- a/addons/web_calendar/static/src/js/web_calendar.js
+++ b/addons/web_calendar/static/src/js/web_calendar.js
@@ -218,7 +218,12 @@ openerp.web_calendar = function(instance) {
this.info_fields.push(fv.arch.children[fld].attrs.name);
}
- return (new instance.web.Model(this.dataset.model))
+ var edit_check = new instance.web.Model(this.dataset.model)
+ .call("check_access_rights", ["write", false])
+ .then(function (write_right) {
+ self.write_right = write_right;
+ });
+ var init = new instance.web.Model(this.dataset.model)
.call("check_access_rights", ["create", false])
.then(function (create_right) {
self.create_right = create_right;
@@ -228,6 +233,7 @@ openerp.web_calendar = function(instance) {
self.ready.resolve();
});
});
+ return $.when(edit_check, init);
},
get_fc_init_options: function () {
@@ -841,7 +847,11 @@ openerp.web_calendar = function(instance) {
if (! this.open_popup_action) {
var index = this.dataset.get_id_index(id);
this.dataset.index = index;
- this.do_switch_view('form', null, { mode: "edit" });
+ if (this.write_right) {
+ this.do_switch_view('form', null, { mode: "edit" });
+ } else {
+ this.do_switch_view('form', null, { mode: "view" });
+ }
}
else {
var pop = new instance.web.form.FormOpenPopup(this);
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 601d3016068..8cd78377a90 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -469,7 +469,7 @@
}
);
});
- menu.on('click', 'a[data-action!=ace]', function (event) {
+ menu.on('click', 'a[data-view-id]', function (event) {
var view_id = $(event.currentTarget).data('view-id');
return openerp.jsonRpc('/web/dataset/call_kw', 'call', {
model: 'ir.ui.view',
@@ -1516,7 +1516,7 @@
url: this.link
});
this.media.renameNode("img");
- this.media.$.attributes.src = this.link;
+ $(this.media).attr('src', this.link);
return this._super();
},
clear: function () {
@@ -2000,6 +2000,11 @@
// a/@href, ...)
_(mutations).chain()
.filter(function (m) {
+ // ignore any SVG target, these blokes are like weird mon
+ if (m.target && m.target instanceof SVGElement) {
+ return false;
+ }
+
// ignore any change related to mundane image-edit-button
if (m.target && m.target.className
&& m.target.className.indexOf('image-edit-button') !== -1) {
diff --git a/addons/website/static/src/js/website.mobile.js b/addons/website/static/src/js/website.mobile.js
index 98d9bdc957a..1dbe8a1ece9 100644
--- a/addons/website/static/src/js/website.mobile.js
+++ b/addons/website/static/src/js/website.mobile.js
@@ -20,7 +20,7 @@
if (!window.location.origin) { // fix for ie9
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}
- document.getElementById("mobile-viewport").src = window.location.origin + window.location.pathname + "#mobile-preview";
+ document.getElementById("mobile-viewport").src = window.location.origin + window.location.pathname + window.location.search + "#mobile-preview";
this.$el.modal();
},
destroy: function () {
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py
index e13564a6a5e..aa4123d039a 100644
--- a/addons/website_forum/controllers/main.py
+++ b/addons/website_forum/controllers/main.py
@@ -120,7 +120,7 @@ class WebsiteForum(http.Controller):
question_count = Post.search(cr, uid, domain, count=True, context=context)
if tag:
- url = "/forum/%s/%s/questions" % (slug(forum), slug(tag))
+ url = "/forum/%s/tag/%s/questions" % (slug(forum), slug(tag))
else:
url = "/forum/%s" % slug(forum)
diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js
index 9d4e9e587c9..5db211ab9aa 100644
--- a/addons/website_forum/static/src/js/website_forum.js
+++ b/addons/website_forum/static/src/js/website_forum.js
@@ -148,7 +148,7 @@ function IsKarmaValid(eventNumber,minKarma){
CKEDITOR.tools.callFunction(eventNumber,this);
return false;
} else {
- alert("Sorry you need more than 30 Karma.");
+ alert("Sorry you need more than " + minKarma + " Karma.");
}
}
diff --git a/addons/website_mail/controllers/main.py b/addons/website_mail/controllers/main.py
index c0592000208..18bddd09a58 100644
--- a/addons/website_mail/controllers/main.py
+++ b/addons/website_mail/controllers/main.py
@@ -92,9 +92,8 @@ class WebsiteMail(http.Controller):
values['is_follower'] = len(
request.registry['mail.followers'].search(
cr, SUPERUSER_ID, [
- ('res_model', '=', 'mail.group'),
+ ('res_model', '=', model),
('res_id', '=', obj_ids[0]),
('partner_id', '=', partner_id.id)
], context=context)) == 1
-
return values
diff --git a/addons/website_mail/static/src/js/follow.js b/addons/website_mail/static/src/js/follow.js
new file mode 100644
index 00000000000..18c36378328
--- /dev/null
+++ b/addons/website_mail/static/src/js/follow.js
@@ -0,0 +1,68 @@
+(function () {
+ 'use strict';
+
+ var website = openerp.website;
+
+ website.snippet.animationRegistry.follow = website.snippet.Animation.extend({
+ selector: ".js_follow",
+ start: function (editable_mode) {
+ var self = this;
+ this.is_user = false;
+
+ openerp.jsonRpc('/website_mail/is_follower', 'call', {
+ model: this.$target.data('object'),
+ id: this.$target.data('id'),
+ }).always(function (data) {
+ self.is_user = data.is_user;
+ self.email = data.email;
+ self.toggle_subscription(data.is_follower, data.email);
+ self.$target.removeClass("hidden");
+ });
+
+ // not if editable mode to allow designer to edit alert field
+ if (!editable_mode) {
+ $('.js_follow > .alert').addClass("hidden");
+ $('.js_follow > .input-group-btn.hidden').removeClass("hidden");
+ this.$target.find('.js_follow_btn, .js_unfollow_btn').on('click', function (event) {
+ event.preventDefault();
+ self.on_click();
+ });
+ }
+ return;
+ },
+ on_click: function () {
+ var self = this;
+ var $email = this.$target.find(".js_follow_email");
+
+ if ($email.length && !$email.val().match(/.+@.+/)) {
+ this.$target.addClass('has-error');
+ return false;
+ }
+ this.$target.removeClass('has-error');
+
+ openerp.jsonRpc('/website_mail/follow', 'call', {
+ 'id': +this.$target.data('id'),
+ 'object': this.$target.data('object'),
+ 'message_is_follower': this.$target.attr("data-follow") || "off",
+ 'email': $email.length ? $email.val() : false,
+ }).then(function (follow) {
+ self.toggle_subscription(follow, self.email);
+ });
+ },
+ toggle_subscription: function(follow, email) {
+ console.log(follow, email);
+ if (follow) {
+ this.$target.find(".js_follow_btn").addClass("hidden");
+ this.$target.find(".js_unfollow_btn").removeClass("hidden");
+ }
+ else {
+ this.$target.find(".js_follow_btn").removeClass("hidden");
+ this.$target.find(".js_unfollow_btn").addClass("hidden");
+ }
+ 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');
+ },
+ });
+})();
diff --git a/addons/website_mail/views/website_mail.xml b/addons/website_mail/views/website_mail.xml
index 2b2bbea7e5f..0ccae00e21d 100644
--- a/addons/website_mail/views/website_mail.xml
+++ b/addons/website_mail/views/website_mail.xml
@@ -21,6 +21,7 @@
<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/follow.js"></script>
<link rel='stylesheet' href='/website_mail/static/src/css/website_mail.css'/>
</xpath>
</template>
diff --git a/addons/website_mail_group/__init__.py b/addons/website_mail_group/__init__.py
index ee5959455ad..9f86759e32b 100644
--- a/addons/website_mail_group/__init__.py
+++ b/addons/website_mail_group/__init__.py
@@ -1 +1,2 @@
import controllers
+import models
diff --git a/addons/website_mail_group/controllers/main.py b/addons/website_mail_group/controllers/main.py
index a28b808d9f2..59478b37fa3 100644
--- a/addons/website_mail_group/controllers/main.py
+++ b/addons/website_mail_group/controllers/main.py
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
import datetime
+from dateutil import relativedelta
-from openerp import tools
+from openerp import tools, SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.website.models.website import slug
from openerp.addons.web.http import request
@@ -28,12 +29,23 @@ class MailGroup(http.Controller):
def view(self, **post):
cr, uid, context = request.cr, request.uid, request.context
group_obj = request.registry.get('mail.group')
+ mail_message_obj = request.registry.get('mail.message')
group_ids = group_obj.search(cr, uid, [('alias_id', '!=', False), ('alias_id.alias_name', '!=', False)], context=context)
- values = {'groups': group_obj.browse(cr, uid, group_ids, context)}
+ groups = group_obj.browse(cr, uid, group_ids, context)
+ # compute statistics
+ month_date = datetime.datetime.today() - relativedelta.relativedelta(months=1)
+ group_data = dict.fromkeys(group_ids, dict())
+ for group in groups:
+ group_data[group.id]['monthly_message_nbr'] = mail_message_obj.search(
+ cr, SUPERUSER_ID,
+ [('model', '=', 'mail.group'), ('res_id', '=', group.id), ('date', '>=', month_date.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT))],
+ count=True, context=context)
+ values = {'groups': groups, 'group_data': group_data}
return request.website.render('website_mail_group.mail_groups', values)
@http.route(["/groups/subscription/"], type='json', auth="user")
def subscription(self, group_id=0, action=False, **post):
+ """ TDE FIXME: seems dead code """
cr, uid, context = request.cr, request.uid, request.context
group_obj = request.registry.get('mail.group')
if action:
diff --git a/addons/website_mail_group/models/__init__.py b/addons/website_mail_group/models/__init__.py
new file mode 100644
index 00000000000..ea8be51acde
--- /dev/null
+++ b/addons/website_mail_group/models/__init__.py
@@ -0,0 +1 @@
+import mail_group
diff --git a/addons/website_mail_group/models/mail_group.py b/addons/website_mail_group/models/mail_group.py
new file mode 100644
index 00000000000..804785b66f9
--- /dev/null
+++ b/addons/website_mail_group/models/mail_group.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+from openerp.osv import osv
+
+
+class MailGroup(osv.Model):
+ _inherit = 'mail.group'
+
+ def message_get_email_values(self, cr, uid, id, notif_mail=None, context=None):
+ res = super(MailGroup, self).message_get_email_values(cr, uid, id, notif_mail=notif_mail, context=context)
+ group = self.browse(cr, uid, id, context=context)
+ base_url = self.pool['ir.config_parameter'].get_param(cr, uid, 'web.base.url')
+ res['headers'].update({
+ 'List-Archive': '<%s/groups/%s>' % (base_url, group.id),
+ 'List-Subscribe': '<%s/groups>' % (base_url),
+ 'List-Unsubscribe': '<%s/groups>' % (base_url),
+ })
+ return res
diff --git a/addons/website_mail_group/static/src/js/website_mail_group.snippet.js b/addons/website_mail_group/static/src/js/website_mail_group.snippet.js
index fd6a2d38cfa..8ad4f9ba796 100644
--- a/addons/website_mail_group/static/src/js/website_mail_group.snippet.js
+++ b/addons/website_mail_group/static/src/js/website_mail_group.snippet.js
@@ -3,8 +3,8 @@
var website = openerp.website;
- website.snippet.animationRegistry.follow = website.snippet.Animation.extend({
- selector: ".js_follow",
+ website.snippet.animationRegistry.follow_alias = website.snippet.Animation.extend({
+ selector: ".js_follow_alias",
start: function (editable_mode) {
var self = this;
this.is_user = false;
@@ -23,8 +23,8 @@
// not if editable mode to allow designer to edit alert field
if (!editable_mode) {
- $('.js_follow > .alert').addClass("hidden");
- $('.js_follow > .input-group-btn.hidden').removeClass("hidden");
+ $('.js_follow_alias > .alert').addClass("hidden");
+ $('.js_follow_alias > .input-group-btn.hidden').removeClass("hidden");
this.$target.find('.js_follow_btn, .js_unfollow_btn').on('click', function (event) {
event.preventDefault();
self.on_click();
diff --git a/addons/website_mail_group/views/snippets.xml b/addons/website_mail_group/views/snippets.xml
index 452f59f4902..95935cd4998 100644
--- a/addons/website_mail_group/views/snippets.xml
+++ b/addons/website_mail_group/views/snippets.xml
@@ -11,7 +11,7 @@
<span class="oe_snippet_thumbnail_title">Discussion Group</span>
</div>
- <div class="oe_snippet_body js_follow"
+ <div class="oe_snippet_body js_follow_alias"
data-id="0"
data-object="mail.group"
data-follow="off">
@@ -38,7 +38,7 @@
<xpath expr="//div[@id='snippet_options']" position="inside">
<div data-snippet-option-id='subscribe'
- data-selector=".js_follow"
+ data-selector=".js_follow_alias"
data-selector-siblings="p, h1, h2, h3, blockquote, .well, .panel"
>
<li>
diff --git a/addons/website_mail_group/views/website_mail_group.xml b/addons/website_mail_group/views/website_mail_group.xml
index 8ecbd6c84ed..a1065027748 100644
--- a/addons/website_mail_group/views/website_mail_group.xml
+++ b/addons/website_mail_group/views/website_mail_group.xml
@@ -45,7 +45,7 @@
</div>
<div class="col-md-2">
<i class='fa fa-user'/> <t t-esc="len(group.message_follower_ids)"/> participants<br />
- <i class='fa fa-envelope-o'/> <t t-esc="len(group.message_ids)"/> messages
+ <i class='fa fa-envelope-o'/> <t t-raw="group_data[group.id]['monthly_message_nbr']"/> messages / month
</div>
<div class="col-md-3">
<t t-call="website_mail.follow"><t t-set="object" t-value="group"/></t>
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index 23225186dc8..a6bcd15f9e5 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -55,7 +55,7 @@ class table_compute(object):
self.table[(pos/PPR)+y2][(pos%PPR)+x2] = False
self.table[pos/PPR][pos%PPR] = {
'product': p, 'x':x, 'y': y,
- 'class': " ".join(map(lambda x: x.html_class, p.website_style_ids))
+ 'class': " ".join(map(lambda x: x.html_class or '', p.website_style_ids))
}
if index<=PPG:
maxy=max(maxy,y+(pos/PPR))
@@ -169,7 +169,7 @@ class website_sale(http.Controller):
values = {
'search': search,
- 'category': category and int(category),
+ 'category': category,
'attrib_values': attrib_values,
'attrib_set': attrib_set,
'pager': pager,
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index c43363b863e..fb5a83de1bd 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -240,7 +240,7 @@
<!-- Add to cart button-->
<template id="categories_recursive" name="Category list">
- <li t-att-class="'active' if c.id == category else ''">
+ <li t-att-class="'active' if c.id == int(category or 0) else ''">
<a t-att-href="keep('/shop/category/' + slug(c), category=0)" t-field="c.name"></a>
<ul t-if="c.child_id" class="nav nav-pills nav-stacked nav-hierarchy">
<t t-foreach="c.child_id" t-as="c">
diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py
index d6d96737ca3..3c84533e716 100644
--- a/openerp/addons/base/ir/ir_actions.py
+++ b/openerp/addons/base/ir/ir_actions.py
@@ -491,6 +491,8 @@ class ir_actions_server(osv.osv):
"based on the sequence. Low number means high priority."),
'model_id': fields.many2one('ir.model', 'Base Model', required=True, ondelete='cascade',
help="Base model on which the server action runs."),
+ 'model_name': fields.related('model_id', 'model', type='char',
+ string='Model Name', readonly=True),
'menu_ir_values_id': fields.many2one('ir.values', 'More Menu entry', readonly=True,
help='More menu entry.'),
# Client Action
@@ -650,6 +652,10 @@ class ir_actions_server(osv.osv):
'wkf_field_id': False,
'crud_model_id': model_id,
}
+
+ if model_id:
+ values['model_name'] = self.pool.get('ir.model').browse(cr, uid, model_id, context).model
+
return {'value': values}
def on_change_wkf_wonfig(self, cr, uid, ids, use_relational_model, wkf_field_id, wkf_model_id, model_id, context=None):
@@ -753,6 +759,7 @@ class ir_actions_server(osv.osv):
crud_model_name = False
if crud_model_id:
crud_model_name = self.pool.get('ir.model').browse(cr, uid, crud_model_id, context).model
+
values = {'link_field_id': False, 'crud_model_name': crud_model_name}
return {'value': values}
diff --git a/openerp/addons/base/ir/ir_actions.xml b/openerp/addons/base/ir/ir_actions.xml
index 6cb498e9ebf..2aa520d7c55 100644
--- a/openerp/addons/base/ir/ir_actions.xml
+++ b/openerp/addons/base/ir/ir_actions.xml
@@ -349,8 +349,9 @@
Check to attach the newly created record to the record on which the server action runs.
</p>
<group>
+ <field name="model_name" invisible="1"/>
<field name="link_field_id"
- domain="[('model_id', '=', model_id), ('relation', '=', crud_model_name), ('ttype', 'in', ['many2one'])]"
+ domain="[('model_id', '=', crud_model_id), ('relation', '=', model_name), ('ttype', 'in', ['many2one'])]"
attrs="{'required': [('state', '=', 'object_create'), ('link_new_record', '=', True)],
'invisible': ['|', ('state', '!=', 'object_create'), ('link_new_record', '=', False)]}"/>
</group>
diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py
index 57961a1d32c..0eae4185aeb 100644
--- a/openerp/osv/fields.py
+++ b/openerp/osv/fields.py
@@ -561,7 +561,7 @@ class many2one(_column):
# we use uid=1 because the visibility of a many2one field value (just id and name)
# must be the access right of the parent form and not the linked object itself.
records = dict(obj.name_get(cr, SUPERUSER_ID,
- list(set([x for x in res.values() if isinstance(x, (int,long))])),
+ list(set([x for x in res.values() if x and isinstance(x, (int,long))])),
context=context))
for id in res:
if res[id] in records:
diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py
index 0a23dda61e3..4289d6660f8 100644
--- a/openerp/osv/orm.py
+++ b/openerp/osv/orm.py
@@ -3348,6 +3348,8 @@ class BaseModel(object):
return []
if fields_to_read is None:
fields_to_read = self._columns.keys()
+ else:
+ fields_to_read = list(set(fields_to_read))
# all inherited fields + all non inherited fields for which the attribute whose name is in load is True
fields_pre = [f for f in fields_to_read if