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

The domain does not work in a smart button

Abonare

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

Această întrebare a fost marcată
domain_filterv15smartbutton
3287 Vizualizări
Imagine profil
José Antonio Rojas
Hello,
I'm trying to insert a smart button but I'm having problems using the domain (filter) as it directs me to a blank model, when I try to direct it to the model related to the name.
I hope you can help me, thank you very much.

.py

class Agenda_citas (models.Model):
_name = 'agendacitas'
_inherit =['mail.thread','mail.activity.mixin']
_description = "Agenda y estructura de el modulo de citas "
state = fields.Selection(string="Estado",
selection=[('ag', 'Agendada'),
('co', 'Confirmada'),
('ca', 'Cancelada'),
('re', 'Reprogramada')])
name = fields.Many2one(
comodel_name = 'res.partner',
string = 'Paciente'

)
inicio_cita = fields.Datetime (
string = 'Fecha inicio',
required=True,
default=fields.Date.today
)
final_cita = fields.Datetime (
string = 'Fecha Fin',
readonly=False,
default = lambda self: fields.Datetime.today() + timedelta(minutes=20),
compute='_compute_final_cita',
store = True,
)
duracion_cita = fields.Float(
'Duración',
compute='_compute_duration',
store=True,
readonly=False
)
doctor_base =fields.Many2one(
comodel_name = 'res.partner',
string = 'Doctor Tratante'

)
referencia = fields.Many2one(
comodel_name = 'res.partner',
string = 'Referencia'
)

observaciones_cita = fields.Text(string="Observaciones")
motivo = fields.Char(string="Motivo de Consulta")
#doctor_clinica = fields.Many2one(
# comodel_name = 'res.partner',
#string = 'doctor que atiende' )

@api.depends('inicio_cita' , 'final_cita')
def _compute_duration(self):
for event in self:
event.duracion_cita = self._get_duracion_cita(event.inicio_cita, event.final_cita)
@api.depends('inicio_cita', 'duracion_cita')
def _compute_final_cita(self):
# stop and duration fields both depends on the start field.
# But they also depends on each other.
# When start is updated, we want to update the stop datetime based on
# the *current* duration. In other words, we want: change start => keep the duration fixed and
# recompute stop accordingly.
# However, while computing stop, duration is marked to be recomputed. Calling `event.duration` would trigger
# its recomputation. To avoid this we manually mark the field as computed.
duration_field = self._fields['duracion_cita']
self.env.remove_to_compute(duration_field, self)
for event in self:
# Round the duration (in hours) to the minute to avoid weird situations where the event
# stops at 4:19:59, later displayed as 4:19.
event.final_cita = event.inicio_cita and event.inicio_cita + timedelta(seconds =round((event.duracion_cita or 1.0) * 60))

def _get_duracion_cita(self, inicio_cita, final_cita):
""" Get the duration value between the 2 given dates. """
if not inicio_cita or not final_cita:
return 0
duracion_cita = (final_cita - inicio_cita).total_seconds() / 60
return round(duracion_cita, 2)

def action_abrir_expediente (self):
return {
'type': 'ir.actions.act_window',
'name': 'Notas Médicas',
'res_model': 'res.partner',
'domain': [('name','=', self.id)],
'view_mode': 'form',
'target': 'current',
}

.xml

 
Agenda de Citas
agendacitas











Agendar Cita Paciente






domain = "[('es_convenio', '=', True)]"
options="{'no_create':True, 'no_open': True}"
/>





domain = "[('es_medico', '=', True)]"
options="{'no_create':True, 'no_open': True}"
/>


Observaciones



placeholder = 'Observaciones'
nolabel="1"/>












Vista de arbol Citas
agendacitas







widget="badge"
decoration-warning = "state =='re'"
decoration-success ="state == 'co'"
decoration-danger = "state == 'ca'"
decoration-info = "state =='ag'">




Thanks


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
odoo15ce domain many2one based on parent model Rezolvat
domain_filter v15
Imagine profil
Imagine profil
2
nov. 22
3043
add smart buttons Rezolvat
v15 smartbutton
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
oct. 22
13949
Defining a domain for an automated action with two variables in Odoo 15 Rezolvat
domain domain_filter AutomatedActions v15
Imagine profil
Imagine profil
1
ian. 23
4106
how to i get active id Rezolvat
saleorder active_id v15 smartbutton
Imagine profil
Imagine profil
1
iun. 22
13745
Prevent navigation if records are not save
v15
Imagine profil
Imagine profil
Imagine profil
2
oct. 25
3252
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