Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Automation for customer tag

Naroči se

Get notified when there's activity on this post

This question has been flagged
1 Odgovori
311 Prikazi
Avatar
Luke Osborn

Has anyone made an automation to attribute a customer tag with the purchase of a product?  This seems like a remedial need/function but even in automations I can't seem to find options for this.


Thanks!

0
Avatar
Opusti
Luke Osborn
Avtor

Hmm this might be a little pedantic for what I am trying to achieve now that I get an eye on it.  So what I'm trying to do is simply update the customer with a new price list when they have an active subscription.  My subscription product is called "Bronze".  The pricelist is called "Bronze" as well.  

Then I want the pricelist to be updated to "Default" when no subscription is in progress for that customer.

Does that make sense?  I've been through automations all weekend and I can't seem to get the correct prompts to make this happen.

Christoph Farnleitner

How is this related to your initial question? Please make up your mind before posting a question.

Luke Osborn
Avtor

Christoph it is "related" because it's the same problem I'm trying to solve. I explained it in the second sentence that perhaps my initial means is wrong. My mind is "made up". Please fully read comments before getting angry. I found a much easier solution.

Avatar
Christoph Farnleitner
Best Answer

You could create an Automation Rule like this (only rudimentarily tested):


Automation Rule for

Model: Sales Order Line
Trigger: On create and edit
Before Update Domain: Match all records
Apply on: Match all of the following rules: Order Status = Sales Order
When updating: Order Status

Action To Do: Execute Code

# Set Sale Order Line's Product Tags on Customer
for rec in records:​
# loop over all sale order lines that just had their status udpated
    for tag_id in rec.product_id.product_tag_ids:
​# in case there is a tag on the current SO line's product,
# check if this tag exists for usage with customers already,
# if it doesn't, create it
        customer_tag_id = env['res.partner.category'].search([('name', '=', tag_id.name)])
        if not customer_tag_id:
            customer_tag_id = env['res.partner.category'].create({'name': tag_id.name})
        # set the tag to the customer
rec.order_id.partner_id.write({'category_id': [Command.link(customer_tag_id.id)]})


Notes: 

This example isn't optimized, i.e. only setting a tag when not already present on the customer, etc. However, it should do the trick.

Since Product Tags and Customer Tags are different, the example works like this: First, if there is a Tag assigned to the Product (of the Sale Order Line that is just having its Status updated to 'Sale Order') it checks whether a Tag with the same Name exists for Customers. If it doesn't, a new Tag is created. Then, this Customer Tag (named like the Product's Tag) is written to the Customer of the Sale Order (Line).


Product:


Customer:


Sale Order (draft):


Sale Order (confirmed):

... and therefore, Customer update:


See also: https://www.odoo.com/documentation/19.0/applications/studio/automated_actions.html and https://www.odoo.com/documentation/19.0/developer/reference/backend/orm.html.

And also the Help tab of the Execute Code option:

The following variables can be used:
env: environment on which the action is triggered
model: model of the record on which the action is triggered; is a void recordset
record: record on which the action is triggered; may be be void
records: recordset of all records on which the action is triggered in multi mode; may be void
time, datetime, dateutil, timezone: useful Python libraries
float_compare(): utility function to compare floats based on a specific precision
log(message, level='info'): logging function to record debug information in ir.logging table
_logger.info(message): logger to emit messages in server logs
UserError: exception class for raising user-facing warning messages
Command: x2many commands namespace
To return an action, assign: action = {...}
To notify progress for CRON call and re-trigger a call if there is remaining tasks, use env['ir.cron']._notify_progress(done=task_done_count, remaining=task_remaining_count)


0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now