[FIX] account: do not subscribe commercial partner

- Create a partner which is a company
- Add a contact
- Create an invoice for the contact, post it

Both the contact and the company are set as followers of the invoice.

Only the contact should be, there is no reason to make the company
follower too.

opw-2179084

closes odoo/odoo#44624

X-original-commit: daedd9eb402e5dd3c6a700a93ee58022266ec95b
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-02-05 08:30:03 +00:00
parent f71bc8ca5d
commit ec2b5b4bc7
2 changed files with 2 additions and 4 deletions
+1 -1
View File
@@ -2114,7 +2114,7 @@ class AccountMove(models.Model):
if move.auto_post and move.date > fields.Date.today():
raise UserError(_("This move is configured to be auto-posted on {}".format(move.date.strftime(get_lang(self.env).date_format))))
move.message_subscribe([p.id for p in [move.partner_id, move.commercial_partner_id] if p not in move.sudo().message_partner_ids])
move.message_subscribe([p.id for p in [move.partner_id] if p not in move.sudo().message_partner_ids])
to_write = {'state': 'posted'}
@@ -349,12 +349,10 @@ class TestAccountMove(AccountTestInvoicingCommon):
move = self.test_move.with_user(user)
partner = self.env['res.partner'].create({'name': 'Belouga'})
commercial_partner = self.env['res.partner'].create({'name': 'Rorqual'})
move.partner_id = partner
move.commercial_partner_id = commercial_partner
move.post()
self.assertEqual(move.message_partner_ids, self.env.user.partner_id | existing_partners | partner | commercial_partner)
self.assertEqual(move.message_partner_ids, self.env.user.partner_id | existing_partners | partner)
def test_misc_move_onchange(self):
''' Test the behavior on onchanges for account.move having 'entry' as type. '''