blob: 1167347531407843f34fa226bdf8c73da8f36c6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
@api.onchange('type')
def _onchange_type(self):
""" We want to prevent storable product to be expensed, since it make no sense as when confirm
expenses, the product is already out of our stock.
"""
res = super(ProductTemplate, self)._onchange_type()
if self.type == 'product':
self.expense_policy = 'no'
self.service_type = 'manual'
return res
|