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
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    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

Sequence in Many2many field odoo16

Abonare

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

Această întrebare a fost marcată
many2manyodoo
1 Răspunde
2790 Vizualizări
Imagine profil
Kazi Al Amin

I am working on a custom module using odoo16 where I have a model gas.route and another model is gas.checkpoint. In gas.route model, for a route there could be multiple checkpoints. on the top of that one checkpoint can be assigned on different route. 
but the problem is, in different route the checkpoints sequence is different. I can not be able to handle it to create different sequence of checkpoint for routes.

my code is 

class Route(models.Model):
_name = 'gas.route'
_description = 'Config Route'
_inherit = ['mail.thread']

name=fields.Char("Name")
start_point= fields.Many2one("gas.checkpoint","Start Point", domain="[('is_start_end_checkpoint', '=', True)]")
end_point= fields.Many2one("gas.checkpoint","End Point",domain="[('is_start_end_checkpoint', '=', True)]")
distance = fields.Float(string='Distance(KM)')
updown = fields.Selection([('up','Up'),('down','Down')],string='Up/Down')
checkpoints=fields.Many2many("gas.checkpoint",'gas_route_checkpoint_rel', 'route_id', 'checkpoint_id', string='Checkpoints')
status=fields.Selection([('active', 'Active'), ('inactive', 'Inactive')],string="Status")


on checkpoint model:

class CheckPoint(models.Model):
_name = 'gas.checkpoint'
_description = 'Config Checkpoint'
_inherit = ['mail.thread']

name=fields.Char("Name")
latitude = fields.Float(string='Geo Latitude', digits=(10, 7))
longitude = fields.Float(string='Geo Longitude', digits=(10, 7))
map_location = fields.Char(string='Current Map Location', compute='_compute_map_location')
address = fields.Char(String="Address", compute='_compute_address', store=True)
is_start_end_checkpoint=fields.Boolean("Is Start/End Point")
status=fields.Selection([('active', 'Active'), ('inactive', 'Inactive')],string="Status")


0
Imagine profil
Abandonează
Imagine profil
Hamza Ilyas
Cel mai bun răspuns

Hi, 

You can try this:

First, you can add the widget = "many2many_tags" to your checkpoints (m2m) field in the form view file of gas.route model.
Now assuming that you have two checkpoints CP1 and CP2. You can now select your checkpoints in a sequence of your choice in every Gas Route.

Let's say for gas route 1 you added checkpoints like CP2 and CP1.
For another gas route record, you can add Checkpoints CP1 and CP2 and similarly, you can add checkpoints in any sequence of your choice in every route.

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
Related Posts Răspunsuri Vizualizări Activitate
Is it possible to access the "x-th" record of a many2many field after autofilling?
many2many odoo odoo12
Imagine profil
Imagine profil
1
feb. 23
2557
Is it possible to autofill a Many2many field with records? Rezolvat
many2many odoo odoo12
Imagine profil
Imagine profil
Imagine profil
2
feb. 23
3388
add value in many2many field
many2many odoo v15
Imagine profil
0
iun. 22
2963
create button in many2many field
many2many odoo odoo12
Imagine profil
0
dec. 19
4804
.create() for a Many2many? Rezolvat
create many2many odoo
Imagine profil
Imagine profil
2
dec. 18
9833
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