flectra/addons/hr_expense/models/product_template.py

19 lines
660 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-01-16 11:34:37 +01:00
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
2018-01-16 11:34:37 +01:00
from flectra import api, fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
can_be_expensed = fields.Boolean(help="Specify whether the product can be selected in an HR expense.", string="Can be Expensed")
@api.model
def create(self, vals):
# When creating an expense product on the fly, you don't expect to
# have taxes on it
if vals.get('can_be_expensed', False):
vals.update({'supplier_taxes_id': False})
return super(ProductTemplate, self).create(vals)