flectra/addons/hr_expense/models/product_template.py
flectra-admin 769eafb483 [INIT] Inception of Flectra from Odoo
Flectra is Forked from Odoo v11 commit : (6135e82d73)
2018-01-16 11:45:59 +05:30

19 lines
648 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo 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)