Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

The domain does not work in a smart button

Subscriure's

Get notified when there's activity on this post

This question has been flagged
domain_filterv15smartbutton
3348 Vistes
Avatar
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
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
odoo15ce domain many2one based on parent model Solved
domain_filter v15
Avatar
Avatar
2
de nov. 22
3082
add smart buttons Solved
v15 smartbutton
Avatar
Avatar
Avatar
Avatar
3
d’oct. 22
14215
Defining a domain for an automated action with two variables in Odoo 15 Solved
domain domain_filter AutomatedActions v15
Avatar
Avatar
1
de gen. 23
4191
how to i get active id Solved
saleorder active_id v15 smartbutton
Avatar
Avatar
1
de juny 22
13840
Prevent navigation if records are not save
v15
Avatar
Avatar
Avatar
2
d’oct. 25
3397
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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