You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
955 B

# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api, fields
class X2MDemo(models.Model):
_name = 'x2m.demo'
_description = 'X2Many Demo'
name = fields.Char()
line_ids = fields.One2many('x2m.demo.line', 'demo_id')
@api.multi
def open_x2m_matrix(self):
wiz = self.env['x2m.matrix.demo.wiz'].create({})
return {
'name': 'Try x2many 2D matrix widget',
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'x2m.matrix.demo.wiz',
'target': 'new',
'res_id': wiz.id,
'context': self.env.context,
}
class X2MDemoLine(models.Model):
_name = 'x2m.demo.line'
_description = 'X2Many Demo Line'
name = fields.Char()
demo_id = fields.Many2one('x2m.demo')
user_id = fields.Many2one('res.users')
value = fields.Integer()