opportunity.py
class Opportunity(models.Model):
_inherit = "crm.lead"
@api.multi
def action_set_won(self, context=None):
return {
'name': _('Project Confirmations'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'crm.won',
'target': 'new',
'context': {'opportunity_id': self.id}
}
wizard.py
from openerp import models, fields, api
class crm_won(models.TransientModel):
_name = 'crm.won'
def _get_all_quotations(self):
return self.env['sale.order'].browse(self.env.context.get('opportunity_id'))
quotation_ids = fields.Many2one('sale.order', string='Quotations', default=_get_all_quotations)
update_quotation = fields.Selection([('yes', 'YES'), ('no', 'NO')], string='Update Quotation Stage')
opportunity_id = fields.Many2one('crm.lead',string='opportunity')
@api.multi
def update_opportunity(self):
for record in self:
if self.env['crm.lead'].search([('opportunity_id','=',self.opportunity_id)]):
quotation_ids
if record.update_quotation == "YES":
for quotation in quotation_ids:
quotation.state = "Done"
Please help me. I'm not getting the current record id in the wizard py file. Using this wizard I need to change the corresponding quotation to the done stage. How did i need to change my code?
An idea: http://learnopenerp.blogspot.com/2018/08/get-current-logged-in-user-id-in-odoo.html
for quotation in quotation_ids:
quotation.state = "Done"
I want to update quotation state to Done. but above code piece is not working. plz correct me.