Odoo Help

0

0
1 Answer
1
Avatar

Ray Carnes

--Ray Carnes--
2747
| 5 2 8
Beaumont, United States
--Ray Carnes--

Business Analyst - Custom Projects

https://www.linkedin.com/in/raycarnes

Ray Carnes
7/16/18, 5:01 PM

You could create an Automated Action to change this behavior.

Activate Developer Mode and visit the Technical --> Automation --> Automated Actions (if this menu isn't present, please install the Automated Action rules (base_automation) module.

Create a new Automated Action:

 



Code for you to copy/paste:

# if this is a Receipt with a Source (possibly automatically made)
if record.picking_type_id.code == 'incoming' and record.origin: 
# find the PO that made the Receipt 
located_po = env['purchase.order'].search([('name','=',record.origin)]) 
# Remove existing followers  
for follower in record.message_follower_ids:   
record.message_unsubscribe([follower.partner_id.id]) 
# Add the same followers as the PO 
for follower in located_po.message_follower_ids:   
record.message_subscribe([follower.partner_id.id])


This will:

  • Check that the newly created Receipt is in fact a Receipt, and wasn't created manually.

  • Find the PO that created it

  • Remove all followers from the Receipt

  • Add the same followers from the PO to the Receipt


Note:  If there are no Followers on the PO, there will also be no Followers on the Receipt.

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now