diff options
| author | Goffin Simon <sig@odoo.com> | 2016-04-21 09:50:10 +0200 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2016-04-21 10:21:27 +0200 |
| commit | 0287c1e1b34a14300dcf7ef9ffddf160b61631ee (patch) | |
| tree | fd652a7de0d8febcd5a86c3e551e8e7ae9453262 | |
| parent | 8388b12b1e53e641887347630cf0c009dfd1e93b (diff) | |
[FIX] account_asset: deferred_revenue_category_id and asset_category_id
When creating an customer invoice with a product linked to a deferred revenue
category, the account used in the invoice line must be the account_asset_id.
When creating an vendor bill with a product linked to an asset
category, the account used in the invoice line must be the account_depreciation_id.
opw:22157
| -rw-r--r-- | addons/account_asset/account_asset_invoice.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/account_asset/account_asset_invoice.py b/addons/account_asset/account_asset_invoice.py index 45c95af7fca..88027ca8125 100644 --- a/addons/account_asset/account_asset_invoice.py +++ b/addons/account_asset/account_asset_invoice.py @@ -90,3 +90,13 @@ class ProductTemplate(models.Model): _inherit = 'product.template' asset_category_id = fields.Many2one('account.asset.category', string='Asset Type', ondelete="restrict") deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', ondelete="restrict") + + @api.onchange('deferred_revenue_category_id') + def onchange_deferred_revenue(self): + if self.deferred_revenue_category_id: + self.property_account_income_id = self.deferred_revenue_category_id.account_asset_id + + @api.onchange('asset_category_id') + def onchange_asset(self): + if self.asset_category_id: + self.property_account_expense_id = self.asset_category_id.account_asset_id |
