49. One2many Field In Odoo 15 || Odoo Relational Fields || Odoo 15 Development Tutorials

Поделиться
HTML-код
  • Опубликовано: 31 июл 2024
  • How to add one2many fields in Odoo 15. Odoo 15 one2many field. Working of odoo 15 development tutorials. How to add one2many field in Odoo. Add odoo one2many field. Working of odoo 15 one2many fields. Relational Fields in Odoo 15. Odoo 15 development tutorials. Odoo one2many tree view. Odoo one2many form view. Odoo one2many editable attributes.
    Detailed One2many Tutorial in Odoo 14: • 45.How To Add One2many...
    Odoo 15 Playlist: • How To Configure Odoo1...
    Website: www.odoomates.tech/
    Instgram: / odoomates
    Github: github.com/odoomates
    Email : odoomates@gmail.com
    Facebook: / odoomate
    Twitter: / odoomates
    Support Us in Ko Fi : ko-fi.com/odoomates
  • НаукаНаука

Комментарии • 42

  • @MrHighvolt
    @MrHighvolt 2 года назад +1

    Thanks for the video!

    • @OdooMates
      @OdooMates  2 года назад

      Thanks for the support ❤️❤️❤️❤️

  • @wilfredocristobalolanochav5789
    @wilfredocristobalolanochav5789 2 года назад +1

    Muchas gracias por compartir, saludos

    • @OdooMates
      @OdooMates  2 года назад

      gracias por el apoyo hermano

  • @user-oo5uz8jg3u
    @user-oo5uz8jg3u 11 месяцев назад

    Hi Odoo mates, thanks for your video tutorials they are really helpful. I noticed some issues even though I followed this video of One2many fields step by step. First, I'm developing on Odoo 16, and when I followed the exact steps in this video, the Add a line section as can been seen in the video @ 11:03, does not display in the UI. Secondly, products lists do not display in the UI as well. Can you help me in getting around this issue? Thanks.
    Update: I'd like to say that I have been able to figure out what the issue was, and I have had it fixed. Thanks for your time.

  • @asero82.
    @asero82. 9 месяцев назад

    Useful tutorial. I want to know if is it possible to use a specify pricelist for the product price? Let's say if a business requirement is to use a pricelist with ID 2 for products used in pharmacy lines, how could I set this up? Thanks in advance.

  • @ShadHastam
    @ShadHastam 6 месяцев назад

    Thanks

  • @medomedop2566
    @medomedop2566 Год назад

    i have this error while try to add a line "Uncaught Promise > Cannot read properties of undefined (reading 'append')
    "
    but it is disappear when I add editable="bottom" in tree tag so what is the problem and this problem every where I try to add a line

  • @SamirSELLAMI
    @SamirSELLAMI 2 года назад +1

    In Odoo14, I keep getting the following error :
    File "C:\Odoo14\odoo\odoo\models.py", line 5168, in _update_cache raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name)) Exception
    should I watch the video of Odoo14 tutorial ?

    • @OdooMates
      @OdooMates  2 года назад +1

      can you show us what code you have recently added

    • @SamirSELLAMI
      @SamirSELLAMI 2 года назад

      ​@@OdooMates Hi, let me explain my scenario: I have two child models B and C _inherit from parent model A. The main model A has a One2many relationship with another model D. The problem occurs when interacting with "field_ids" added to the views of B and C. However, the error does not occur when declaring the One2many relationship field between child model B and D for example! but this does not make sense to me, because in this case model D will have multiple Many2one fields ("B_id" and "C_id"] referring to child models B and C respectively, instead of a single Many2one field "A_id" referring to the main model A, so maybe the One2many relationship is not supported in the _inherit mode?

  • @javedshoukat3538
    @javedshoukat3538 8 месяцев назад

    Hi Odoo mates thank you for the useful video.
    Plz share how we can get the latest entered record from one2many fileld in another modules and how
    to show in view of that other module.
    Like from this One2many field you created, the last added medicine name only, show it in sale module, just under the Customer name.
    Plz help

  • @user-vh2lk2vr6t
    @user-vh2lk2vr6t Год назад +1

    Nicely explained, I am getting complete form view of base model, however i add only tree view in my one2many field?

    • @OdooMates
      @OdooMates  Год назад +1

      if you haven't defined form view for the model, odoo will show auto generated form view for the model

  • @superjose278
    @superjose278 Год назад +1

    i had an error when try to save changes with two or more records in product list (area of multiple lines or products), ValueError: Expected singleton: concesion.internacional.lines(5, 6). What could be happend? Thanks

    • @OdooMates
      @OdooMates  Год назад

      ruclips.net/video/Rv44nFVn_5U/видео.html

  • @pranavbhat92
    @pranavbhat92 2 года назад +1

    Thank you for the video!
    I was able to get the product lists without adding the dependency in the manifest file. Thats weird. 🤔

    • @OdooMates
      @OdooMates  2 года назад +1

      Glad to hear it

    • @pranavbhat92
      @pranavbhat92 2 года назад +1

      @@OdooMates Sorry I spoke too soon. When I added the 'related' field for the price_unit, I started getting the error. After adding the dependency, the error vanished. Once again, thanks for covering everything in detail! 😀

    • @OdooMates
      @OdooMates  2 года назад +1

      ❤️❤️❤️ thanks for the support brother

  • @FunnyDay.5631
    @FunnyDay.5631 Год назад +1

    I'm getting the output but when i create tree view for that it showing "price" does not exist in model "hospital.appointment"

  • @nicorey.
    @nicorey. 8 месяцев назад

    Bro Why i cant fix the product_id error?, i already add the product to depend do you know how to fix this?

  • @hulkavenger8790
    @hulkavenger8790 Год назад +1

    Can you tell me why one to one concept is not used in odoo...?

    • @OdooMates
      @OdooMates  Год назад

      No specific reason, using many2one we can achive the same right ?

  • @chaotixsniper
    @chaotixsniper 2 года назад +1

    i have a problem with the security file :
    Exception: Module loading om_hospital failed: file om_hospital\security/ir.model.access.csv could not be processed:
    No matching record found for external id 'om_hospital.model_appointment_availability_lines' in field 'Model'
    Missing required value for the field 'Model' (model_id)
    i got this error when i upgraded the module ..

    • @OdooMates
      @OdooMates  2 года назад

      do you have a model named: appointment_availability_lines in the module and imported the file in init file ?

    • @chaotixsniper
      @chaotixsniper 2 года назад +1

      @@OdooMates no i just followed your steps i just changed the naming, instead of appointment_pharmacy_lines i named it appointment_availability_lines.. I have the same models as you in this tutorial.

    • @OdooMates
      @OdooMates  2 года назад

      So you need to set access rights for appointment availability model ?

    • @chaotixsniper
      @chaotixsniper 2 года назад

      @@OdooMates yeah i did exactly the same way you did and still get the error when i upgrade the module

  • @eventdz6182
    @eventdz6182 Год назад +1

    hi I get this erreur and I don't know how to fix it: AttributeError: '_unknown' object has no attribute 'id'

    • @OdooMates
      @OdooMates  Год назад +1

      Can you show us the code that you have added

    • @eventdz6182
      @eventdz6182 Год назад

      @@OdooMates ​this is appoitement class
      from odoo import models, fields, api
      from datetime import datetime
      class HospitalAppointement(models.Model):
      _name = 'hospitaleila.appointement'
      _inherit=['mail.thread', 'mail.activity.mixin']
      _description = 'hospitaleila appointement'
      _rec_name ='patient_id'
      patient_id=fields.Many2one('hospitaleila.patient',string="Patient")
      gender = fields.Selection(related='patient_id.gender')
      appointment_time = fields.Datetime(string='Appointment time' ,default=fields.Datetime.now)
      booking_date = fields.Date(string='Booking Date',default=fields.Date.context_today)
      ref = fields.Char(string='Refrence')
      prescription = fields.Html(string='prescription')
      priority = fields.Selection([
      ('0', 'Normal'),
      ('1', 'Low'),
      ('2', 'High'),
      ('3', 'Very High')
      ],
      string='Priority')
      state = fields.Selection([
      ('draft', 'Draft'),
      ('in_consultation', 'In Consultation'),
      ('done', 'Done'),
      ('cancel', 'Cancel')
      ],
      string='State',default='draft',required=True)
      doctor_id=fields.Many2one('res.users',string="Doctore",tracking=True)
      appointment_availability_lines = fields.One2many('appointement.pharmacy.lines','appointement_id',string='Sessions')
      def action_in_consultation(self):
      for rec in self:
      rec.state='in_consultation'
      def action_done(self):
      for rec in self:
      rec.state='done'
      def action_cancel(self):
      for rec in self:
      rec.state='cancel'
      def action_draft(self):
      for rec in self:
      rec.state='draft'
      def action_test(self):
      print("botton clicked //////////////")
      return{
      'effect':{
      'fadeout':'slow',
      'message':'Click Successfull',
      'type':'rainbow_man',
      }
      }
      @api.onchange('patient_id')
      def onchange_patient_id(self):
      self.ref = self.patient_id.ref
      class AppointementPharmacyLine(models.Model):
      _name = 'appointement.pharmacy.lines'
      _description='apointement pharmacy lines'
      product_id =fields.Many2one('product.product')
      proice_unit=fields.Float(string='Price')
      qty=fields.Integer(string='Quantity')
      appointement_id=fields.Many2one('hospital.appointement',string="appointement")
      __manifest__.py
      # -*- encoding: utf-8 -*-
      {
      "name": "Test Hospital management ",
      "version": "1.2.0",
      "author": "Hospital HASNAOUI Leila test ",
      "website": "www.odoo.com",
      "sequence": 0,
      "category": '',
      "license": "LGPL-3",
      "depends": ['mail','product'],
      "description": """

      """,
      'summary': 'Gestion complète de votre centre de Hospital',
      "data": [
      "security/ir.model.access.csv",
      "views/menuItems.xml",
      "views/patient.xml",
      "views/patient_tag.xml",
      "views/appointement.xml",
      "views/femalePatient.xml",

      ],
      "auto_install": False,
      "installable": True,
      "application": True,
      }
      appointement.xml
      hospital.appointement.activity
      hospitaleila.appointement














      hospital.appointement.tree
      hospitaleila.appointement















      hospital.appointement.form
      hospitaleila.appointement


































































      hospital.appointement.search
      hospitaleila.appointement






      Appointement
      ir.actions.act_window
      hospitaleila.appointement
      tree,form,activity



      Cliquez pour créer une nouvelle Appiontement.






      thanks for your replayed

  • @mohamedsobh2626
    @mohamedsobh2626 Год назад

    in a patient form, an one2many tree of appointments (editable is false), then create a new appointment line a form popup,
    how to pass the patient id to the appointment form?

    • @OdooMates
      @OdooMates  Год назад

      Is it one2many form ?

    • @mohamedsobh2626
      @mohamedsobh2626 Год назад

      @@OdooMates yes

    • @OdooMates
      @OdooMates  Год назад +1

      @@mohamedsobh2626 ruclips.net/video/bgDSyQZx_iI/видео.html

    • @OdooMates
      @OdooMates  Год назад

      @@mohamedsobh2626 using context you can pass default value to one2many

    • @mohamedsobh2626
      @mohamedsobh2626 Год назад

      context accept any field, except the active_id at one2many popup form 😀