Thank you in advance.
What I have:
- A module with a list of values with their descriptions.
- A module with a list of features with their descriptions.
I want to make:
A class module in which the user can pair in a table one feature with a value.
The end goal would actually be to have in the same row a feature and all the values for that feature. I don't mind if I only get one value per row and need to enter the same feature multiples times for each value.
What I did:
Make a temporal module in which I have two many2one variables, one for each field (one for the feature and another-one for the value)
Create a many2many field in my class module and display it.
What I get:
The form :
When I click on "add an item" :
What I know:
I think I should be able to easily make what I want but I tried to use inside my view and it doesn't work.
What I want to know:
How can I make a many2many field editable as if it was in a tree view ? That is to say, when I click on "add an item", an empty row is added, and then the user can fill the fields while staying on the form view.
If possible, how can I make it so I can set several values for the same feature ?
Code:
class Classes(models.Model):
_name = 'sync2ba.etim.classes'
name = fields.Char(string="Title", required=True)
code = fields.Char(stCharring="Code")
version = fields.Integer(string="Version")
description = fields.Char(string="Description")
featurecode = fields.Char(string="FeatureCode")
status = fields.Char(string="Status")
groupcode = fields.Char(string="GroupCode")
relationships = fields.Many2many("sync2ba.etim.relationships", string="Features")
class Relationships(models.Model):
_name = 'sync2ba.etim.relationships'
name = fields.Char(string="Title", required=True)
relationships_features = fields.Many2one("sync2ba.etim.features", ondelete='set null', string="relationships_features", index=True)
relationships_value = fields.Many2one("sync2ba.etim.values", ondelete='set null', string="relationships_value", index=True)
class Features(models.Model):
_name = 'sync2ba.etim.features'
name = fields.Char(string="Title", required=True)
code = fields.Char(string="Code")
description = fields.Char(string="Description")
type = fields.Char(string="Type")
class Values(models.Model):
_name = 'sync2ba.etim.values'
name = fields.Char(string="Title", required=True)
code = fields.Char(string="Code")
description = fields.Char(string="Description")
sync2ba.etim.relationships
. The strings don't match with the strings defined in the model, so they're probably overriden in your view. I'm a bit confused when you way you want to get rid of the the second view, but in your last sentence you say you "should be able to select those items and a pop up". Is the popup to add a new item in the table intended or not ? – Unatiel