Skip to Content
Menu
This question has been flagged
1 Reply
1602 Views

I want to archiv product`s, but need always before to archiv the reording rule.

Is it not possible to auto archiv the reordering rules when archiv a product?


Odoo 10.0-20190523 (Community Edition)


Avatar
Discard
Best Answer

Hello,

You can write as following :

from odoo import models, fields, api
class ProductProduct(models.Model):
    _inherit="product.product"

    @api.multi
    def write(self,vals):
        if 'active' in vals and not vals['active']:
            self.mapped('orderpoint_ids').filtered(lambda r: r.active).write({'active':False})
        result = super(ProductProduct,self).write(vals)
return result


Avatar
Discard
Author

Hello Mital,

many thanks for your reply ... unfortunately I´m not familiar with the odoo programming.

I programming in SQL, Java and medium skill in web.

Maybe you have a small instruction, where I have to put the code? Do I need to write a new module?

Thank you!

If you already have any custom module then you can add it in that module or you can create new mdoule.

In file you need to write as like above.

Install module if it's not installed or restart Odoo, upgrade module