def _action_cancel(self):
for move in self:
if move.created_purchase_line_id:
try:
activity_type_id = self.env.ref('mail.mail_activity_data_todo').id
except ValueError:
activity_type_id = False
self.env['mail.activity'].create({
'activity_type_id': activity_type_id,
'note': _('A sale order that generated this purchase order has been deleted. Check if an action is needed.'),
'user_id': move.created_purchase_line_id.product_id.responsible_id.id,
'res_id': move.created_purchase_line_id.order_id.id,
'res_model_id': self.env.ref('purchase.model_purchase_order').id,
})
return super(StockMove, self)._action_cancel()
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
You just need to inherit the object and override that method you want to.
class StockMove(models.Model):
_inherit = 'stock.move'
@api.multi
def _action_cancel(self):
# Your code goes here
return super(StockMove, self)._action_cancel()
i did't want all the function to override completely i just want to change a single line of code that defined in the parent class function
This way you can override the function, write your code. You need to call the super before / after your code.
If you want to change the existing line in the method, in this can you need to overwrite the whole method in your module and then change the code accrodingly.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up