From 5831aca505bb685f5f0393459508ff71a485ef7f Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 6 Aug 2015 10:12:59 +0200 Subject: [PATCH 1/3] [FIX] account_followup: contact with type = "invoice" In "Payment Follow-up" when clicking on "Send Overdue Email" if contact with type = "invoice" and an email exists in the childs then the email will be send to this contact else the normal behavior is kept. When the overvue email is sent to a contact who is not the commercial partner, a message is written in the chatter of the commercial partner to inform him that the email has been sent to the "invoice" contact. Closes #7870 opw:646149, 646575 --- addons/account_followup/account_followup.py | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index 5b45c9ac002..27caab704e2 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -203,14 +203,20 @@ class res_partner(osv.osv): mtp = self.pool.get('email.template') unknown_mails = 0 for partner in self.browse(cr, uid, partner_ids, context=ctx): - if partner.email and partner.email.strip(): + partners_to_email = [child for child in partner.child_ids if child.type == 'invoice' and child.email] + if not partners_to_email and partner.email: + partners_to_email = [partner] + if partners_to_email: level = partner.latest_followup_level_id_without_lit - if level and level.send_email and level.email_template_id and level.email_template_id.id: - mtp.send_mail(cr, uid, level.email_template_id.id, partner.id, context=ctx) - else: - mail_template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, - 'account_followup', 'email_template_account_followup_default') - mtp.send_mail(cr, uid, mail_template_id[1], partner.id, context=ctx) + for partner_to_email in partners_to_email: + if level and level.send_email and level.email_template_id and level.email_template_id.id: + mtp.send_mail(cr, uid, level.email_template_id.id, partner_to_email.id, context=ctx) + else: + mail_template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, + 'account_followup', 'email_template_account_followup_default') + mtp.send_mail(cr, uid, mail_template_id[1], partner_to_email.id, context=ctx) + if partner not in partners_to_email: + self.message_post(cr, uid, [partner.id], body=_('Overdue email sent to %s' % ', '.join(['%s <%s>' % (partner.name, partner.email) for partner in partners_to_email])), context=context) else: unknown_mails = unknown_mails + 1 action_text = _("Email not sent because of email address of partner not filled in") @@ -237,7 +243,7 @@ class res_partner(osv.osv): assert len(ids) == 1 if context is None: context = {} - partner = self.browse(cr, uid, ids[0], context=context) + partner = self.browse(cr, uid, ids[0], context=context).commercial_partner_id #copy the context to not change global context. Overwrite it because _() looks for the lang in local variable 'context'. #Set the language to use = the partner language context = dict(context, lang=partner.lang) From fa1842cb1dbff0a6c50aed2342198a5c42283adf Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 5 Aug 2015 18:21:57 +0200 Subject: [PATCH 2/3] [FIX] stock: add procurement group for extra moves in picking When pack operations generate extra moves, they should take the same procurement group as those of the picking. That way, when invoicing, they will be put on the same invoice when there is a different invoice address on the sale order. --- addons/stock/stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 21a65f2eb73..114a724c1a0 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1362,6 +1362,7 @@ class stock_picking(osv.osv): 'name': _('Extra Move: ') + name, 'state': 'draft', 'restrict_partner_id': op.owner_id, + 'group_id': picking.group_id.id, } return res From d8d9c7277e86e703e77c3c037114e59e876dc647 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 6 Aug 2015 17:20:37 +0200 Subject: [PATCH 3/3] [FIX] phantomjs test: `phantom` variable is undefined inside page. --- openerp/tests/phantomtest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tests/phantomtest.js b/openerp/tests/phantomtest.js index d37d1ea0fab..583e8b8cbab 100644 --- a/openerp/tests/phantomtest.js +++ b/openerp/tests/phantomtest.js @@ -93,8 +93,8 @@ function PhantomTest() { "\nreferrer: " + document.referrer + "\n\n" + (document.body && document.body.innerHTML)).replace(/[^a-z0-9\s~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "*"); console.log('error', message); - phantom.exit(1); }); + phantom.exit(1); }, self.timeout); // ----------------------------------------------------