Closed chermed closed 8 years ago
Inspiring from Rails model's generator,
If we type in the fields questions :
user_id:Responsable:compute:store:inverse name:required date:date:readonly description:text:required:compute:store:readonly:invisible:nolist:notree user_res_id:required:res.users:::me, type sequence:noform state:drat,confirm,done,cancel date_creation:today,:date:search company_id:company, product_id:nocopy:translate
We will get :
`
@api.multi @api.depends() #TODO def _compute_user_id(self): for obj in self: obj.user_id = False #TODO @api.one def _inverse_user_id(self): if self.user_id: pass #TODO user_id = fields.Many2one('res.users', string='Responsable', store=False, compute='_compute_user_id', inverse='_inverse_user_id', ) user_res_id = fields.Many2many('res.users', string='User_res_id', required=True, default=lambda self: self.env.user, ) sequence = fields.Integer(string='Sequence', ) @api.multi @api.depends() #TODO def _compute_description(self): for obj in self: obj.description = False #TODO description = fields.Text(string='Description', readonly=True, required=True, store=True, compute='_compute_description', ) company_id = fields.Many2one('res.company', string='Company_id', default=lambda self: self.env.user.company_id, ) state = fields.Selection([(u'drat', u'Drat'), (u'confirm', u'Confirm'), (u'done', u'Done'), (u'cancel', u'Cancel')], string='State', readonly=True, default='drat', ) product_id = fields.Many2one('product.product', string='Product_id', copy=False, translate=True, ) date = fields.Date(string='Date', readonly=True, ) type = fields.Char(string='Type', ) date_creation = fields.Date(string='Date_creation', default=lambda self: fields.Date.today(), ) name = fields.Char(string='Name', required=True, )
If accepted, I will make a mini documentation on how to use it 🎱
Inspiring from Rails model's generator,
If we type in the fields questions :
user_id:Responsable:compute:store:inverse name:required date:date:readonly description:text:required:compute:store:readonly:invisible:nolist:notree user_res_id:required:res.users:::me, type sequence:noform state:drat,confirm,done,cancel date_creation:today,:date:search company_id:company, product_id:nocopy:translate
We will get :
`
`
If accepted, I will make a mini documentation on how to use it 🎱