summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2014-07-05 01:04:19 +0200
committerOlivier Dony <odo@openerp.com>2014-07-05 01:04:19 +0200
commit5ceded9d69b3c261e501500e760b9b345bb77ecc (patch)
treede463b8dcfacc82c559381c91ad57f978a48e724 /addons
parente19256b062105a8656f0f776b5f9a8bda232cab9 (diff)
parent4fa30f556929fb5c11d835f5ef0af68cd8acb6d8 (diff)
[MERGE] Forward-port saas-3 up to 4fa30f5
Diffstat (limited to 'addons')
-rw-r--r--addons/auth_oauth/controllers/main.py3
-rw-r--r--addons/document/document.py12
-rw-r--r--addons/hr_holidays/hr_holidays.py4
-rw-r--r--addons/l10n_multilang/__openerp__.py2
-rw-r--r--addons/mail/static/src/css/mail.css8
-rw-r--r--addons/mail/static/src/xml/mail.xml2
-rw-r--r--addons/mass_mailing/models/mass_mailing.py96
-rw-r--r--addons/project_issue_sheet/project_issue_sheet_view.xml1
-rw-r--r--addons/stock/stock.py16
-rw-r--r--addons/web_linkedin/web_linkedin.py2
-rw-r--r--addons/website/views/website_templates.xml2
-rw-r--r--addons/website_crm/controllers/main.py2
12 files changed, 77 insertions, 73 deletions
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py
index e4d3e18792a..6cf655fa2ca 100644
--- a/addons/auth_oauth/controllers/main.py
+++ b/addons/auth_oauth/controllers/main.py
@@ -48,7 +48,8 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home):
def list_providers(self):
try:
provider_obj = request.registry.get('auth.oauth.provider')
- providers = provider_obj.search_read(request.cr, SUPERUSER_ID, [('enabled', '=', True)])
+ providers = provider_obj.search_read(request.cr, SUPERUSER_ID, [('enabled', '=', True), ('auth_endpoint', '!=', False), ('validation_endpoint', '!=', False)])
+ # TODO in forwardport: remove conditions on 'auth_endpoint' and 'validation_endpoint' when these fields will be 'required' in model
except Exception:
providers = []
for provider in providers:
diff --git a/addons/document/document.py b/addons/document/document.py
index 9008f32cd20..47c30de7ca6 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -235,18 +235,8 @@ class document_directory(osv.osv):
_parent(dir_id, path)
return path
- def _check_recursion(self, cr, uid, ids, context=None):
- level = 100
- while len(ids):
- cr.execute('select distinct parent_id from document_directory where id in ('+','.join(map(str,ids))+')')
- ids = filter(None, map(lambda x:x[0], cr.fetchall()))
- if not level:
- return False
- level -= 1
- return True
-
_constraints = [
- (_check_recursion, 'Error! You cannot create recursive directories.', ['parent_id'])
+ (osv.osv._check_recursion, 'Error! You cannot create recursive directories.', ['parent_id'])
]
def onchange_content_id(self, cr, uid, ids, ressource_type_id):
diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py
index 277b2d727e1..b548f15f7df 100644
--- a/addons/hr_holidays/hr_holidays.py
+++ b/addons/hr_holidays/hr_holidays.py
@@ -522,8 +522,8 @@ class hr_employee(osv.osv):
where
h.state='validate' and
s.limit=False and
- h.employee_id in (%s)
- group by h.employee_id"""% (','.join(map(str,ids)),) )
+ h.employee_id in %s
+ group by h.employee_id""", (tuple(ids),))
res = cr.dictfetchall()
remaining = {}
for r in res:
diff --git a/addons/l10n_multilang/__openerp__.py b/addons/l10n_multilang/__openerp__.py
index 5c91e1472c4..0b804c27263 100644
--- a/addons/l10n_multilang/__openerp__.py
+++ b/addons/l10n_multilang/__openerp__.py
@@ -32,7 +32,7 @@
templates to target objects.
""",
'website': 'http://www.openerp.com',
- 'depends' : ['account_accountant'],
+ 'depends' : ['account'],
'data': [],
'demo': [],
'installable': True,
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css
index 0abd8ab1b4e..0faf7fc5e0d 100644
--- a/addons/mail/static/src/css/mail.css
+++ b/addons/mail/static/src/css/mail.css
@@ -164,15 +164,9 @@
border-radius: 3px;
margin: 0px;
padding-left: 3px;
- padding-right: 15px;
+ padding-right: 5px;
margin-right: 5px;
}
-.openerp .oe_mail .oe_mail_vote_count .oe_e{
- position: absolute;
- bottom: 1px;
- right: 2px;
- font-size: 26px;
-}
/* c) Message action icons */
diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml
index 2a4ac8d1bf9..5d3175b40d7 100644
--- a/addons/mail/static/src/xml/mail.xml
+++ b/addons/mail/static/src/xml/mail.xml
@@ -355,7 +355,7 @@
<span t-name="mail.thread.message.vote">
<span class="oe_mail_vote_count" t-if='widget.vote_nb > 0'>
<t t-esc='widget.vote_nb' />
- <span class='oe_e'>8</span>
+ <i class="fa fa-thumbs-o-up"></i>
</span>
<a href='#' class="oe_msg_vote">
<t t-if="!widget.has_voted">like</t>
diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py
index bfeb3aeeafe..eafab5272bd 100644
--- a/addons/mass_mailing/models/mass_mailing.py
+++ b/addons/mass_mailing/models/mass_mailing.py
@@ -113,26 +113,38 @@ class MassMailingCampaign(osv.Model):
def _get_statistics(self, cr, uid, ids, name, arg, context=None):
""" Compute statistics of the mass mailing campaign """
- Statistics = self.pool['mail.mail.statistics']
- results = dict.fromkeys(ids, False)
- for cid in ids:
- stat_ids = Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid)], context=context)
- stats = Statistics.browse(cr, uid, stat_ids, context=context)
- results[cid] = {
- 'total': len(stats),
- 'failed': len([s for s in stats if not s.scheduled is False and s.sent is False and not s.exception is False]),
- 'scheduled': len([s for s in stats if not s.scheduled is False and s.sent is False and s.exception is False]),
- 'sent': len([s for s in stats if not s.sent is False]),
- 'opened': len([s for s in stats if not s.opened is False]),
- 'replied': len([s for s in stats if not s.replied is False]),
- 'bounced': len([s for s in stats if not s.bounced is False]),
- }
- results[cid]['delivered'] = results[cid]['sent'] - results[cid]['bounced']
- results[cid]['received_ratio'] = 100.0 * results[cid]['delivered'] / (results[cid]['total'] or 1)
- results[cid]['opened_ratio'] = 100.0 * results[cid]['opened'] / (results[cid]['total'] or 1)
- results[cid]['replied_ratio'] = 100.0 * results[cid]['replied'] / (results[cid]['total'] or 1)
+ results = {}
+ cr.execute("""
+ SELECT
+ c.id as campaign_id,
+ COUNT(s.id) AS total,
+ COUNT(CASE WHEN s.sent is not null THEN 1 ELSE null END) AS sent,
+ COUNT(CASE WHEN s.scheduled is not null AND s.sent is null AND s.exception is null THEN 1 ELSE null END) AS scheduled,
+ COUNT(CASE WHEN s.scheduled is not null AND s.sent is null AND s.exception is not null THEN 1 ELSE null END) AS failed,
+ COUNT(CASE WHEN s.id is not null AND s.bounced is null THEN 1 ELSE null END) AS delivered,
+ COUNT(CASE WHEN s.opened is not null THEN 1 ELSE null END) AS opened,
+ COUNT(CASE WHEN s.replied is not null THEN 1 ELSE null END) AS replied ,
+ COUNT(CASE WHEN s.bounced is not null THEN 1 ELSE null END) AS bounced
+ FROM
+ mail_mail_statistics s
+ RIGHT JOIN
+ mail_mass_mailing_campaign c
+ ON (c.id = s.mass_mailing_campaign_id)
+ WHERE
+ c.id IN %s
+ GROUP BY
+ c.id
+ """, (tuple(ids), ))
+ for row in cr.dictfetchall():
+ results[row.pop('campaign_id')] = row
+ total = row['total'] or 1
+ row['delivered'] = row['sent'] - row['bounced']
+ row['received_ratio'] = 100.0 * row['delivered'] / total
+ row['opened_ratio'] = 100.0 * row['opened'] / total
+ row['replied_ratio'] = 100.0 * row['replied'] / total
return results
+
_columns = {
'name': fields.char('Name', required=True),
'stage_id': fields.many2one('mail.mass_mailing.stage', 'Stage', required=True),
@@ -283,26 +295,38 @@ class MassMailing(osv.Model):
def _get_statistics(self, cr, uid, ids, name, arg, context=None):
""" Compute statistics of the mass mailing campaign """
- Statistics = self.pool['mail.mail.statistics']
- results = dict.fromkeys(ids, False)
- for mid in ids:
- stat_ids = Statistics.search(cr, uid, [('mass_mailing_id', '=', mid)], context=context)
- stats = Statistics.browse(cr, uid, stat_ids, context=context)
- results[mid] = {
- 'total': len(stats),
- 'failed': len([s for s in stats if not s.scheduled is False and s.sent is False and not s.exception is False]),
- 'scheduled': len([s for s in stats if not s.scheduled is False and s.sent is False and s.exception is False]),
- 'sent': len([s for s in stats if not s.sent is False]),
- 'opened': len([s for s in stats if not s.opened is False]),
- 'replied': len([s for s in stats if not s.replied is False]),
- 'bounced': len([s for s in stats if not s.bounced is False]),
- }
- results[mid]['delivered'] = results[mid]['sent'] - results[mid]['bounced']
- results[mid]['received_ratio'] = 100.0 * results[mid]['delivered'] / (results[mid]['total'] or 1)
- results[mid]['opened_ratio'] = 100.0 * results[mid]['opened'] / (results[mid]['total'] or 1)
- results[mid]['replied_ratio'] = 100.0 * results[mid]['replied'] / (results[mid]['total'] or 1)
+ results = {}
+ cr.execute("""
+ SELECT
+ m.id as mailing_id,
+ COUNT(s.id) AS total,
+ COUNT(CASE WHEN s.sent is not null THEN 1 ELSE null END) AS sent,
+ COUNT(CASE WHEN s.scheduled is not null AND s.sent is null AND s.exception is null THEN 1 ELSE null END) AS scheduled,
+ COUNT(CASE WHEN s.scheduled is not null AND s.sent is null AND s.exception is not null THEN 1 ELSE null END) AS failed,
+ COUNT(CASE WHEN s.id is not null AND s.bounced is null THEN 1 ELSE null END) AS delivered,
+ COUNT(CASE WHEN s.opened is not null THEN 1 ELSE null END) AS opened,
+ COUNT(CASE WHEN s.replied is not null THEN 1 ELSE null END) AS replied ,
+ COUNT(CASE WHEN s.bounced is not null THEN 1 ELSE null END) AS bounced
+ FROM
+ mail_mail_statistics s
+ RIGHT JOIN
+ mail_mass_mailing m
+ ON (m.id = s.mass_mailing_id)
+ WHERE
+ m.id IN %s
+ GROUP BY
+ m.id
+ """, (tuple(ids), ))
+ for row in cr.dictfetchall():
+ results[row.pop('mailing_id')] = row
+ total = row['total'] or 1
+ row['delivered'] = row['sent'] - row['bounced']
+ row['received_ratio'] = 100.0 * row['delivered'] / total
+ row['opened_ratio'] = 100.0 * row['opened'] / total
+ row['replied_ratio'] = 100.0 * row['replied'] / total
return results
+
def _get_mailing_model(self, cr, uid, context=None):
res = []
for model_name in self.pool:
diff --git a/addons/project_issue_sheet/project_issue_sheet_view.xml b/addons/project_issue_sheet/project_issue_sheet_view.xml
index 6d813b44239..39ff9ca0010 100644
--- a/addons/project_issue_sheet/project_issue_sheet_view.xml
+++ b/addons/project_issue_sheet/project_issue_sheet_view.xml
@@ -32,6 +32,7 @@
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
<field invisible="1" name="amount"/>
<field invisible="1" name="general_account_id"/>
+ <field invisible="1" name="to_invoice"/>
</tree>
</field>
</page>
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 384bb3d362e..34a24354508 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1892,7 +1892,6 @@ class stock_move(osv.osv):
result = {
'product_qty': 0.00
}
- warning = {}
if (not product_id) or (product_uos_qty <=0.0):
result['product_uos_qty'] = 0.0
@@ -1900,22 +1899,15 @@ class stock_move(osv.osv):
product_obj = self.pool.get('product.product')
uos_coeff = product_obj.read(cr, uid, product_id, ['uos_coeff'])
-
- # Warn if the quantity was decreased
- for move in self.read(cr, uid, ids, ['product_uos_qty']):
- if product_uos_qty < move['product_uos_qty']:
- warning.update({
- 'title': _('Warning: No Back Order'),
- 'message': _("By changing the quantity here, you accept the "
- "new quantity as complete: OpenERP will not "
- "automatically generate a Back Order.") })
- break
+
+ # No warning if the quantity was decreased to avoid double warnings:
+ # The clients should call onchange_quantity too anyway
if product_uos and product_uom and (product_uom != product_uos):
result['product_qty'] = product_uos_qty / uos_coeff['uos_coeff']
else:
result['product_qty'] = product_uos_qty
- return {'value': result, 'warning': warning}
+ return {'value': result}
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
loc_dest_id=False, partner_id=False):
diff --git a/addons/web_linkedin/web_linkedin.py b/addons/web_linkedin/web_linkedin.py
index 83132511a17..a0919f7968e 100644
--- a/addons/web_linkedin/web_linkedin.py
+++ b/addons/web_linkedin/web_linkedin.py
@@ -34,7 +34,7 @@ class Binary(openerp.http.Controller):
_scheme, _netloc, path, params, query, fragment = urlparse(url)
# media.linkedin.com is the master domain for LinkedIn media (replicated to CDNs),
# so forcing it should always work and prevents abusing this method to load arbitrary URLs
- url = urlunparse(('http', 'media.linkedin.com', path, params, query, fragment))
+ url = urlunparse(('http', 'media.licdn.com', path, params, query, fragment))
bfile = urllib2.urlopen(url)
return base64.b64encode(bfile.read())
diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml
index 67255e0cc29..bb4185cef0b 100644
--- a/addons/website/views/website_templates.xml
+++ b/addons/website/views/website_templates.xml
@@ -413,7 +413,7 @@
<table class="table js_kanban">
<thead>
<tr>
- <t t-set="width" t-value="str(round(100.0 / len(objects), 2)) + '%'"/>
+ <t t-set="width" t-value="str(round(100.0 / (len(objects) if objects else 1), 2)) + '%'"/>
<t t-foreach="objects">
<th t-att-width="width">
<div t-field="column_id.name" class="text-center"></div>
diff --git a/addons/website_crm/controllers/main.py b/addons/website_crm/controllers/main.py
index 043abcf5898..2331225919c 100644
--- a/addons/website_crm/controllers/main.py
+++ b/addons/website_crm/controllers/main.py
@@ -52,6 +52,8 @@ class contactus(http.Controller):
elif field_name not in _TECHNICAL: # allow to add some free fields or blacklisted field like ID
post_description.append("%s: %s" % (field_name, field_value))
+ if "name" not in kwargs and values.get("contact_name"): # if kwarg.name is empty, it's an error, we cannot copy the contact_name
+ values["name"] = values.get("contact_name")
# fields validation : Check that required field from model crm_lead exists
error = set(field for field in _REQUIRED if not kwargs.get(field))