suppose I have a model merchant and need to change the state field of the merchant.
I Created a wizard and a models.Transient which has a field state. now how can i change state in merchant model. wizard opens in form view of merchant.
class MerchantStatusUpdate(models.TransientModel):
_name = 'extended_ecommerce.merchant_state'
stateUpdate = fields.Selection([
("pending" , "Pending"),
("verified", "Verified"),
('accept', "Accept"),
('rejected', 'Rejected'),
], default='pending', string="State")
def setState(self):
return
***record xml is in the comment
<record id="merchant_status_update_form" model="ir.ui.view">
<field name="name">extended_ecommerce.merchant_state.name</field>
<field name="model">extended_ecommerce.merchant_state</field>
<field name="arch" type="xml">
<form string="State Update">
<group>
<field name="stateUpdate"/>
</group>
<footer>
<button name="setState" string="Set" />
</footer>
</form>
</field>
</record>
<record id="merchant_status_update" model="ir.actions.act_window">
<field name="name">State Update</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">extended_ecommerce.merchant_state</field>
<field name="view_mode">form</field>
<field name="view_id" ref="merchant_status_update_form"/>
<field name="target">new</field>
</record>
<button name="%(merchant_status_update)d" string="State" type="action" />