Skip to Content

Welcome!

human made "AI" (advises & inputs) forum by Odoo professionals, experts and enthusiasts challenging real use cases with standard solutions!

-> solutions should be applicable for Odoo community or online (at the limit with Studio), all without custom modules.

This question has been flagged
1 Reply
204 Views

Inform/create an activity for salespersons at the receipt of products that were out of stock at sales confirmation and were replenished with reordering rules or MTO

Avatar
Discard
Author
  • activate the developer mode and go to settings->technical-> automation rules (in Odoo enterprise it can also be done opening studio from a inventory receipt)
  • create the following automation:

Code:

# The action works for related purchases generated by MTO or reordering rules

pickings = records or record

for pick in pickings:
  all_purchases = pick.mapped("move_ids.purchase_line_id.order_id")
  for purchase in all_purchases:
    # Parse origin string to find related sale orders
    if not purchase.origin:
      continue
    all_origins = purchase.origin.replace(", ", " ").replace(" - ", " ").split()
    orders = env["sale.order"].search([("name", "in", all_origins)])
    for order in orders:
      order.activity_schedule(act_type_xmlid="mail.mail_activity_data_todo", summary="Receipt from related purchase %s" % purchase.name, user_id=order.user_id.id)
     
Avatar
Discard
Related Posts Replies Views Activity
1
Aug 26
218
1
Aug 26
293
1
Aug 26
226
1
Aug 26
331
1
Aug 26
187