From 4001aaf2c47d3e7e6334aaa453f58054b98ee864 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 12 Jul 2017 09:58:34 +0200 Subject: [PATCH 1/4] [FIX] l10n_fr_certification : fix string_to_hash computation - use datas of all lines, and not only the last lines. - removed useless 'move_id' field from account.move.line Was PR #18175. Courtesy of Sylvain Legal --- addons/l10n_fr_certification/models/account.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/l10n_fr_certification/models/account.py b/addons/l10n_fr_certification/models/account.py index bef0880d7ca..07d5fc04e41 100644 --- a/addons/l10n_fr_certification/models/account.py +++ b/addons/l10n_fr_certification/models/account.py @@ -10,7 +10,7 @@ ERR_MSG = _("According to the french law, you cannot modify a %s in order for it #forbidden fields MOVE_FIELDS = ['date', 'journal_id', 'company_id'] -LINE_FIELDS = ['debit', 'credit', 'account_id', 'move_id', 'partner_id'] +LINE_FIELDS = ['debit', 'credit', 'account_id', 'partner_id'] class AccountMove(models.Model): @@ -55,7 +55,8 @@ class AccountMove(models.Model): for line in move.line_ids: for field in LINE_FIELDS: - values[field] = _getattrstring(line, field) + k = 'line_%d_%s' % (line.id, field) + values[k] = _getattrstring(line, field) #make the json serialization canonical # (https://tools.ietf.org/html/draft-staykov-hu-json-canonical-form-00) move.l10n_fr_string_to_hash = dumps(values, sort_keys=True, encoding="utf-8", From 058cc22d2c680f73501ce1a49762eda1a4c9ce9d Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 29 Jun 2017 14:07:01 +0200 Subject: [PATCH 2/4] [FIX] website_form: send email with subject - Use the form builder to send an email - Customize the snippet to include the subject and the body - Send a mail => The subject is not included in the email This is because the subject is filtered out and considered as a blacklisted field. It happens because `mail.mail` inherits from `mail.message`. The field property `website_form_blacklisted` is set to: - `True` for `mail.mail` - `False` for `mail.message` Since we go through all inherited models, the property on `mail.mail` is overriden by the property on `mail.message`. It is actually not necessary to go through all inherited models, since in the case of `inherits`, we copy the fields of the inherited model to the target model. The check is simplified by only checking the fields of the current model. Based on work of @nla-odoo opw-748926 --- addons/website_form/models/models.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/addons/website_form/models/models.py b/addons/website_form/models/models.py index c3e8be8d36d..65fed9e526c 100644 --- a/addons/website_form/models/models.py +++ b/addons/website_form/models/models.py @@ -18,12 +18,6 @@ class website_form_model(models.Model): website_form_default_field_id = fields.Many2one('ir.model.fields', 'Field for custom form data', domain="[('model', '=', model), ('ttype', '=', 'text')]", help="Specify the field which will contain meta and custom form fields datas.") website_form_label = fields.Char("Label for form action", help="Form action label. Ex: crm.lead could be 'Send an e-mail' and project.issue could be 'Create an Issue'.") - def _all_inherited_model_ids(self): - return list(itertools.chain( - [self.id], - *(m._all_inherited_model_ids() for m in self.inherited_model_ids) - )) - def _get_form_writable_fields(self): """ Restriction of "authorized fields" (fields which can be used in the @@ -31,16 +25,16 @@ class website_form_model(models.Model): builders and are writable. By default no field is writable by the form builder. """ - excluded = { + included = { field.name for field in self.env['ir.model.fields'].sudo().search([ - ('model_id', 'in', self._all_inherited_model_ids()), - ('website_form_blacklisted', '=', True) + ('model_id', '=', self.id), + ('website_form_blacklisted', '=', False) ]) } return { k: v for k, v in self.get_authorized_fields().iteritems() - if k not in excluded + if k in included } @api.multi From b1b83925913136f82e1af710643aeeebaca086cc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 2 Feb 2017 09:59:29 +0100 Subject: [PATCH 3/4] [FIX] sales_team, crm: expected closing On the CRM dashboard, the shortcut 'exp. closing' is the same than the 'overdue' shortcut. However, the number of opportunities in these categories is computed differently (see method `retrieve_sales_dashboard`). We introduce a new filter "Overdue Opportunities" which reflects this difference. Backport of 9d2f48dc7fa9d5de3e850ff7ac82d9b31cf188cd opw-704173 opw-751165 --- addons/crm/crm_lead_view.xml | 3 +++ addons/sales_team/static/src/js/sales_team_dashboard.js | 2 ++ addons/sales_team/static/src/xml/sales_team_dashboard.xml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index f5deb670046..12dddbe0e62 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -633,6 +633,9 @@ ]"/> + - + exp. closing From 3e8ba4905ccd32ea4324b8baa46e6554ce84c7ac Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 13 Jul 2017 08:32:45 +0200 Subject: [PATCH 4/4] [FIX] crm: expected closing The "exp. closing" dashboard button takes into account the won opportunities. It shouldn't. Backport of 9d2f48dc7fa9d5de3e850ff7ac82d9b31cf188cd opw-751165 opw-744940 --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 6fedd54890b..b8902cb736d 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -1147,7 +1147,7 @@ Update your business card, phone book, social media,... Send an email right now res['closing']['today'] += 1 if date_deadline >= date.today() and date_deadline <= date.today() + timedelta(days=7): res['closing']['next_7_days'] += 1 - if date_deadline < date.today(): + if date_deadline < date.today() and not opp['date_closed']: res['closing']['overdue'] += 1 # Next activities