2018-01-16 06:58:15 +01:00
|
|
|
# -*- 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 06:58:15 +01:00
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, fields, models
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ProductTemplate(models.Model):
|
|
|
|
_inherit = 'product.template'
|
|
|
|
|
2018-08-02 11:19:29 +02:00
|
|
|
asset_category_id = fields.Many2one('account.asset.category', string='Asset Category', company_dependent=True, ondelete="restrict")
|
2018-01-16 06:58:15 +01:00
|
|
|
deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', company_dependent=True, ondelete="restrict")
|
|
|
|
|
|
|
|
@api.multi
|
|
|
|
def _get_asset_accounts(self):
|
|
|
|
res = super(ProductTemplate, self)._get_asset_accounts()
|
|
|
|
if self.asset_category_id:
|
|
|
|
res['stock_input'] = self.property_account_expense_id
|
|
|
|
if self.deferred_revenue_category_id:
|
|
|
|
res['stock_output'] = self.property_account_income_id
|
|
|
|
return res
|