From dc1b8a5a51dfabcdefcb5cbb8b7d5d141bb00e53 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 25 Apr 2016 12:33:19 +0200 Subject: [PATCH 1/5] [FIX] res_company: some information missed on company creation On the `res.company` model, the fields `name`, `phone`, `email`, `website`, `vat` are related field on the `partner_id` of the company. When creating a new company, the partner associated to the company is created automatically, it's handled in the overrided `create` method of the model, but it forgots the values `phone`, `email`, `website`, `vat` at the moment the partner is being created. opw-675526 --- openerp/addons/base/res/res_company.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_company.py b/openerp/addons/base/res/res_company.py index 3b8464e20b6..71995487cf1 100644 --- a/openerp/addons/base/res/res_company.py +++ b/openerp/addons/base/res/res_company.py @@ -276,7 +276,16 @@ class res_company(osv.osv): self.cache_restart(cr) return super(res_company, self).create(cr, uid, vals, context=context) obj_partner = self.pool.get('res.partner') - partner_id = obj_partner.create(cr, uid, {'name': vals['name'], 'is_company':True, 'image': vals.get('logo', False), 'customer': False}, context=context) + partner_id = obj_partner.create(cr, uid, { + 'name': vals['name'], + 'is_company': True, + 'image': vals.get('logo', False), + 'customer': False, + 'email': vals.get('email'), + 'phone': vals.get('phone'), + 'website': vals.get('website'), + 'vat': vals.get('vat'), + }, context=context) vals.update({'partner_id': partner_id}) self.cache_restart(cr) company_id = super(res_company, self).create(cr, uid, vals, context=context) From 61c808b77425c35f9e6f9774ee88ae7e8a2c995d Mon Sep 17 00:00:00 2001 From: Ludwik Trammer Date: Mon, 25 Apr 2016 14:54:18 +0200 Subject: [PATCH 2/5] [FIX] web: Allow for translation of a login error message Closes #11815 --- addons/web/controllers/main.py | 2 +- addons/web/i18n/web.pot | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 7413159c9a3..038a317224b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -510,7 +510,7 @@ class Home(http.Controller): if uid is not False: return http.redirect_with_hash(redirect) request.uid = old_uid - values['error'] = "Wrong login/password" + values['error'] = _("Wrong login/password") if request.env.ref('web.login', False): return request.render('web.login', values) else: diff --git a/addons/web/i18n/web.pot b/addons/web/i18n/web.pot index f4855962d9a..6522ed569ce 100644 --- a/addons/web/i18n/web.pot +++ b/addons/web/i18n/web.pot @@ -2661,6 +2661,12 @@ msgstr "" msgid "Wk" msgstr "" +#. module: web +#: code:addons/web/controllers/main.py:513 +#, python-format +msgid "Wrong login/password" +msgstr "" + #. module: web #. openerp-web #: code:addons/web/static/src/xml/base.xml:565 From f5eae92f12a86d0c63a7e9b30d9afe9f852c7bda Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 26 Apr 2016 10:14:56 +0200 Subject: [PATCH 3/5] [FIX] website_sale: log if no pricelist The pricelist field is not a mandatory field on the partner. A default value is usually defined for any new partner created. However, if the pricelist is manually removed from the partner, errors (tracebacks) will occur in the eCommerce when no pricelist is found. We cannot make the field mandatory, as it could potentially break the workflow of some users which are not using eCommerce. Therefore, we simply log an error message to help debugging. opw-673453 --- addons/website_sale/controllers/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 729b99fcbec..0ae469c98c7 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import logging import werkzeug from openerp import SUPERUSER_ID @@ -11,6 +12,8 @@ from openerp.addons.web.controllers.main import login_redirect PPG = 20 # Products Per Page PPR = 4 # Products Per Row +_logger = logging.getLogger(__name__) + class table_compute(object): def __init__(self): self.table = {} @@ -111,6 +114,8 @@ def get_pricelist(): else: partner = pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id pricelist = partner.property_product_pricelist + if not pricelist: + _logger.error('Fail to find pricelist for partner "%s" (id %s)', partner.name, partner.id) return pricelist class website_sale(http.Controller): From d812175390423f2b265ddd8957b887ed6df99ce8 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 14 Apr 2016 16:16:56 +0200 Subject: [PATCH 4/5] [FIX] account_asset: asset_create When creating assets from invoice lines, the system must check that assets have not already been created for the related invoice. If assets already exist then these assets have to be removed. Used case: - In the purchase journal, tick "allow canceling entries" - On a supplier invoice line, set an asset category - validate the invoice - cancel the invoice - set to draft - validate the invoice Before the fix: the asset is created twice. After the fix: the asset is created once. opw:674674 --- addons/account_asset/account_asset_invoice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account_asset/account_asset_invoice.py b/addons/account_asset/account_asset_invoice.py index 9212bc2f73c..aba583aea16 100644 --- a/addons/account_asset/account_asset_invoice.py +++ b/addons/account_asset/account_asset_invoice.py @@ -47,11 +47,12 @@ class account_invoice_line(osv.osv): def asset_create(self, cr, uid, lines, context=None): context = context or {} asset_obj = self.pool.get('account.asset.asset') + asset_ids = [] for line in lines: if line.invoice_id.number: - if asset_obj.search(cr, SUPERUSER_ID, [('code', '=', line.invoice_id.number)], context=context): - raise osv.except_osv(_('Warning!'), _('You already have assets with the reference %s.\nPlease delete these assets before creating new ones for this invoice.') % (line.invoice_id.number)) - + #FORWARDPORT UP TO SAAS-6 + asset_ids += asset_obj.search(cr, SUPERUSER_ID, [('code', '=', line.invoice_id.number), ('company_id', '=', line.company_id.id)], context=context) + asset_obj.write(cr, SUPERUSER_ID, asset_ids, {'active': False}) for line in lines: if line.asset_category_id: vals = { From 7e51d98553bfd910e8dabbcd890857b4bf1f4cd0 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 26 Apr 2016 14:55:41 +0200 Subject: [PATCH 5/5] [FIX] calendar: correct search on mail.message and ir.attachment Handle the case of immutable (tuple) domain leafs. --- addons/calendar/calendar.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 427f515ffd0..5da9104b6a8 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1759,9 +1759,10 @@ class mail_message(osv.Model): ''' convert the search on real ids in the case it was asked on virtual ids, then call super() ''' + args = list(args) for index in range(len(args)): if args[index][0] == "res_id" and isinstance(args[index][2], basestring): - args[index][2] = get_real_ids(args[index][2]) + args[index] = (args[index][0], args[index][1], get_real_ids(args[index][2])) return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None): @@ -1781,9 +1782,10 @@ class ir_attachment(osv.Model): ''' convert the search on real ids in the case it was asked on virtual ids, then call super() ''' + args = list(args) for index in range(len(args)): if args[index][0] == "res_id" and isinstance(args[index][2], basestring): - args[index][2] = get_real_ids(args[index][2]) + args[index] = (args[index][0], args[index][1], get_real_ids(args[index][2])) return super(ir_attachment, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) def write(self, cr, uid, ids, vals, context=None):