hello, I would like to save the changes in the wizard. When I change the date of my wizard and validate, the dates do not change. What i put in my wizard.py ?
xml wizard :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="change_date_expense_sheet_form" model="ir.ui.view">
<field name="name">Change date expense sheet</field>
<field name="model">edit.date.expense.sheet.wizard</field>
<field name="priority">1</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Change Date Expense Sheet">
<sheet>
<group >
<field name="validation_date"/>
</group>
</sheet>
<footer>
<button string="Validate" class="oe_highlight" type="object" name="validate_modifications"/>
<button string="Cancel" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="change_expense_sheet_action" model="ir.actions.act_window">
<field name="name">Change Date Expense Sheet</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">edit.date.expense.sheet.wizard</field>
<field name="view_type">form</field>
<field name="view_id" ref="rp_hr.change_date_expense_sheet_form"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</odoo>
python :
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
class EditDateExpenseSheetWizard(models.TransientModel):
_name = 'edit.date.expense.sheet.wizard'
validation_date = fields.Date(string="New validation date")
@api.multi
def validate_modifications(self):
self.ensure_one()
print "validate_modifications"
return {'type': 'ir.actions.act_window.close'}
Tanks a lot.