I don't know if the title is properly correct.
I have a model called "web.support.ticket", it has a One2many field connected with "account.analytic.line" through analytic_timesheet_ids field.
Then, I have another model called "web.support.ticket.compose" this model is a wizard form, and it sends an email to some contacts. This model has a Many2one field connected with "web.support.ticket" through ticket_id field also.
"web.support.ticket.compose" also has a One2many field connected with "account.analytic.line" through analytic_timesheet_ids field.
My idea is that, whenever I edit some field in "account.analytic.line" from "web.support.ticket", this edits (or creation) will appear on "account.analytic.line" from "web.support.ticket.compose" AND VICE VERSA
I've tried using related fields, but the problem with that is that I cannot edit the related field.
Also, I've tried this:
def create(self, vals):
res = super(AccountAnalyticLine, self).create(vals)
if compose_id:
vals['ticket_id'] = compose_id
You can edit your related field if you set the readonly attribute to False:
analytic_timesheet_ids = fields.One2many(
comodel_name='account.analytic.line',
related='ticket_id.analytic_timesheet_ids',
readonly=False
)