Enterprise PR - odoo/enterprise#23980 Upgrade PR - odoo/enterprise#3206 - UI improvements/changes - Taxes Before this commit, in case taxes were defined on expense, the tax amount was added on top of a product price. For example, in case product price was 100$, and tax - 15%, then expense.total_amount would be 115$. Now, tax amount is included in expense.total_amount. To accommodate this change, we set following domain - ('price_include', '=', True) on tax_ids on expense. For the same example, expense.total_amount would be 100$, tax amount would be 13.04$ and untaxed amount - 86.96$. But, tax amount can be set for non-zero expenses (in case expense.product_id.standard_price !=0). For the above example, one could set tax amount to 15$. As a result untaxed amount will be 85$ and total amount - 1OO$. - Journal entry Previously, in case journal entry was reset to draft, canceled, reversed - it changed the state of the linked expense report. Now, actions done on accounting by accountant does not impact expense reports. task - 2687999 closes odoo/odoo#81904 Related: odoo/upgrade#3206 Signed-off-by: Kevin Baptiste <kba@odoo.com>
23 lines
829 B
Python
23 lines
829 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"
|
|
|
|
@api.model
|
|
def default_get(self, fields):
|
|
result = super(ProductTemplate, self).default_get(fields)
|
|
if self.env.context.get('default_can_be_expensed'):
|
|
result['supplier_taxes_id'] = False
|
|
return result
|
|
|
|
can_be_expensed = fields.Boolean(string="Can be Expensed", compute='_compute_can_be_expensed',
|
|
store=True, readonly=False, help="Specify whether the product can be selected in an expense.")
|
|
|
|
@api.depends('type')
|
|
def _compute_can_be_expensed(self):
|
|
self.filtered(lambda p: p.type not in ['consu', 'service']).update({'can_be_expensed': False})
|