This question has been flagged
2 Replies
7295 Views

Hello,

I've imported a fair number of quotations into Odoo.

Now I need to change the state (status) of 1800 of them from "Quotation" to "Sales". So I wanted to export the quotations, change their state in Excel, and reimport them.

Unfortunately, the export tool doesn't let me export the field "state". And the import tool won't let me reimport the file if I manually add a column "state" filled with "sales".

I guess that's because the field is defined as read-only.

Do you have any idea of the way I could change the state of these quotations with an import ?

Tahnks and best wishes

Avatar
Discard
Author Best Answer

Waleed, thanks for your answer.

It sounds a little too technical for me at this time, but I'll look into it and try the method suggested.

Thanks again!

Avatar
Discard
Best Answer

Hello,

The state field is read only and you will not see it in the available fields in import screen:

state = fields.Selection([
('draft', 'Quotation'),
('sent', 'Quotation Sent'),
('sale', 'Sales Order'),
('done', 'Locked'),
('cancel', 'Cancelled'),
], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')

My suggestion is to create a new module and override create method to confirm each quotation as below and after install the module, try to import your quotations. (I didn't test and I believe it will work and it's worth to give it a try in Test Environment and let us know the results) 

    @api.model
def create(self, vals):
result = super(SaleOrder, self).create(vals)
result.action_confirm()
return result 

 But you already imported them and you want to confirm them all to sale, you can create a module to override write method as below and after install the module, try to import your quotations. (I didn't test and I believe it will work and it's worth to give it a try in Test Environment and let us know the results) 

   @api.multi
   def write(self, values):
result = super(SaleOrder, self).write(values)
result.action_confirm()
return result
Avatar
Discard