Skip to content

Commit

Permalink
[MERGE] Forward-port 8.0 up to rev. 26d0fe6
Browse files Browse the repository at this point in the history
  • Loading branch information
odony committed Sep 30, 2015
2 parents 9a90120 + 26d0fe6 commit af4a60b
Show file tree
Hide file tree
Showing 28 changed files with 310 additions and 56 deletions.
6 changes: 3 additions & 3 deletions addons/account/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,9 @@ def prepare_move_lines_for_reconciliation_widget(self, cr, uid, lines, target_cu
ret_line['credit_currency'] = actual_credit
ret_line['debit_currency'] = actual_debit
if target_currency == company_currency:
actual_debit = debit
actual_credit = credit
total_amount = debit or credit
actual_debit = debit > 0 and amount or 0.0
actual_credit = credit > 0 and amount or 0.0
total_amount = abs(debit - credit)
else:
ctx = context.copy()
ctx.update({'date': line.date})
Expand Down
3 changes: 2 additions & 1 deletion addons/account_followup/account_followup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def _get_default_template(self, cr, uid, ids, context=None):


def _check_description(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids, context=context):
lang = self.pool['res.users'].browse(cr, uid, uid, context=context).lang
for line in self.browse(cr, uid, ids, context=dict(context or {}, lang=lang)):
if line.description:
try:
line.description % {'partner_name': '', 'date':'', 'user_signature': '', 'company_name': ''}
Expand Down
4 changes: 2 additions & 2 deletions addons/base_import_module/models/ir_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import openerp
from openerp.osv import osv
from openerp.tools import convert_file
from openerp.tools import convert_file, exception_to_unicode
from openerp.tools.translate import _
from openerp.exceptions import UserError

Expand Down Expand Up @@ -102,7 +102,7 @@ def import_zipfile(self, cr, uid, module_file, force=False, context=None):
self.import_module(cr, uid, mod_name, path, force=force, context=context)
success.append(mod_name)
except Exception, e:
errors[mod_name] = str(e)
errors[mod_name] = exception_to_unicode(e)
r = ["Successfully imported module '%s'" % mod for mod in success]
for mod, error in errors.items():
r.append("Error while importing module '%s': %r" % (mod, error))
Expand Down
3 changes: 3 additions & 0 deletions addons/crm/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

import test_new_lead_notification
33 changes: 33 additions & 0 deletions addons/crm/tests/test_new_lead_notification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-

from openerp.tests.common import TransactionCase


class NewLeadNotificationTest(TransactionCase):
def test_new_lead_notification(self):
# Create a new user
user = self.env["res.users"].create({
"name": __file__,
"login": __file__,
})

# Subscribe him to sales department
team = self.env.ref("sales_team.team_sales_department")
subtype = self.env.ref("crm.mt_salesteam_lead")
team.sudo(user).message_subscribe_users(subtype_ids=[subtype.id])

# Imitate what happens in the controller when somebody creates a new
# lead from the website form
lead = (self.env["crm.lead"]
.with_context(mail_create_nosubscribe=True)
.sudo()
.create({"contact_name": "Somebody",
"description": "Some question",
"email_from": "[email protected]",
"name": "Some subject",
"partner_name": "Some company",
"team_id": team.id,
"phone": "+0000000000"}))

# The user should have a new unread message
self.assertTrue(lead.sudo(user).message_unread)
6 changes: 3 additions & 3 deletions addons/gamification/static/src/xml/gamification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<t t-name="gamification.ChallengeSummary">
<div class="oe_goal">
<div>
<i class="oe_update_challenge fa fa-refresh" rol="button" t-attf-id="{challenge.id}"/>
<i class="oe_update_challenge fa fa-refresh" rol="button" t-att-id="challenge.id"/>
<h4><t t-esc="challenge.name" /></h4>
</div>

Expand Down Expand Up @@ -67,7 +67,7 @@
<div class="oe_goal_progress_background"></div>
<div class="oe_goal_progress" t-attf-style="#{line.display_mode == 'progress' ? 'width: '+goal.completeness+'%;' : 'width:0;'}"></div>
</t>

<div class="oe_cell col0"><t t-esc="goal.rank" /></div>
<div class="oe_cell col1"><img class="oe_user_avatar" t-attf-alt="#{goal.name}" t-attf-data-id="#{goal.user_id}"/></div>
<div class="oe_cell col2">
Expand Down Expand Up @@ -105,7 +105,7 @@
<h4>Invited Challenges</h4>
<ul t-foreach="challenges" t-as="challenge" class="oe_goals_list">
<li>
<strong><a class="oe_challenge_reply" t-attf-title="#{challenge.description.value ? challenge.description.value : ''}" t-attf-id="{challenge.id}" title="more details..."><t t-esc="challenge.name"/></a></strong>
<strong><a class="oe_challenge_reply" t-attf-title="#{challenge.description.value ? challenge.description.value : ''}" t-att-id="challenge.id" title="more details..."><t t-esc="challenge.name"/></a></strong>
</li>
</ul>
</div>
Expand Down
8 changes: 8 additions & 0 deletions addons/mail/mail_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from email.utils import formataddr
from urlparse import urljoin

import psycopg2

from openerp import api, tools
from openerp import SUPERUSER_ID
from openerp.addons.base.ir.ir_mail_server import MailDeliveryException
Expand Down Expand Up @@ -335,6 +337,12 @@ def send(self, cr, uid, ids, auto_commit=False, raise_exception=False, context=N
'Consider raising the --limit-memory-hard startup option',
mail.id, mail.message_id)
raise
except psycopg2.Error:
# If an error with the database occurs, chances are that the cursor is unusable.
# This will lead to an `psycopg2.InternalError` being raised when trying to write
# `state`, shadowing the original exception and forbid a retry on concurrent
# update. Let's bubble it.
raise
except Exception as e:
failure_reason = tools.ustr(e)
_logger.exception('failed sending mail (id: %s) due to %s', mail.id, failure_reason)
Expand Down
14 changes: 7 additions & 7 deletions addons/mail/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,13 @@ def create(self, cr, uid, values, context=None):
name = ir_model_pool.read(cr, uid, ids, ['name'], context=context)[0]['name']
self.message_post(cr, uid, thread_id, body=_('%s created') % name, context=context)

# auto_subscribe: take values and defaults into account
create_values = dict(values)
for key, val in context.iteritems():
if key.startswith('default_') and key[8:] not in create_values:
create_values[key[8:]] = val
self.message_auto_subscribe(cr, uid, [thread_id], create_values.keys(), context=context, values=create_values)

# track values
track_ctx = dict(context)
if 'lang' not in track_ctx:
Expand All @@ -398,13 +405,6 @@ def create(self, cr, uid, values, context=None):
initial_values = {thread_id: dict.fromkeys(tracked_fields, False)}
self.message_track(cr, uid, [thread_id], tracked_fields, initial_values, context=track_ctx)

# auto_subscribe: take values and defaults into account
create_values = dict(values)
for key, val in context.iteritems():
if key.startswith('default_') and key[8:] not in create_values:
create_values[key[8:]] = val
self.message_auto_subscribe(cr, uid, [thread_id], create_values.keys(), context=context, values=create_values)

return thread_id

def write(self, cr, uid, ids, values, context=None):
Expand Down
9 changes: 6 additions & 3 deletions addons/mrp/wizard/mrp_product_produce.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ def _get_product_id(self, cr, uid, context=None):
return prod and prod.product_id.id or False

def _get_track(self, cr, uid, context=None):
prod = self._get_product_id(cr, uid, context=context)
prod_obj = self.pool.get("product.product")
return prod and prod_obj.browse(cr, uid, prod, context=context).track_production or False
product_id = self._get_product_id(cr, uid, context=context)
if not product_id:
return False
product = self.pool.get("product.product").browse(
cr, uid, product_id, context=context)
return product.track_all or product.track_production or False

_defaults = {
'product_qty': _get_product_qty,
Expand Down
2 changes: 1 addition & 1 deletion addons/payment/models/payment_acquirer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _get_providers(self, cr, uid, context=None):
_provider_selection = lambda self, *args, **kwargs: self._get_providers(*args, **kwargs)

_columns = {
'name': fields.char('Name', required=True),
'name': fields.char('Name', required=True, translate=True),
'provider': fields.selection(_provider_selection, string='Provider', required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'pre_msg': fields.html('Message', translate=True,
Expand Down
21 changes: 12 additions & 9 deletions addons/product/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,21 @@ def _factor_inv_write(self, cursor, user, id, name, value, arg, context=None):
def name_create(self, cr, uid, name, context=None):
""" The UoM category and factor are required, so we'll have to add temporary values
for imported UoMs """
if not context:
context = {}
uom_categ = self.pool.get('product.uom.categ')
values = {self._rec_name: name, 'factor': 1}
# look for the category based on the english name, i.e. no context on purpose!
# TODO: should find a way to have it translated but not created until actually used
categ_misc = 'Unsorted/Imported Units'
categ_id = uom_categ.search(cr, uid, [('name', '=', categ_misc)])
if categ_id:
categ_id = categ_id[0]
else:
categ_id, _ = uom_categ.name_create(cr, uid, categ_misc)
uom_id = self.create(cr, uid, {self._rec_name: name,
'category_id': categ_id,
'factor': 1})
if not context.get('default_category_id'):
categ_misc = 'Unsorted/Imported Units'
categ_id = uom_categ.search(cr, uid, [('name', '=', categ_misc)])
if categ_id:
values['category_id'] = categ_id[0]
else:
values['category_id'] = uom_categ.name_create(
cr, uid, categ_misc, context=context)[0]
uom_id = self.create(cr, uid, values, context=context)
return self.name_get(cr, uid, [uom_id], context=context)[0]

def create(self, cr, uid, data, context=None):
Expand Down
7 changes: 7 additions & 0 deletions addons/project/security/project_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,12 @@
<field name="groups" eval="[(4,ref('project.group_project_manager'))]"/>
</record>

<record model="ir.rule" id="report_project_task_user_report_comp_rule">
<field name="name">Task Analysis multi-company</field>
<field name="model_id" ref="model_report_project_task_user"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

</data>
</openerp>
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@
<record id="trans_confirmed_double_gt" model="workflow.transition">
<field name="act_from" ref="act_double_check"/>
<field name="act_to" ref="act_double_wait"/>
<field name="condition">amount_untaxed &gt;= 5000</field>
<field name="signal">purchase_approve</field>
<field name="group_id" ref="purchase.group_purchase_manager"/>
</record>

<record id="trans_confirmed_double_lt" model="workflow.transition">
<field name="act_from" ref="act_double_check"/>
<field name="act_to" ref="act_double_wait"/>
<field name="condition">amount_untaxed &lt; 5000</field>
</record>

<record id="trans_double_app_conf" model="workflow.transition">
Expand All @@ -40,4 +38,12 @@
</record>

</data>
<data noupdate="1">
<record id="trans_confirmed_double_gt" model="workflow.transition">
<field name="condition">amount_untaxed &gt;= 5000</field>
</record>
<record id="trans_confirmed_double_lt" model="workflow.transition">
<field name="condition">amount_untaxed &lt; 5000</field>
</record>
</data>
</openerp>
3 changes: 2 additions & 1 deletion addons/report_webkit/webkit_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import openerp
from openerp.modules.module import get_module_resource
from openerp.report.report_sxw import *
from openerp import SUPERUSER_ID
from openerp import tools
from openerp.tools.translate import _
from urllib import urlencode, quote as quote
Expand Down Expand Up @@ -127,7 +128,7 @@ def __init__(self, name, table, rml=False, parser=rml_parse,
def get_lib(self, cursor, uid):
"""Return the lib wkhtml path"""
proxy = self.pool['ir.config_parameter']
webkit_path = proxy.get_param(cursor, uid, 'webkit_path')
webkit_path = proxy.get_param(cursor, SUPERUSER_ID, 'webkit_path')

if not webkit_path:
try:
Expand Down
2 changes: 1 addition & 1 deletion addons/sale/report/sale_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _select(self):
l.product_id as product_id,
t.uom_id as product_uom,
sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
sum(l.product_uom_qty * cr.rate * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
sum(l.product_uom_qty * l.price_unit / cr.rate * (100.0-l.discount) / 100.0) as price_total,
count(*) as nbr,
s.date_order as date,
s.date_confirm as date_confirm,
Expand Down
2 changes: 1 addition & 1 deletion addons/sale/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
else:
price = Product.price_get(cr, uid, [product], ptype='list_price', context=ctx_product)[product] or False
if update_tax:
price = self.pool['account.tax']._fix_tax_included_price(cr, uid, price, product_obj.taxes_id, result['tax_id'])
price = self.pool['account.tax']._fix_tax_included_price(cr, uid, price, taxes, result['tax_id'])
if context.get('uom_qty_change', False):
product_uos_qty = result.get('product_uos_qty')
result, domain = {}, {}
Expand Down
4 changes: 4 additions & 0 deletions addons/website_quote/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ def _onchange_product_id(self):
if product.description_sale:
self.name += '\n' + product.description_sale
self.uom_id = product.product_tmpl_id.uom_id
if product and self.order_id.pricelist_id:
partner_id = self.order_id.partner_id.id
pricelist = self.order_id.pricelist_id.id
self.price_unit = self.order_id.pricelist_id.price_get(product.id, self.quantity, partner_id)[pricelist]


class product_template(osv.Model):
Expand Down
9 changes: 6 additions & 3 deletions addons/website_sale/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,16 @@ def payment_transaction(self, acquirer_id):
# find an already existing transaction
tx = request.website.sale_get_transaction()
if tx:
if tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ?
tx_id = tx.id
if tx.reference != order.name:
tx = False
tx_id = False
elif tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ?
tx.write({
'acquirer_id': acquirer_id,
'amount': order.amount_total,
})
tx_id = tx.id
else:
if not tx:
tx_id = transaction_obj.create(cr, SUPERUSER_ID, {
'acquirer_id': acquirer_id,
'type': 'form',
Expand Down
15 changes: 15 additions & 0 deletions doc/cla/corporate/grupoesoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Spain, 2015-05-07

Grupo ESOC agrees to the terms of the Odoo Corporate Contributor License
Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this
declaration.

Signed,

Nuria Pastor <[email protected]> https://github.com/grupoesoc/

List of contributors:

Jairo Llopis <[email protected]> https://github.com/Yajo
11 changes: 11 additions & 0 deletions doc/cla/individual/Yajo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Spain, september 24th 2015

I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this
declaration.

Signed,

Jairo Llopis [email protected] https://github.com/Yajo
11 changes: 11 additions & 0 deletions doc/cla/individual/cedk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Belgium, 2015-09-09

I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this
declaration.

Signed,

Cédric Krier [email protected] https://github.com/cedk
Loading

0 comments on commit af4a60b

Please sign in to comment.