Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Automation for customer tag

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
1 Răspunde
308 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Luke Osborn
Autor

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
Autor

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.

Imagine profil
Christoph Farnleitner
Cel mai bun răspuns

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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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