Skip to Content
Menu
This question has been flagged
2 Replies
2415 Views

I want to save popup view "cancelreason text field" in site.survey module don't want create new table.

please review my code how is it possible.


class site_survey(models.Model):

    _name = 'site.survey'

    name = fields.Char(readonly=True)

    @api.multi

    def action_cancel(self):

       # self.state = 'cancel'

        return {

            'name': ('Assignment Sub'),

            'view_type': 'form',

            'view_mode': 'form',

            'res_model': 'site.survey.cancel',

            'view_id': False,

            'type': 'ir.actions.act_window',

            'target': 'new'

        }

class site.survey.cancel(models.Model):

    _inherit = 'site.survey.cancel'

    cancelreason = fields.Char('Cancel Reason')

Avatar
Discard
Author Best Answer

how i pass  form's Id using context to the wizard??

Avatar
Discard

When returning your wizard add 'context' : your_context.

for more details refer this link https://www.odoo.com/forum/help-1/question/what-s-the-context-2236

Best Answer

Hi,

If you don't want to save values in site.survey.cancel then make it transient model(models.Transientmodel).

Create a text field for cancel reason in site.survey also. Then when clicking the cancel button pass the form's Id using context to the wizard. And just give a confirm button in wizard, when clicking on the confirm button save the reason to site.survey

Avatar
Discard