Questions tagged [one2many]

A one-to-many relationship in a database occurs when each record in Table A may have many linked records in Table B, but each record in Table B may have only one corresponding record in Table A. A one-to-many relationship in a database is the most common relational database design and is at the heart of good design.

75 questions
4
votes
3 answers

How to restrict/disable the form view, while click tree view of one2many field in Odoo

How to restrict/disable the form view, while click the tree view of one2many field in Odoo.
maha lakshmi
  • 61
  • 1
  • 7
4
votes
2 answers

Not getting records which created in One2many field on onchange in transient model

I am trying to create records in one2many field in one of my transient model on onchange of boolean field. Eg. Models class test_model(models.TransientModel): _name ="test.model" is_okay = fields.Boolean("Okay?") lines =…
4
votes
0 answers

odoo 9 - how to restrict one2many to not show a form view

I have a many2many, which is using the one2many widget. I set mode="tree" and am using editable="bottom". This works as expected in edit mode, however when in view mode - if the user clicks on a line it opens the line in a form view - how do i…
Palza
  • 642
  • 5
  • 12
3
votes
1 answer

Odoo - one2many sum

I'm working on simple project and I've got a problem. I want sum one column in my one2many fields how i can do this ? from openerp import models, fields, api, _ class Fam(models.Model): _name = 'fam' fm_id = fields.Many2one('fam') …
3
votes
1 answer

How to change the order of a One2many field?

I have a tree view, where the new items are placed above of all. Instead of that, I need to place the new item at the end of other items. Moreover, if the order of the new items is wrong I need to set them in the correct order Where is this order…
Capriatto
  • 947
  • 1
  • 8
  • 17
2
votes
1 answer

Why odoo One2many does not hard delete row?

I have observed the table where an One2many field is related. When I deleted a row of an One2many field thorough One2many widget the real row inside the table is not deleted. The row just got the foreign key column set to NULL. Can we change this…
strike_noir
  • 4,080
  • 11
  • 57
  • 100
2
votes
1 answer

Validation on export data for one2many field column in Odoo 13

I want to show validation error when the user export records for state='draft'(in one2many field). I have done code for it and it's working fine. but when I put this code for one2many table then I unable to get a validation message. My code is…
Pawan Kumar Sharma
  • 1,168
  • 8
  • 30
2
votes
1 answer

How to display One2many field's view in my custom view?

My ticket has many comments and I created a view for my comment and make a One2Many field in ticket model. But it is not displaying my desired view. Here is my model class Ticket(model.Model): _name = 'Tickets' comment_ids =…
Adam Strauss
  • 1,889
  • 2
  • 15
  • 45
2
votes
0 answers

How to create the one to many relationship based file upload using serialization

Only save the Project model fields doesn't create the project documents model fields Models.py class Project(BaseModel): name = models.CharField(max_length=100, blank=True, null=True) class Meta: db_table = 'project_details' ordering =…
2
votes
1 answer

Odoo multiple many2many or One2many fields on single model

I'm inheriting the project.project module where I've added multiple Many2many fields: 'Buyers', 'Sellers', 'Contacts', etc. All related to res.partner. Know when I add multiple records to one of the fields, for example add some buyers. These buyers…
Jesse
  • 727
  • 13
  • 44
2
votes
2 answers

Odoo 10 - How to hide a One2many field

I have a One2many field, and against the attrs I want to put something along the lines of - if this One2many is blank then hide it. The One2many is already auto populated from other objects, so all I need to do is set the invisible to something…
Palza
  • 642
  • 5
  • 12
1
vote
0 answers

ODOO 16 How to set current page number on One2many field on open form view

I have a wizard defined like this: class OrderLineSelectionWizard(models.TransientModel): _name = 'order.line.selection.wizard' _description = 'Wizard selezione prodotti' _rec_name = 'order_id' def…
1
vote
1 answer

Bulk Update One2Many odoo Just Change 1 data From API response

i create API with Odoo for consume in web apps, my problem it's when i bulk update from web apps which has form like this and From clint side i got response JSON like this [{"product_char": "A", "quantity": "1", "price_unit":…
Bian
  • 95
  • 2
  • 10
1
vote
1 answer

Context from One2many not updating

I'm kinda new to Odoo (working on Odoo 8), I made a wizard that has a one2many field, referring to another Transient Model I added a button inside the tree view that's supposed to display details of the line (each line has its button) when i get the…
BnsHm
  • 31
  • 5
1
vote
0 answers

How do I get values from a one2many field?

I have three models which are connected with each other. The first one is an inheriting of product.template (product_template.py) and as you see I have a one2many field which is connected to the second model showed in here. When I want to access…
Jugert Mucoimaj
  • 339
  • 1
  • 2
  • 14
1
2 3 4 5