Merge branch 'master-account-asset-fiscal' into 'master'

[ADD] Account Asset Feature

See merge request flectra-hq/flectra!119
This commit is contained in:
Parthiv Patel 2018-08-02 11:37:56 +00:00
commit 5289377d4d
36 changed files with 1513 additions and 144 deletions

View File

@ -4,7 +4,7 @@
{
'name': 'Assets Management',
'author': 'Odoo S.A',
'depends': ['account'],
'depends': ['account_invoicing'],
'description': """
Assets management
=================
@ -22,14 +22,19 @@ Keeps track of depreciations, and creates corresponding journal entries.
'security/account_asset_security.xml',
'security/ir.model.access.csv',
'wizard/asset_depreciation_confirmation_wizard_views.xml',
'data/account_asset_data.xml',
'wizard/asset_modify_views.xml',
'wizard/sale_asset_wizard_view.xml',
'wizard/asset_depreciation_summary_wizard_view.xml',
'views/account_asset_views.xml',
'views/account_invoice_views.xml',
'views/account_asset_templates.xml',
'views/product_views.xml',
'views/res_config_settings_views.xml',
'report/account_asset_report_views.xml',
'data/account_asset_data.xml',
'report/report_paperformat.xml',
'report/asset_reports.xml',
'report/asset_depreciation_report_template.xml',
'report/account_asset_report_views.xml'
],
'qweb': [
"static/src/xml/account_asset_template.xml",

View File

@ -49,7 +49,7 @@
}
self._update('account.asset.asset', 'account_asset', vals, 'account_asset_asset_cab0')
vals = {
'prorata': 1,
'prorata': 'purchase_date',
'salvage_value': 100000.0,
'state': 'open',
'method_period': 12,
@ -60,3 +60,28 @@
'category_id': ref('account_asset_category_fixedassets0'),
}
self._update('account.asset.asset', 'account_asset', vals, 'account_asset_asset_office0')
product_id = ref('product.consu_delivery_03')
vals = {
'journal_id': journal_id,
'name': 'Electronics',
'method_period': 12,
'method_number': 6,
'account_asset_id': xfa_account_id,
'account_depreciation_id': xfa_account_id,
'account_depreciation_expense_id': expense_account_id,
'prorata': 'fiscal_year',
}
self._update('account.asset.category', 'account_asset', vals, 'account_asset_category_electronics')
vals = {
'prorata': 'fiscal_year',
'product_id': product_id,
'salvage_value': 1000.0,
'state': 'open',
'method_period': 12,
'method_number': 6,
'date': time.strftime('%Y-01-01'),
'name': 'Basic Computer',
'value': 25000.0,
'category_id': ref('account_asset_category_electronics'),
}
self._update('account.asset.asset', 'account_asset', vals, 'account_asset_asset_electronics')

View File

@ -1,13 +1,13 @@
# Translation of Odoo Server.
# Translation of Flectra Server.
# This file contains the translation of the following modules:
# * account_asset
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Flectra Server 1.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-30 13:11+0000\n"
"PO-Revision-Date: 2017-11-30 13:11+0000\n"
"POT-Creation-Date: 2018-08-02 07:12+0000\n"
"PO-Revision-Date: 2018-08-02 07:12+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -16,13 +16,13 @@ msgstr ""
"Plural-Forms: \n"
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:404
#: code:addons/account_asset/models/account_asset.py:496
#, python-format
msgid " (copy)"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:540
#: code:addons/account_asset/models/account_asset.py:651
#, python-format
msgid " (grouped)"
msgstr ""
@ -42,6 +42,16 @@ msgstr ""
msgid "# of Installment Lines"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "<strong>End Date:</strong>"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "<strong>Start Date:</strong>"
msgstr ""
#. module: account_asset
#: model:ir.actions.server,name:account_asset.account_asset_cron_ir_actions_server
#: model:ir.cron,cron_name:account_asset.account_asset_cron
@ -75,7 +85,7 @@ msgid "Account used to record the purchase of the asset at its original price."
msgstr ""
#. module: account_asset
#. openerp-web
#. flectra-web
#: code:addons/account_asset/static/src/js/account_asset.js:52
#, python-format
msgid "Accounting entries waiting for manual verification"
@ -87,13 +97,18 @@ msgstr ""
msgid "Active"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "Additional"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "Additional Options"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:597
#: code:addons/account_asset/models/account_asset.py:708
#, python-format
msgid "Amount"
msgstr ""
@ -115,7 +130,14 @@ msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_asset_id
#: model:ir.model.fields,field_description:account_asset.field_account_invoice_asset_bool
#: model:ir.model.fields,field_description:account_asset.field_account_invoice_asset_id
#: model:ir.model.fields,field_description:account_asset.field_account_invoice_line_asset_bool
#: model:ir.model.fields,field_description:account_asset.field_account_invoice_line_asset_id
#: model:ir.model.fields,field_description:account_asset.field_account_move_asset_id
#: model:ir.model.fields,field_description:account_asset.field_account_move_line_asset_id
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_asset_id
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_asset_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
#: model:ir.ui.view,arch_db:account_asset.view_asset_asset_report_search
@ -129,12 +151,45 @@ msgid "Asset Account"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_list_normal_purchase
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_list_normal_purchase
#: model:ir.ui.view,arch_db:account_asset.res_config_settings_view_form
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "Asset Categories"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_name
#: model:ir.model.fields,field_description:account_asset.field_account_invoice_line_asset_category_id
#: model:ir.model.fields,field_description:account_asset.field_product_product_asset_category_id
#: model:ir.model.fields,field_description:account_asset.field_product_template_asset_category_id
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_asset_category_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
#: model:ir.ui.view,arch_db:account_asset.view_asset_asset_report_search
#: model:ir.ui.view,arch_db:account_asset.view_invoice_asset_category
msgid "Asset Category"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "Asset Depreciation"
msgstr ""
#. module: account_asset
#: model:ir.actions.report,name:account_asset.asset_depreciation_report
msgid "Asset Depreciation Report"
msgstr ""
#. module: account_asset
#: model:ir.ui.menu,name:account_asset.asset_depreciation_summary_report_menu
msgid "Asset Depreciation Summary"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.asset_depreciation_summary_report_action
msgid "Asset Depreciation Summary Report"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_modify_form
msgid "Asset Durations to Modify"
@ -145,6 +200,11 @@ msgstr ""
msgid "Asset End Date"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_asset_ids
msgid "Asset Line"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_asset_method_time
msgid "Asset Method Time"
@ -152,6 +212,7 @@ msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_name
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "Asset Name"
msgstr ""
@ -160,21 +221,6 @@ msgstr ""
msgid "Asset Start Date"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_name
#: model:ir.model.fields,field_description:account_asset.field_product_product_asset_category_id
#: model:ir.model.fields,field_description:account_asset.field_product_template_asset_category_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "Asset Type"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_list_normal_purchase
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_list_normal_purchase
#: model:ir.ui.view,arch_db:account_asset.res_config_settings_view_form
msgid "Asset Types"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_account_asset_category
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_asset_category_id
@ -184,7 +230,7 @@ msgid "Asset category"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:286
#: code:addons/account_asset/models/account_asset.py:378
#, python-format
msgid "Asset created"
msgstr ""
@ -195,7 +241,7 @@ msgid "Asset depreciation line"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:318
#: code:addons/account_asset/models/account_asset.py:410
#, python-format
msgid "Asset sold or disposed. Accounting entry awaiting for validation."
msgstr ""
@ -209,6 +255,7 @@ msgstr ""
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_form
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_form
#: model:ir.ui.menu,name:account_asset.menu_action_asset_asset_report
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_purchase_tree
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_search
msgid "Assets"
@ -259,15 +306,27 @@ msgid "Auto-confirm Assets"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_begin_value
msgid "Beginning Value"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_summary_report_form_view
#: model:ir.ui.view,arch_db:account_asset.asset_modify_form
#: model:ir.ui.view,arch_db:account_asset.asset_sale_form_view
#: model:ir.ui.view,arch_db:account_asset.view_asset_depreciation_confirmation_wizard
msgid "Cancel"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Cancel Entry"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_category_id
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_search
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
msgid "Category"
msgstr ""
@ -296,6 +355,12 @@ msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_asset_method_time
msgid "Choose the method to use to compute the dates and number of depreciation lines.\n"
" * Number of Depreciation lines: Fix the number of depreciation lines and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."
msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_category_method_time
msgid "Choose the method to use to compute the dates and number of entries.\n"
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n"
@ -318,6 +383,11 @@ msgstr ""
msgid "Closed"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "Closing Balance"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_company_id
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_company_id
@ -343,6 +413,7 @@ msgid "Compute Depreciation"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_sale_form_view
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Confirm"
msgstr ""
@ -364,7 +435,9 @@ msgstr ""
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_create_uid
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_create_uid
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard_create_uid
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_create_uid
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_create_uid
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_create_uid
msgid "Created by"
msgstr ""
@ -373,7 +446,9 @@ msgstr ""
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_create_date
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_create_date
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard_create_date
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_create_date
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_create_date
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_create_date
msgid "Created on"
msgstr ""
@ -383,7 +458,7 @@ msgid "Cumulative Depreciation"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:597
#: code:addons/account_asset/models/account_asset.py:708
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_currency_id
#, python-format
msgid "Currency"
@ -399,9 +474,20 @@ msgstr ""
msgid "Current Depreciation"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_partner_id
msgid "Customer"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Customer Invoice"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_date
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_date
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_sale_date
msgid "Date"
msgstr ""
@ -451,6 +537,17 @@ msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Dep. Entries"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_depreciated_amount
msgid "Depreciated Amount"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Depreciation"
msgstr ""
@ -513,7 +610,7 @@ msgid "Depreciation board modified"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:600
#: code:addons/account_asset/models/account_asset.py:711
#, python-format
msgid "Depreciation line posted."
msgstr ""
@ -524,24 +621,27 @@ msgstr ""
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_display_name
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_display_name
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard_display_name
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_display_name
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_display_name
#: model:ir.model.fields,field_description:account_asset.field_report_account_asset_asset_depreciation_template_display_name
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_display_name
msgid "Display Name"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:327
#: code:addons/account_asset/models/account_asset.py:419
#, python-format
msgid "Disposal Move"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:330
#: code:addons/account_asset/models/account_asset.py:422
#, python-format
msgid "Disposal Moves"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:579
#: code:addons/account_asset/models/account_asset.py:690
#, python-format
msgid "Document closed."
msgstr ""
@ -553,6 +653,11 @@ msgstr ""
msgid "Draft"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_end_date
msgid "End Date"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,method_time:0
#: selection:account.asset.category,method_time:0
@ -571,6 +676,24 @@ msgstr ""
msgid "Extended Filters..."
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,prorata:0
#: selection:account.asset.category,prorata:0
msgid "First of January"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,prorata:0
#: selection:account.asset.category,prorata:0
msgid "Fiscal Year"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,prorata:0
#: selection:account.asset.category,prorata:0
msgid "From the Purchase Date"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,help:account_asset.action_asset_asset_report
msgid "From this report, you can have an overview on all depreciations. The\n"
@ -624,22 +747,28 @@ msgstr ""
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_id
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_id
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard_id
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_id
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_id
#: model:ir.model.fields,field_description:account_asset.field_report_account_asset_asset_depreciation_template_id
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_id
msgid "ID"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_asset_prorata
msgid "Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January / Start date of fiscal year"
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
msgid "Inactive"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_asset_prorata
#: model:ir.model.fields,help:account_asset.field_account_asset_category_prorata
msgid "Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first of January"
msgid "Indicates that the first depreciation entry for this asset have to be done from the purchase date or first of January or fiscal year"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_account_invoice
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_customer_invoice_count
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_invoice_count
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_invoice_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Invoice"
@ -650,35 +779,45 @@ msgstr ""
msgid "Invoice Line"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/wizard/sale_asset_wizard.py:178
#, python-format
msgid "Invoices"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_asset_salvage_value
msgid "It is the amount you plan to have that you cannot depreciate."
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Items"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_journal_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "Journal"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:438
#: code:addons/account_asset/models/account_asset.py:530
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
#, python-format
msgid "Journal Entries"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_account_move_line
msgid "Journal Item"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset___last_update
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category___last_update
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line___last_update
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report___last_update
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard___last_update
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard___last_update
#: model:ir.model.fields,field_description:account_asset.field_asset_modify___last_update
#: model:ir.model.fields,field_description:account_asset.field_report_account_asset_asset_depreciation_template___last_update
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard___last_update
msgid "Last Modified on"
msgstr ""
@ -687,7 +826,9 @@ msgstr ""
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_write_uid
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_write_uid
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard_write_uid
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_write_uid
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_write_uid
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_write_uid
msgid "Last Updated by"
msgstr ""
@ -696,7 +837,9 @@ msgstr ""
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_write_date
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_write_date
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_confirmation_wizard_write_date
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_write_date
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_write_date
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_write_date
msgid "Last Updated on"
msgstr ""
@ -743,12 +886,19 @@ msgstr ""
msgid "Next Period Depreciation"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/report/asset_depreciation_report.py:30
#, python-format
msgid "No Depreciation Lines in this fiscal year.."
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_note
msgid "Note"
msgstr ""
#. module: account_asset
#: selection:account.asset.category,method_time:0
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_method_number
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_method_number
#: model:ir.model.fields,field_description:account_asset.field_asset_modify_method_number
@ -757,8 +907,6 @@ msgstr ""
#. module: account_asset
#: selection:account.asset.asset,method_time:0
#: selection:account.asset.category,method_time:0
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "Number of Entries"
msgstr ""
@ -773,9 +921,20 @@ msgid "One Entry Every"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:599
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "Opening"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "Other Information"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:710
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_partner_id
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_partner_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
#, python-format
msgid "Partner"
msgstr ""
@ -797,7 +956,7 @@ msgid "Post Depreciation Lines"
msgstr ""
#. module: account_asset
#. openerp-web
#. flectra-web
#: code:addons/account_asset/static/src/js/account_asset.js:49
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_move_posted_check
#: model:ir.model.fields,field_description:account_asset.field_asset_asset_report_move_check
@ -816,6 +975,18 @@ msgstr ""
msgid "Posted depreciation lines"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_summary_report_form_view
msgid "Print"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_product_id
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_product_id
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
msgid "Product"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_product_template
msgid "Product Template"
@ -824,11 +995,11 @@ msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_prorata
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_prorata
msgid "Prorata Temporis"
msgid "Prorata"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:370
#: code:addons/account_asset/models/account_asset.py:462
#, python-format
msgid "Prorata temporis can be applied only for time method \"number of depreciations\"."
msgstr ""
@ -868,6 +1039,11 @@ msgstr ""
msgid "Reference"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_remaining_asset_value
msgid "Remaining Asset Value"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Residual"
@ -885,6 +1061,38 @@ msgstr ""
msgid "Running"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_depreciation_line_product_id
msgid "SID"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.asset_sale_action
msgid "Sale"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_sale_date
msgid "Sale Date"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_sale_asset_wizard_sale_value
msgid "Sale Value"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/wizard/sale_asset_wizard.py:71
#, python-format
msgid "Sale date must be greater than Date of Asset!"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/wizard/sale_asset_wizard.py:68
#, python-format
msgid "Sale date must be greater than last Depreciated date!"
msgstr ""
#. module: account_asset
#: selection:account.asset.category,type:0
msgid "Sale: Revenue Recognition"
@ -920,6 +1128,16 @@ msgstr ""
msgid "Set to Draft"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_asset_depreciation_wizard_start_date
msgid "Start Date"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_search
msgid "State"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_category_method_period
msgid "State here the time between 2 depreciations, in months"
@ -948,17 +1166,11 @@ msgid "The number of depreciations needed to depreciate your asset"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_invoice.py:62
#: code:addons/account_asset/models/account_invoice.py:68
#, python-format
msgid "The number of depreciations or the period length of your asset category cannot be null."
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:482
#, python-format
msgid "This depreciation is already linked to a journal entry! Please post or delete it."
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_asset_depreciation_confirmation_wizard
msgid "This wizard will post installment/depreciation lines for the selected month.<br/>\n"
@ -977,6 +1189,11 @@ msgstr ""
msgid "Time Method Based On"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.asset_depreciation_template
msgid "Total"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,field_description:account_asset.field_account_asset_asset_type
#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_type
@ -985,7 +1202,7 @@ msgid "Type"
msgstr ""
#. module: account_asset
#. openerp-web
#. flectra-web
#: code:addons/account_asset/static/src/js/account_asset.js:55
#, python-format
msgid "Unposted"
@ -1002,6 +1219,11 @@ msgstr ""
msgid "Vendor"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_asset_form
msgid "Vendor Invoice"
msgstr ""
#. module: account_asset
#: model:ir.model.fields,help:account_asset.field_account_asset_asset_state
#: model:ir.model.fields,help:account_asset.field_account_asset_depreciation_line_parent_state
@ -1016,25 +1238,25 @@ msgid "Year"
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:111
#: code:addons/account_asset/models/account_asset.py:185
#, python-format
msgid "You cannot delete a document is in %s state."
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:114
#: code:addons/account_asset/models/account_asset.py:188
#, python-format
msgid "You cannot delete a document that contains posted entries."
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:608
#: code:addons/account_asset/models/account_asset.py:719
#, python-format
msgid "You cannot delete posted depreciation lines."
msgstr ""
#. module: account_asset
#: code:addons/account_asset/models/account_asset.py:610
#: code:addons/account_asset/models/account_asset.py:721
#, python-format
msgid "You cannot delete posted installment lines."
msgstr ""
@ -1044,6 +1266,11 @@ msgstr ""
msgid "asset.depreciation.confirmation.wizard"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_asset_depreciation_wizard
msgid "asset.depreciation.wizard"
msgstr ""
#. module: account_asset
#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form
msgid "e.g. Computers"
@ -1060,3 +1287,13 @@ msgstr ""
msgid "months"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_report_account_asset_asset_depreciation_template
msgid "report.account_asset.asset_depreciation_template"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_sale_asset_wizard
msgid "sale.asset.wizard"
msgstr ""

View File

@ -8,6 +8,7 @@ class AccountMove(models.Model):
_inherit = 'account.move'
asset_depreciation_ids = fields.One2many('account.asset.depreciation.line', 'move_id', string='Assets Depreciation Lines', ondelete="restrict")
asset_id = fields.Many2one('account.asset.asset', string="Asset")
@api.multi
def button_cancel(self):
@ -22,3 +23,9 @@ class AccountMove(models.Model):
for depreciation_line in move.asset_depreciation_ids:
depreciation_line.post_lines_and_close_asset()
return super(AccountMove, self).post()
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
asset_id = fields.Many2one(related='move_id.asset_id', string="Asset")

View File

@ -16,7 +16,7 @@ class AccountAssetCategory(models.Model):
_description = 'Asset category'
active = fields.Boolean(default=True)
name = fields.Char(required=True, index=True, string="Asset Type")
name = fields.Char(required=True, index=True, string="Asset Category")
account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
account_asset_id = fields.Many2one('account.account', string='Asset Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)], help="Account used to record the purchase of the asset at its original price.")
account_depreciation_id = fields.Many2one('account.account', string='Depreciation Entries: Asset Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)], help="Account used in the depreciation entries, to decrease the asset value.")
@ -30,15 +30,20 @@ class AccountAssetCategory(models.Model):
method_number = fields.Integer(string='Number of Depreciations', default=5, help="The number of depreciations needed to depreciate your asset")
method_period = fields.Integer(string='Period Length', default=1, help="State here the time between 2 depreciations, in months", required=True)
method_progress_factor = fields.Float('Degressive Factor', default=0.3)
method_time = fields.Selection([('number', 'Number of Entries'), ('end', 'Ending Date')], string='Time Method', required=True, default='number',
method_time = fields.Selection([('number', 'Number of Depreciations'), ('end', 'Ending Date')], string='Time Method', required=True, default='number',
help="Choose the method to use to compute the dates and number of entries.\n"
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
method_end = fields.Date('Ending date')
prorata = fields.Boolean(string='Prorata Temporis', help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first of January')
prorata = fields.Selection([('first_january', 'First of January'),
('purchase_date', 'From the Purchase Date'),
('fiscal_year', 'Fiscal Year')],
help='Indicates that the first depreciation entry for this asset have to be done from the purchase date or first of January or fiscal year')
open_asset = fields.Boolean(string='Auto-confirm Assets', help="Check this if you want to automatically confirm the assets of this category when created by invoices.")
group_entries = fields.Boolean(string='Group Journal Entries', help="Check this if you want to group the generated entries by categories.")
type = fields.Selection([('sale', 'Sale: Revenue Recognition'), ('purchase', 'Purchase: Asset')], required=True, index=True, default='purchase')
asset_ids = fields.One2many('account.asset.asset', 'category_id',
string='Asset Line')
@api.onchange('account_asset_id')
def onchange_account_asset(self):
@ -50,7 +55,7 @@ class AccountAssetCategory(models.Model):
@api.onchange('type')
def onchange_type(self):
if self.type == 'sale':
self.prorata = True
self.prorata = 'purchase_date'
self.method_period = 1
else:
self.method_period = 12
@ -58,7 +63,12 @@ class AccountAssetCategory(models.Model):
@api.onchange('method_time')
def _onchange_method_time(self):
if self.method_time != 'number':
self.prorata = False
self.prorata = 'first_january'
@api.onchange('prorata')
def onchange_prorata(self):
if self.prorata == 'fiscal_year':
self.method_period = 12
class AccountAssetAsset(models.Model):
@ -83,6 +93,12 @@ class AccountAssetAsset(models.Model):
"You can manually close an asset when the depreciation is over. If the last line of depreciation is posted, the asset automatically goes in that status.")
active = fields.Boolean(default=True)
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True, states={'draft': [('readonly', False)]})
product_id = fields.Many2one('product.product', string='Product',
track_visibility='onchange')
invoice_count = fields.Integer(string="Invoice",
compute="count_invoice")
remaining_asset_value = fields.Float(string="Remaining Asset Value",
compute="get_remaining_value")
method = fields.Selection([('linear', 'Linear'), ('degressive', 'Degressive')], string='Computation Method', required=True, readonly=True, states={'draft': [('readonly', False)]}, default='linear',
help="Choose the method to use to compute the amount of depreciation lines.\n * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n"
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor")
@ -92,17 +108,75 @@ class AccountAssetAsset(models.Model):
method_end = fields.Date(string='Ending Date', readonly=True, states={'draft': [('readonly', False)]})
method_progress_factor = fields.Float(string='Degressive Factor', readonly=True, default=0.3, states={'draft': [('readonly', False)]})
value_residual = fields.Float(compute='_amount_residual', method=True, digits=0, string='Residual Value')
method_time = fields.Selection([('number', 'Number of Entries'), ('end', 'Ending Date')], string='Time Method', required=True, readonly=True, default='number', states={'draft': [('readonly', False)]},
help="Choose the method to use to compute the dates and number of entries.\n"
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n"
method_time = fields.Selection([('number', 'Number of Entries'), ('end', 'Ending Date')], string='Time Method', required=True, readonly=True, default='number', states={'draft': [('readonly', False)]}, track_visibility='onchange',
help="Choose the method to use to compute the dates and number of depreciation lines.\n"
" * Number of Depreciation lines: Fix the number of depreciation lines and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
prorata = fields.Boolean(string='Prorata Temporis', readonly=True, states={'draft': [('readonly', False)]},
help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January / Start date of fiscal year')
sale_date = fields.Date(string='Sale Date')
prorata = fields.Selection([('first_january', 'First of January'),
('purchase_date', 'From the Purchase Date'),
('fiscal_year', 'Fiscal Year')],
readonly=True, states={'draft': [('readonly', False)]},
help='Indicates that the first depreciation entry for this asset have to be done from the purchase date or first of January or fiscal year')
depreciation_line_ids = fields.One2many('account.asset.depreciation.line', 'asset_id', string='Depreciation Lines', readonly=True, states={'draft': [('readonly', False)], 'open': [('readonly', False)]})
salvage_value = fields.Float(string='Salvage Value', digits=0, readonly=True, states={'draft': [('readonly', False)]},
help="It is the amount you plan to have that you cannot depreciate.")
invoice_id = fields.Many2one('account.invoice', string='Invoice', states={'draft': [('readonly', False)]}, copy=False)
type = fields.Selection(related="category_id.type", string='Type', required=True)
customer_invoice_count = fields.Integer(string="Invoice",
compute="count_invoice")
@api.onchange('prorata')
def onchange_prorata(self):
if self.prorata == 'fiscal_year':
self.method_period = 12
@api.multi
def get_remaining_value(self):
for record in self:
posted_line_id = record.depreciation_line_ids.search(
[('move_check', '=', True), ('asset_id', '=', record.id)],
limit=1, order='id desc')
record.remaining_asset_value = posted_line_id.remaining_value
@api.onchange('product_id')
def on_product_id_change(self):
self.category_id = self.product_id.asset_category_id
self.value = self.product_id.list_price
@api.depends('prorata')
def get_fiscal_date(self, date):
if self.prorata == 'fiscal_year':
last_day = self.company_id.fiscalyear_last_day
last_month = self.company_id.fiscalyear_last_month
if date:
date = datetime.strptime(date, DF).date()
else:
date = datetime.now()
year = date.year
fiscal_date = date.replace(month=last_month, day=last_day, year=year)
if fiscal_date < date:
fiscal_date = date.replace(month=last_month, day=last_day, year=year + 1)
return datetime.strftime(fiscal_date, '%Y-%m-%d')
@api.multi
def count_invoice(self):
for self_obj in self:
count = self_obj.invoice_id.search_count(
[('asset_id', '=', self_obj.id), ('type', '=', 'in_invoice')])
self_obj.invoice_count = count
customer_invoice_count = self_obj.invoice_id.search_count(
[('asset_id', '=', self_obj.id), ('type', '=', 'out_invoice')])
self_obj.customer_invoice_count = customer_invoice_count
def redirect_to_invoice(self):
if self._context.get('customer'):
action = self.env.ref('account.action_invoice_tree1').read()[0]
action['domain'] = [('asset_id', '=', self.id), ('type', '=', 'out_invoice')]
else:
action = self.env.ref('account.action_invoice_tree2').read()[0]
action['domain'] = [('asset_id', '=', self.id), ('type', '=', 'in_invoice')]
return action
@api.multi
def unlink(self):
@ -156,8 +230,11 @@ class AccountAssetAsset(models.Model):
amount = residual_amount
else:
if self.method == 'linear':
# Manage last line with remaining amount
if self.prorata == 'fiscal_year':
undone_dotation_number = undone_dotation_number - 1
amount = amount_to_depr / (undone_dotation_number - len(posted_depreciation_line_ids))
if self.prorata:
if self.prorata == 'purchase_date':
amount = amount_to_depr / self.method_number
if sequence == 1:
if self.method_period % 12 != 0:
@ -168,9 +245,13 @@ class AccountAssetAsset(models.Model):
else:
days = (self.company_id.compute_fiscalyear_dates(depreciation_date)['date_to'] - depreciation_date).days + 1
amount = (amount_to_depr / self.method_number) / total_days * days
elif self.prorata == 'fiscal_year' and sequence == 1:
fiscal_date = datetime.strptime(self.date or fields.Datetime.today(), '%Y-%m-%d')
days = (self.company_id.compute_fiscalyear_dates(depreciation_date)['date_to'] - fiscal_date.date()).days
amount = (amount_to_depr / self.method_number) / total_days * days
elif self.method == 'degressive':
amount = residual_amount * self.method_progress_factor
if self.prorata:
if self.prorata == 'purchase_date':
if sequence == 1:
if self.method_period % 12 != 0:
date = datetime.strptime(self.date, '%Y-%m-%d')
@ -180,6 +261,10 @@ class AccountAssetAsset(models.Model):
else:
days = (self.company_id.compute_fiscalyear_dates(depreciation_date)['date_to'] - depreciation_date).days + 1
amount = (residual_amount * self.method_progress_factor) / total_days * days
elif self.prorata == 'fiscal_year' and sequence == 1:
fiscal_date = datetime.strptime(self.date or fields.Datetime.today(), '%Y-%m-%d')
days = (self.company_id.compute_fiscalyear_dates(depreciation_date)['date_to'] - fiscal_date.date()).days
amount = (residual_amount * self.method_progress_factor) / total_days * days
return amount
def _compute_board_undone_dotation_nb(self, depreciation_date, total_days):
@ -190,7 +275,7 @@ class AccountAssetAsset(models.Model):
while depreciation_date <= end_date:
depreciation_date = date(depreciation_date.year, depreciation_date.month, depreciation_date.day) + relativedelta(months=+self.method_period)
undone_dotation_number += 1
if self.prorata:
if self.prorata in ['purchase_date', 'fiscal_year']:
undone_dotation_number += 1
return undone_dotation_number
@ -206,13 +291,20 @@ class AccountAssetAsset(models.Model):
if self.value_residual != 0.0:
amount_to_depr = residual_amount = self.value_residual
if self.prorata:
if self.prorata == 'purchase_date':
# if we already have some previous validated entries, starting date is last entry + method perio
if posted_depreciation_line_ids and posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime(posted_depreciation_line_ids[-1].depreciation_date, DF).date()
depreciation_date = last_depreciation_date + relativedelta(months=+self.method_period)
else:
depreciation_date = datetime.strptime(self._get_last_depreciation_date()[self.id], DF).date()
elif self.prorata == 'fiscal_year':
if posted_depreciation_line_ids and posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime(posted_depreciation_line_ids[-1].depreciation_date, DF).date()
depreciation_date = last_depreciation_date + relativedelta(months=+self.method_period)
else:
fiscal_date = self.get_fiscal_date(self.date)
depreciation_date = datetime.strptime(fiscal_date, DF).date()
else:
# depreciation_date = 1st of January of purchase year if annual valuation, 1st of
# purchase month in other cases
@ -366,7 +458,7 @@ class AccountAssetAsset(models.Model):
@api.one
@api.constrains('prorata', 'method_time')
def _check_prorata(self):
if self.prorata and self.method_time != 'number':
if self.prorata == 'purchase_date' and self.method_time != 'number':
raise ValidationError(_('Prorata temporis can be applied only for time method "number of depreciations".'))
@api.onchange('category_id')
@ -395,7 +487,7 @@ class AccountAssetAsset(models.Model):
@api.onchange('method_time')
def onchange_method_time(self):
if self.method_time != 'number':
self.prorata = False
self.prorata = 'first_january'
@api.multi
def copy_data(self, default=None):
@ -416,7 +508,7 @@ class AccountAssetAsset(models.Model):
@api.model
def create(self, vals):
asset = super(AccountAssetAsset, self.with_context(mail_create_nolog=True)).create(vals)
asset.compute_depreciation_board()
asset.sudo().compute_depreciation_board()
return asset
@api.multi
@ -460,6 +552,14 @@ class AccountAssetDepreciationLine(models.Model):
move_id = fields.Many2one('account.move', string='Depreciation Entry')
move_check = fields.Boolean(compute='_get_move_check', string='Linked', track_visibility='always', store=True)
move_posted_check = fields.Boolean(compute='_get_move_posted_check', string='Posted', track_visibility='always', store=True)
product_id = fields.Many2one(related='asset_id.product_id', relation="product.product", string="SID")
begin_value = fields.Float(compute='_get_begin_value', string="Beginning Value", store=True)
@api.multi
@api.depends('asset_id.value', 'asset_id.salvage_value')
def _get_begin_value(self):
for line in self:
line.begin_value = line.asset_id.value - line.asset_id.salvage_value
@api.multi
@api.depends('move_id')
@ -473,13 +573,23 @@ class AccountAssetDepreciationLine(models.Model):
for line in self:
line.move_posted_check = True if line.move_id and line.move_id.state == 'posted' else False
@api.multi
def action_move_cancel(self):
for line in self.asset_id.depreciation_line_ids:
if line.id >= self.id and line.move_check:
line.move_check = False
line.move_id.button_cancel()
@api.multi
def create_move(self, post_move=True):
created_moves = self.env['account.move']
prec = self.env['decimal.precision'].precision_get('Account')
for line in self:
if line.move_id:
raise UserError(_('This depreciation is already linked to a journal entry! Please post or delete it.'))
# raise UserError(_('This depreciation is already linked to a journal entry! Please post or delete it.'))
line.move_id.post()
line.write({'move_check': True})
return [x.id for x in line.move_id]
category_id = line.asset_id.category_id
depreciation_date = self.env.context.get('depreciation_date') or line.depreciation_date or fields.Date.context_today(self)
company_currency = line.asset_id.company_id.currency_id
@ -512,6 +622,7 @@ class AccountAssetDepreciationLine(models.Model):
'ref': line.asset_id.code,
'date': depreciation_date or False,
'journal_id': category_id.journal_id.id,
'asset_id': line.asset_id.id,
'line_ids': [(0, 0, move_line_1), (0, 0, move_line_2)],
}
move = self.env['account.move'].create(move_vals)

View File

@ -3,7 +3,8 @@
from datetime import datetime
from dateutil.relativedelta import relativedelta
from flectra import api, fields, models
from flectra.exceptions import UserError
from flectra import api, fields, models, _
from flectra.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from flectra.addons import decimal_precision as dp
@ -12,6 +13,9 @@ from flectra.addons import decimal_precision as dp
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
asset_id = fields.Many2one('account.asset.asset')
asset_bool = fields.Boolean(string="Asset")
@api.model
def _refund_cleanup_lines(self, lines):
result = super(AccountInvoice, self)._refund_cleanup_lines(lines)
@ -45,6 +49,8 @@ class AccountInvoice(models.Model):
class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
asset_id = fields.Many2one('account.asset.asset')
asset_bool = fields.Boolean(string="Asset")
asset_category_id = fields.Many2one('account.asset.category', string='Asset Category')
asset_start_date = fields.Date(string='Asset Start Date', compute='_get_asset_date', readonly=True, store=True)
asset_end_date = fields.Date(string='Asset End Date', compute='_get_asset_date', readonly=True, store=True)
@ -71,9 +77,13 @@ class AccountInvoiceLine(models.Model):
@api.one
def asset_create(self):
if self.asset_category_id:
if not self.asset_category_id:
self.write(
{'asset_category_id': self.product_id.asset_category_id.id})
if self.asset_category_id and not self.asset_bool:
vals = {
'name': self.name,
'product_id': self.product_id.id,
'code': self.invoice_id.number or False,
'category_id': self.asset_category_id.id,
'value': self.price_subtotal_signed,
@ -86,6 +96,7 @@ class AccountInvoiceLine(models.Model):
changed_vals = self.env['account.asset.asset'].onchange_category_id_values(vals['category_id'])
vals.update(changed_vals['value'])
asset = self.env['account.asset.asset'].create(vals)
self.invoice_id.update({'asset_id': asset.id})
if self.asset_category_id.open_asset:
asset.validate()
return True

View File

@ -7,7 +7,7 @@ from flectra import api, fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
asset_category_id = fields.Many2one('account.asset.category', string='Asset Type', company_dependent=True, ondelete="restrict")
asset_category_id = fields.Many2one('account.asset.category', string='Asset Category', company_dependent=True, ondelete="restrict")
deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', company_dependent=True, ondelete="restrict")
@api.multi

View File

@ -2,3 +2,5 @@
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
from . import account_asset_report
from . import asset_depreciation_report

View File

@ -3,6 +3,7 @@
from flectra import api, fields, models, tools
class AssetAssetReport(models.Model):
_name = "asset.asset.report"
_description = "Assets Analysis"

View File

@ -0,0 +1,104 @@
# Part of Flectra. See LICENSE file for full copyright and licensing
# details.
from flectra import api, models, _
from datetime import datetime
from flectra.exceptions import UserError
class AssetDepreciation(models.AbstractModel):
_name = "report.account_asset.asset_depreciation_template"
def get_date(self, data):
date_lst = [{
'start_date': data['start_date'],
'end_date': data['end_date']
}]
return date_lst
def get_data(self, data):
asset_dep_line_id_list = list()
asset_dep_line_id_list = \
self.env['account.asset.depreciation.line'].search([
('depreciation_date', '>=', data['start_date']),
('depreciation_date', '<=', data['end_date']),
('move_check', '=', True),
('move_id', '!=', False),
('move_id.state', '=', 'posted')
])
if not asset_dep_line_id_list:
raise UserError(_("No Depreciation Lines in this fiscal year.."))
data_dict = {}
for line_id in asset_dep_line_id_list:
product_id = line_id.asset_id.product_id.id
depre_date = datetime.strptime(
line_id.depreciation_date, "%Y-%m-%d")
purchase_date = datetime.strptime(
line_id.asset_id.date, "%Y-%m-%d")
if product_id not in data_dict:
if depre_date.year == purchase_date.year \
or line_id.sequence == 1:
open_asset = 0.0
open_dep = 0.0
add_asset = line_id.begin_value
else:
open_asset = line_id.begin_value
add_asset = 0.00
open_dep = line_id.depreciated_value - line_id.amount
add_dep = line_id.amount
total_dep = open_dep + add_dep
total_asset = open_asset + add_asset
data_dict[product_id] = {
'name': line_id.asset_id.name,
'product_name': line_id.asset_id.product_id.name,
'category': line_id.asset_id.category_id.name,
'open_asset': open_asset,
'add_asset': add_asset,
'total_asset': total_asset,
'open_dep': open_dep,
'add_dep': add_dep,
'total_dep': total_dep,
'open_net': open_asset - open_dep,
'add_net': add_asset - add_dep,
'total_net': total_asset - total_dep
}
else:
add_dep = line_id.amount
if depre_date.year == purchase_date.year \
or line_id.sequence == 1:
open_asset = 0.0
add_asset = line_id.begin_value
open_dep = 0.0
else:
open_asset = line_id.begin_value
add_asset = 0.00
open_dep = line_id.depreciated_value - line_id.amount
if line_id.asset_id.sale_date \
and line_id.asset_id.sale_date >= data['start_date'] \
and line_id.asset_id.sale_date <= data['end_date']:
add_asset -= line_id.begin_value
add_dep -= line_id.depreciated_value
total_dep = open_dep + add_dep
total_asset = open_asset + add_asset
data_dict[product_id]['open_asset'] += open_asset
data_dict[product_id]['add_asset'] += add_asset
data_dict[product_id]['total_asset'] += total_asset
data_dict[product_id]['open_dep'] += open_dep
data_dict[product_id]['add_dep'] += add_dep
data_dict[product_id]['total_dep'] += total_dep
data_dict[product_id]['open_net'] += open_asset - open_dep
data_dict[product_id]['add_net'] += add_asset - add_dep
data_dict[product_id]['total_net'] += total_asset - total_dep
final_data = []
for key in data_dict:
final_data.append(data_dict[key])
return final_data
@api.model
def get_report_values(self, docids, data=None):
report_lines = self.get_data(data.get('form'))
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
return {'doc_ids': docids, 'doc_model': model, 'data': data,
'docs': docs, 'get_data': report_lines}

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<flectra>
<template id="asset_depreciation_template">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<h2>Asset Depreciation</h2>
<div class="row mt32">
<div class="col-xs-3">
<strong>Start Date:</strong>
<p t-esc="data['form']['start_date']"/>
</div>
<div class="col-xs-3">
<strong>End Date:</strong>
<p t-esc="data['form']['end_date']"/>
</div>
</div>
<br/>
<br/>
<table class="table table-bordered">
<tr>
<th colspan="2"></th>
<th colspan="3" class="text-center">Assets</th>
<th colspan="3" class="text-center">Depreciation</th>
<th colspan="3" class="text-center">Closing Balance</th>
</tr>
<tr>
<th class="text-center">Asset Name</th>
<th class="text-center">Category</th>
<th class="text-center">Opening</th>
<th class="text-center">Additional</th>
<th class="text-center">Total</th>
<th class="text-center">Opening</th>
<th class="text-center">Additional</th>
<th class="text-center">Total</th>
<th class="text-center">Opening</th>
<th class="text-center">Additional</th>
<th class="text-center">Total</th>
</tr>
<tr t-foreach="get_data" t-as="object">
<td>
<t t-esc="object['name']"/>
</td>
<td>
<t t-esc="object['category']"/>
</td>
<td align="right">
<t t-esc="object['open_asset']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['add_asset']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['total_asset']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['open_dep']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['add_dep']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['total_dep']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['open_net']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['add_net']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
<td align="right">
<t t-esc="object['total_net']"
t-options='{"widget": "monetary", "display_currency": res_company.currency_id}'/>
</td>
</tr>
</table>
</div>
</t>
</t>
</template>
</flectra>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<flectra>
<report
id="asset_depreciation_report"
model="account.asset.asset"
string="Asset Depreciation Report"
report_type="qweb-pdf"
name="account_asset.asset_depreciation_template"
file="account_asset.asset_depreciation_template"
menu="False"
/>
</flectra>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<flectra>
<record id="asset_depreciation_report_format" model="report.paperformat">
<field name="name">Asset Depreciation Report Format</field>
<field name="default" eval="True"/>
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Landscape</field>
<field name="margin_top">40</field>
<field name="margin_bottom">20</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">43</field>
<field name="dpi">90</field>
</record>
</flectra>

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,262 @@
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Categories Configuration</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_01.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Categories Configuration</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
<ul>
<li><b>Asset Account: </b> Account used to record the purchase of the asset at its original price.</li>
<li><b>Depreciation Entries: </b> Account used in the depreciation entries, to decrease the asset value.</li>
<li><b>Depreciation Entries: Expense Account: </b>Account used in the periodical entries, to record a part of the asset as expense.</li>
<li><b>Number of Depreciations: </b>The number of depreciations needed to depreciate your asset.</li>
<li><b>Computation Method: </b>Choose the method to use to compute the amount of depreciation lines. <br>* Linear: Calculated on basis of: Gross Value / Number of Depreciations. <br>
* Degressive: Calculated on basis of: Residual Value * Degressive Factor.</li>
<li><b>Period Length: </b>State here the time between 2 depreciations, in months.</li>
<li><b>Time Method: </b>Choose the method to use to compute the dates and number of entries.
<br> * Number of Entries: Fix the number of entries and the time between 2 depreciations.
<br> * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.</li>
<li><b>Prorata: </b>Indicates that the first depreciation entry for this asset have to be done from the purchase date or first of January or fiscal year.</li>
<li><b>Auto-confirm Assets: </b>Check this if you want to automatically confirm the assets of this category when created by invoices.</li>
<li><b>Group Journal Entries: </b>Check this if you want to group the generated entries by categories.</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_02.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Categories Configuration</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
<ul>
<li><b>Asset: </b>Your asset product.</li>
<li><b>Gross Value: </b> Asset original price.</li>
<li><b>Salvage Value: </b> It is the amount you plan to have that you cannot depreciate.</li>
<li><b>Residual Value: </b> Gross Value - Salvage Value - (Depricated Line Amount)</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Depreciations Information</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_03.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Categories Configuration</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
<ul>
<li><b>Computation Method: </b>Choose the method to use to compute the amount of depreciation lines. <br>* Linear: Calculated on basis of: Gross Value / Number of Depreciations. <br>
* Degressive: Calculated on basis of: Residual Value * Degressive Factor.</li>
<li><b>Time Method Based: </b>Choose the method to use to compute the dates and number of entries.
<br> * Number of Entries: Fix the number of entries and the time between 2 depreciations.
<br> * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.</li>
<li><b>Prorata: </b>Indicates that the first depreciation entry for this asset have to be done from the purchase date or first of January or fiscal year.</li>
<li><b>Number of Depreciations: </b>The number of depreciations needed to depreciate your asset.</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Depreciations Board</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_04.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Depreciations Board</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
<ul>
<li>
Calculate depreciations line based on Computation Method, Time Method Based, Prorata and Number of Depreciations.
</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Confirm</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_05.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Confirm</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
<ul>
<li>
You can view red toggle button for force fully create line of depreciations.
</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Depreciations line</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_06.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<div class="oe_span12">
<p class="mt32 text-justify">
<ul>
<li>
You can view here line of depreciations and you can also cancel particular depreciations line entry using Cancel Entry button.
</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Sale Asset</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_07.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<div class="oe_span12">
<p class="mt32 text-justify">
We can sale asset directly to particular customer.
<ul>
<li> <b> Sale Date </b>: Define here asset sale date.</li>
<li> <b> Sale Value </b>: It will calculated amount by default Sale Date wise.</li>
</ul>
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Close and Invoice</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_08.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Asset Close and Invoice</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
Here remove other depreciations line which is greater than Sale Date.
You can also view Customer Invoice button.
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Invoice</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_09.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Invoice</h3>
<div class="oe_span12">
<p class="mt32 text-justify">
Customer Invoice details.
If you created asset by Vendor Bills then it display Vendor Invoice button in asset form.
</p>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<h3 class="oe_slogan">Report</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="account_asset_sc_report.png">
</div>
</div>
</div>
</section>
<section class="container">
<div class="row oe_spaced">
<div class="oe_span12">
<p class="mt32 text-justify">
You can print report for Start Date to End Date.
</p>
</div>
</div>
</section>

View File

@ -26,6 +26,32 @@
<field name="method_period">12</field>
</record>
<record id="account_asset_category_1" model="account.asset.category">
<field name="name">Furniture</field>
<field name="account_depreciation_id" ref="xfa"/>
<field name="account_depreciation_expense_id" ref="a_expense"/>
<field name="account_asset_id" ref="xfa"/>
<field name="journal_id" ref="expenses_journal"/>
<field name="method_time">number</field>
<field name="method_number">5</field>
<field name="method_period">12</field>
<field name="method">linear</field>
<field name="open_asset" eval="True"/>
</record>
<record id="account_asset_category_2" model="account.asset.category">
<field name="name">Electronics</field>
<field name="account_depreciation_id" ref="xfa"/>
<field name="account_depreciation_expense_id" ref="a_expense"/>
<field name="account_asset_id" ref="xfa"/>
<field name="journal_id" ref="expenses_journal"/>
<field name="method_time">number</field>
<field name="method_number">6</field>
<field name="method_period">12</field>
<field name="method">linear</field>
<field name="open_asset" eval="True"/>
</record>
<!--
Assets Demo
-->
@ -50,7 +76,7 @@
</record>
<record id="account_asset_asset_office_test0" model="account.asset.asset">
<field eval="1" name="prorata"/>
<field name="prorata">purchase_date</field>
<field eval="100000.0" name="salvage_value"/>
<field name="state">open</field>
<field eval="12" name="method_period"/>
@ -61,6 +87,45 @@
<field name="category_id" ref="account_asset_category_fixedassets_test0"/>
</record>
<record id="product_product_id_1" model="product.product">
<field name="name">Asset Product</field>
<field name="categ_id" ref="product.product_category_5"/>
<field name="standard_price">100</field>
<field name="list_price">150</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="uom_po_id" ref="product.product_uom_unit"/>
<field name="description">Asset Product</field>
<field name="default_code">AP</field>
</record>
<record id="account_asset_1" model="account.asset.asset">
<field name="name">Asset 1</field>
<field name="product_id" ref="product_product_id_1"/>
<field name="category_id" ref="account_asset_category_1"/>
<field name="partner_id" ref="base.res_partner_1"/>
<field name="date" eval="time.strftime('%Y-%m-%d')"/>
<field name="value">50000</field>
<field name="salvage_value">10000</field>
<field name="method">linear</field>
<field name="method_number">5</field>
<field name="method_period">12</field>
<field name="prorata">first_january</field>
</record>
<record id="account_asset_2" model="account.asset.asset">
<field name="name">Asset 2</field>
<field name="product_id" ref="product_product_id_1"/>
<field name="category_id" ref="account_asset_category_2"/>
<field name="partner_id" ref="base.res_partner_1"/>
<field name="date" eval="time.strftime('%Y-%m-%d')"/>
<field name="value">40000</field>
<field name="salvage_value">10000</field>
<field name="method">linear</field>
<field name="method_number">5</field>
<field name="method_period">12</field>
<field name="prorata">fiscal_year</field>
</record>
</data>
</flectra>

View File

@ -4,6 +4,9 @@
from flectra import tools
from flectra.tests import common
from flectra.modules.module import get_resource_path
from datetime import date, datetime
from flectra.tools import DEFAULT_SERVER_DATE_FORMAT as DF
import logging
class TestAccountAsset(common.TransactionCase):
@ -17,6 +20,10 @@ class TestAccountAsset(common.TransactionCase):
self._load('account', 'test', 'account_minimal_test.xml')
self._load('account_asset', 'test', 'account_asset_demo_test.xml')
self.asset_id_1 = self.env.ref("account_asset.account_asset_1")
self.asset_id_2 = self.env.ref("account_asset.account_asset_2")
self.partner_id = self.env.ref("base.res_partner_2")
# In order to test the process of Account Asset, I perform a action to confirm Account Asset.
self.browse_ref("account_asset.account_asset_asset_vehicles_test0").validate()
@ -64,3 +71,65 @@ class TestAccountAsset(common.TransactionCase):
}
asset_compute_period_0 = self.env['asset.depreciation.confirmation.wizard'].create({})
asset_compute_period_0.with_context(context).asset_compute()
assert self.asset_id_1.product_id, "Product is not there in %s" % \
self.asset_id_1
assert self.asset_id_1.category_id, "Asset Category is not there " \
"in %s" % self.asset_id_1
assert self.asset_id_1.partner_id, "Vendor is not defined in %s" % \
self.asset_id_1
assert self.asset_id_1.date, "Asset Purchase date is not defined."
assert self.asset_id_1.value, "Definig an asset value is necessary"
if self.asset_id_1.method is 'degressive':
assert self.asset_id_1.method_progress_factor, \
"Degressive Factor is required for further calculation"
if self.asset_id_1.method_time is 'number':
assert self.asset_id_1.method_number, "Method number is required"
if self.asset_id_1.method_time is 'end':
assert self.asset_id_1.method_end, "Ending Date is required"
assert self.asset_id_1.method_period, "Field 'Number of months in " \
"a period is blank'"
self.asset_id_1.validate()
if self.asset_id_1.state != 'open':
raise AssertionError("Asset state must be in open state!")
sale_asset_id = self.env['sale.asset.wizard'].create({
'asset_id': self.asset_id_1.id,
'product_id': self.asset_id_1.product_id.id,
'asset_category_id': self.asset_id_1.category_id.id,
'sale_date': date.today(),
'partner_id': self.partner_id.id,
})
sale_asset_id.onchange_sale_date()
sale_asset_id.with_context(
{'active_id': self.asset_id_1.id}).sale_asset()
if self.asset_id_1.state != 'close':
raise AssertionError("Asset is not sold")
else:
logging.info("Asset Sale Function successfully executed")
# Check Fiscal Year
account_config = self.env['res.config.settings'].create({
'fiscalyear_last_month': 3,
})
account_config.execute()
self.assertEqual(self.asset_id_2.prorata, 'fiscal_year')
self.assertEqual(self.asset_id_2.method_period, 12)
self.asset_id_2.compute_depreciation_board()
self.asset_id_2.validate()
fl_depreciation_date = self.asset_id_2.depreciation_line_ids[0].depreciation_date
first_line_date = datetime.strptime(fl_depreciation_date, DF).date()
self.assertEqual(first_line_date.month, 3)
sl_depreciation_date = self.asset_id_2.depreciation_line_ids[1].depreciation_date
second_line_date = datetime.strptime(sl_depreciation_date, DF).date()
self.assertEqual(second_line_date.month, 3)

View File

@ -10,57 +10,70 @@
<field name="model">account.asset.category</field>
<field name="arch" type="xml">
<form string="Asset category">
<sheet>
<group>
<div class="oe_title">
<label for="name" string="Asset Type" class="oe_edit_only" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="name" string="Asset Category" class="oe_edit_only" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="name" string="Deferred Revenue Type" class="oe_edit_only" attrs="{'invisible': [('type','==','purchase')]}"/>
<h1>
<field name="name" placeholder="e.g. Computers"/>
</h1>
</div>
<group>
<field name="type" invisible="1"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
<group>
<group string="Journal Entries">
<field name="journal_id"/>
<div>
<label for="account_asset_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
<label for="journal_id" style="font-weight: bold;" string="Journal"/>
</div>
<field name="journal_id" nolabel="1"/>
<div>
<label for="account_asset_id" style="font-weight: bold;" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_asset_id" style="font-weight: bold;" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/>
<div>
<label for="account_depreciation_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_id" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
<label for="account_depreciation_id" style="font-weight: bold;" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_id" style="font-weight: bold;" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_id" nolabel="1"/>
<div>
<label for="account_depreciation_expense_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_expense_id" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/>
<label for="account_depreciation_expense_id" style="font-weight: bold;" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_expense_id" style="font-weight: bold;" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_expense_id" nolabel="1"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
</group>
</group>
<notebook>
<page string="Other Information">
<group>
<group string="Periodicity">
<field name="method_time" string="Time Method Based On" widget="radio" attrs="{'invisible': [('type','!=','purchase')]}"/>
<field name="method_number" string="Number of Entries" attrs="{'invisible':['|',('method_time','!=','number'),'&amp;',('type','=', False)], 'required':[('method_time','=','number')]}"/>
<label for="method_period" string="One Entry Every"/>
<div>
<field name="method_number" attrs="{'invisible':['|',('method_time','!=','number'),'&amp;',('type','=', False)], 'required':[('method_time','=','number')]}"/>
<label for="method_period" string="One Entry Every" attrs="{'invisible': [('prorata','=','fiscal_year')]}"/>
<div attrs="{'invisible': [('prorata','=','fiscal_year')]}">
<field name="method_period" nolabel="1" attrs="{'invisible': [('type','=', False)]}" class="oe_inline"/>
months
</div>
<field name="method_end" attrs="{'required': [('method_time','=','end')], 'invisible':[('method_time','!=','end')]}"/>
</group>
<group string="Additional Options">
<field name="open_asset"/>
<field name="group_entries"/>
</group>
<group attrs="{'invisible': [('type','=','sale')]}" string="Depreciation Method">
<field name="method" widget="radio"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
</group>
<group string="Additional Options">
<field name="open_asset"/>
<field name="group_entries"/>
</group>
<group string="Company" groups="base.group_multi_company">
<field name="type" invisible="1"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
@ -128,17 +141,37 @@
<form string="Asset">
<header>
<button name="validate" states="draft" string="Confirm" type="object" class="oe_highlight"/>
<button name="%(asset_sale_action)d" states="open" type="action" string="Customer Invoice"
class="oe_highlight"
context="{
'default_product_id': product_id,
'default_asset_category_id': category_id,
'default_asset_id': active_id,
'default_depreciated_amount': remaining_asset_value,
'default_sale_value': remaining_asset_value,
}"/>
<button type="object" name="compute_depreciation_board" string="Compute Depreciation" states="draft"/>
<button name="set_to_close" states="open" string="Sell or Dispose" type="object" class="oe_highlight"/>
<button name="set_to_close" states="open" string="Sell or Dispose" type="object" class="oe_highlight" invisible="1"/>
<button name="set_to_draft" string="Set to Draft" type="object" attrs="{'invisible': ['|', ('entry_count', '!=', 0), ('state', '!=', 'open')]}"/>
<button name="%(action_asset_modify)d" states="open" string="Modify Depreciation" type="action"/>
<button name="%(action_asset_modify)d" states="open" string="Modify Depreciation" type="action" context="{'prorata': prorata}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,open"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="open_entries" type="object" icon="fa-pencil">
<field string="Items" name="entry_count" widget="statinfo" />
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive" attrs="{'invisible': [('state', '=', 'close')]}">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
<button class="oe_stat_button" name="open_entries" type="object" icon="fa-pencil">
<field string="Dep. Entries" name="entry_count" widget="statinfo" />
</button>
<button class="oe_inline oe_stat_button" string="Vendor Invoice" name="redirect_to_invoice" type="object" icon="fa-pencil" attrs="{'invisible': [('invoice_count', '=', 0)]}">
</button>
<button class="oe_inline oe_stat_button" context="{'customer': True}" string="Customer Invoice" name="redirect_to_invoice" type="object" icon="fa-pencil" attrs="{'invisible': [('customer_invoice_count', '=', 0)]}">
</button>
<field name="invoice_count" widget="statinfo" invisible="1"/>
<field name="customer_invoice_count" widget="statinfo" invisible="1"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
@ -150,7 +183,12 @@
<group>
<field name="category_id" domain="[('type', '=', 'purchase')]" context="{'default_type': 'purchase'}" help="Category of asset"/>
<field name="code"/>
<field name="product_id"
attrs="{'required': [('state','=','draft')],'readonly': [('state','!=','draft')]}"
string="Asset"/>
<field name="remaining_asset_value" invisible="1"/>
<field name="date" help="Date of asset"/>
<field name="sale_date" attrs="{'invisible': [('sale_date', '=', False)], 'readonly': [('sale_date', '!=', False)]}"/>
<field name="type" invisible="1"/>
</group>
<group>
@ -168,10 +206,12 @@
<field name="depreciation_line_ids" mode="tree" options="{'reload_whole_on_button': true}">
<tree string="Depreciation Lines" decoration-info="(move_check == False)" create="false">
<field name="depreciation_date"/>
<field name="depreciated_value" readonly="1"/>
<field name="begin_value"/>
<field name="amount" widget="monetary" string="Depreciation"/>
<field name="depreciated_value" readonly="1"/>
<field name="remaining_value" readonly="1" widget="monetary" string="Residual"/>
<field name="move_check" widget="deprec_lines_toggler" attrs="{'invisible': [('parent_state', '!=', 'open')]}"/>
<button name="action_move_cancel" string="Cancel Entry" type="object" attrs="{'invisible': ['|', ('move_check', '=', False), ('parent_state', '=', 'close')]}"/>
<field name="move_posted_check" invisible="1"/>
<field name="parent_state" invisible="1"/>
</tree>
@ -204,7 +244,7 @@
</group>
<group>
<field name="method_number" attrs="{'invisible':[('method_time','=','end')], 'required':[('method_time','=','number')]}"/>
<field name="method_period"/>
<field name="method_period" attrs="{'invisible': [('prorata','=','fiscal_year')]}"/>
<field name="method_end" attrs="{'required': [('method_time','=','end')], 'invisible':[('method_time','=','number')]}"/>
</group>
</page>
@ -284,9 +324,16 @@
<filter string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>
<field name="category_id"/>
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<filter string="Inactive" domain="[('active','=', False)]"/>
<field name="product_id"/>
<group expand="0" string="Group By...">
<filter string="Month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Category" domain="[]" context="{'group_by':'category_id'}"/>
<filter string="State" icon="terp-folder-orange" domain="[]" context="{'group_by':'state'}"/>
<filter string="Asset Category" icon="terp-folder-orange" domain="[]"
context="{'group_by':'category_id'}"/>
<filter string="Product" icon="terp-folder-orange" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Partner" icon="terp-folder-orange" domain="[]"
context="{'group_by':'partner_id'}"/>
</group>
</search>
</field>
@ -311,7 +358,7 @@
<menuitem id="menu_finance_config_assets" name="Assets and Revenues" parent="account.menu_finance_configuration" sequence="25"/>
<record model="ir.actions.act_window" id="action_account_asset_asset_list_normal_purchase">
<field name="name">Asset Types</field>
<field name="name">Asset Categories</field>
<field name="res_model">account.asset.category</field>
<field name="domain">[('type', '=', 'purchase')]</field>
<field name="view_type">form</field>

View File

@ -10,6 +10,18 @@
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='account_id']" position="before">
<field string="Asset Category" name="asset_category_id" domain="[('type','=','purchase')]" context="{'default_type':'purchase'}"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="asset_bool" invisible="1"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="attrs">{'readonly': [('asset_bool', '=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='invoice_line_ids']" position="inside">
<field name="asset_bool" invisible="1"/>
</xpath>
<xpath expr="//field[@name='invoice_line_ids']" position="attributes">
<attribute name="attrs">{'readonly': [('asset_bool', '=', True)]}</attribute>
</xpath>
</field>
</record>

View File

@ -9,7 +9,7 @@
<div id="msg_account_asset" position="replace">
<div class="content-group" attrs="{'invisible': [('module_account_asset', '=', False)]}">
<div class="mt16">
<button name="%(account_asset.action_account_asset_asset_list_normal_purchase)d" icon="fa-arrow-right" type="action" string="Asset Types" class="btn-link"/>
<button name="%(account_asset.action_account_asset_asset_list_normal_purchase)d" icon="fa-arrow-right" type="action" string="Asset Categories" class="btn-link"/>
</div>
</div>
</div>

View File

@ -3,3 +3,5 @@
from . import asset_depreciation_confirmation_wizard
from . import asset_modify
from . import sale_asset_wizard
from . import asset_depreciation_summary

View File

@ -0,0 +1,34 @@
# Part of Flectra. See LICENSE file for full copyright and licensing
# details.
from flectra import api, fields, models
from datetime import datetime
from flectra.tools import DEFAULT_SERVER_DATE_FORMAT as DF
class AssetDepreciationWizard(models.TransientModel):
_name = "asset.depreciation.wizard"
@api.depends('start_date')
def _compute_get_end_date(self):
if self.start_date:
last_day = self.env.user.company_id.fiscalyear_last_day
last_month = self.env.user.company_id.fiscalyear_last_month
date = datetime.strptime(self.start_date, DF).date()
year = date.year
fiscal_date = date.replace(month=last_month, day=last_day, year=year)
if fiscal_date < date:
fiscal_date = date.replace(month=last_month, day=last_day, year=year + 1)
self.end_date = datetime.strftime(fiscal_date, '%Y-%m-%d')
start_date = fields.Date(string="Start Date", required=True)
end_date = fields.Date(compute='_compute_get_end_date', store=True)
@api.multi
def print_depreciation_lines(self):
data = {'form': self.read(['start_date', 'end_date'])[0]}
return self.env.ref(
'account_asset.asset_depreciation_report').report_action(
self,
data=data,
config=False)

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<flectra>
<record id="asset_depreciation_summary_report_form_view" model="ir.ui.view">
<field name="name">asset.depreciation.summary.report.form</field>
<field name="model">asset.depreciation.wizard</field>
<field name="arch" type="xml">
<form>
<group col="4">
<field name="start_date"/>
<field name="end_date"/>
</group>
<footer>
<button name="print_depreciation_lines" type="object" class="oe_highlight" string="Print"/>
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="asset_depreciation_summary_report_action" model="ir.actions.act_window">
<field name="name">Asset Depreciation Summary Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">asset.depreciation.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
id="asset_depreciation_summary_report_menu"
name="Asset Depreciation Summary"
parent="account.menu_finance_legal_statement"
action="asset_depreciation_summary_report_action"
/>
</flectra>

View File

@ -14,8 +14,8 @@
</group>
<group colspan="2" col="2">
<field name="method_end" attrs="{'invisible': [('asset_method_time', '=', 'number')]}"/>
<label for="method_period"/>
<div>
<label for="method_period" invisible="context.get('prorata') == 'fiscal_year'"/>
<div invisible="context.get('prorata') == 'fiscal_year'">
<field name="method_period" class="oe_inline"/> months
</div>
</group>

View File

@ -0,0 +1,184 @@
# Part of Flectra. See LICENSE file for full copyright and licensing
# details.
from flectra import fields, models, _, api
from datetime import datetime
from flectra.tools import DEFAULT_SERVER_DATE_FORMAT as DF
class SaleAssetWizard(models.TransientModel):
_name = "sale.asset.wizard"
asset_id = fields.Many2one("account.asset.asset", string="Asset")
asset_category_id = fields.Many2one("account.asset.category",
string="Asset Category", required=True)
depreciated_amount = fields.Float(string="Depreciated Amount")
product_id = fields.Many2one("product.product", string="Product",
required=True)
partner_id = fields.Many2one("res.partner", string="Customer",
required=True)
sale_value = fields.Float(string="Sale Value")
sale_date = fields.Date(
string="Date", default=lambda self: datetime.today(),
required=True)
@api.onchange('product_id')
def onchange_product_id(self):
date = False
for line in self.asset_id.depreciation_line_ids:
if line.move_check:
date = line.depreciation_date
if not date:
date = self.asset_id.depreciation_line_ids and self.asset_id.depreciation_line_ids[0].depreciation_date or self.asset_id.date
self.sale_date = date
@api.onchange('sale_date')
def onchange_sale_date(self):
if self.sale_date:
amount = 0.0
last_date = False
for line in self.asset_id.depreciation_line_ids:
if self.sale_date >= line.depreciation_date:
amount += line.amount
last_date = line.depreciation_date
else:
if not last_date:
last_date = line.depreciation_date
if line.sequence == 1:
last_date = self.asset_id.date
days, total_days = \
self.get_days(last_date, self.sale_date)
amount += (line.amount * days) / total_days
break
self.depreciated_amount = amount
self.sale_value = self.asset_id.value - amount
@api.constrains('sale_date')
def _check_sale_date(self):
if self.sale_date:
posted_line_ids = \
self.env['account.asset.depreciation.line'].search([
('asset_id', '=', self.asset_id.id),
('move_check', '=', True)])
if posted_line_ids:
last_depreciation_date = \
datetime.strptime(
posted_line_ids[-1].depreciation_date, DF).date()
if self.sale_date < str(last_depreciation_date):
raise ValueError(_("Sale date must be greater than last "
"Depreciated date!"))
if self.sale_date < self.asset_id.date:
raise ValueError(_("Sale date must be greater than "
"Date of Asset!"))
@api.multi
def get_days(self, last_date, sale_date):
last_depreciation_date = datetime.strptime(last_date, DF).date()
sale_date = datetime.strptime(sale_date, DF).date()
delta = sale_date - last_depreciation_date
year = last_depreciation_date.year
total_days = (year % 4) and 365 or 366
if self.asset_id.depreciation_line_ids and self.asset_id.depreciation_line_ids[0].depreciation_date > str(sale_date):
depreciation_date = datetime.strptime(self.asset_id.depreciation_line_ids[0].depreciation_date, DF).date()
asset_date = datetime.strptime(self.asset_id.date, DF).date()
delta_day = depreciation_date - asset_date
total_days = delta_day.days
delta = sale_date - asset_date
return delta.days, total_days
@api.multi
def last_line_info(self):
last_date = False
last_line = False
sale_date = self.sale_date
for line in self.asset_id.depreciation_line_ids:
if sale_date >= line.depreciation_date:
line.create_move(post_move=True)
last_date = line.depreciation_date
last_line = line
else:
last_line = line
if not last_date:
last_date = line.depreciation_date
if line.sequence == 1:
last_date = self.asset_id.date
break
days, total_days = self.get_days(last_date, sale_date)
amount = (last_line.amount * days) / total_days
return last_line, amount
def sale_asset(self):
if self.asset_id:
self.asset_id.write({
'state': 'close',
'sale_date': self.sale_date,
})
last_line, amount = self.last_line_info()
if last_line and amount:
depreciated_value = \
(last_line.depreciated_value - last_line.amount) + amount
last_line.update({
'depreciation_date': self.sale_date,
'amount': amount,
'depreciated_value': depreciated_value,
'remaining_value':
last_line.begin_value - depreciated_value,
})
last_line.create_move(post_move=True)
if last_line.move_id.state == 'draft':
last_line.move_id.post()
for line in self.asset_id.depreciation_line_ids:
if not line.move_check:
line.unlink()
self.create_sale_invoice()
def create_sale_invoice(self):
invoice_obj = self.env['account.invoice']
invoice_line_obj = self.env['account.invoice.line']
journal_id = self.env['account.journal'].search(
[('code', '=', 'INV')])
account_id = self.env['account.account'].search(
[('internal_type', '=', 'receivable')])
tax_ids = self.product_id.supplier_taxes_id.ids
invoice_id = invoice_obj.create({
'partner_id': self.partner_id.id,
'journal_id':
journal_id and
journal_id[0].id or
self.asset_id.category_id.journal_id.id,
'account_id':
account_id and
account_id[0].id or
self.asset_id.category_id.account_asset_id.id,
'company_id': self.partner_id.company_id.id,
'type': 'out_invoice',
'date_invoice': self.sale_date,
'payment_term_id':
self.partner_id.property_supplier_payment_term_id.id,
'currency_id': self.partner_id.company_id.currency_id.id,
'asset_id': self.asset_id.id,
'asset_bool': True
})
invoice_line_obj.create({
'product_id': self.product_id.id,
'name': self.product_id.name,
'asset_id': self.asset_id.id,
'asset_category_id': self.asset_id.category_id.id,
'account_id': self.asset_id.category_id.account_asset_id.id,
'quantity': 1.0,
'price_unit': self.sale_value,
'partner_id': self.partner_id.id,
'company_id': self.partner_id.company_id.id,
'invoice_line_tax_ids': tax_ids and [[6, 0, tax_ids]] or False,
'asset_bool': True,
'invoice_id': invoice_id.id
})
return {
'name': (_('Invoices')),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'domain': [('asset_id', '=', self.asset_id.id)]
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<flectra>
<record id="asset_sale_form_view" model="ir.ui.view">
<field name="name">sale.asset.wizard</field>
<field name="model">sale.asset.wizard</field>
<field name="arch" type="xml">
<form>
<group col="4">
<field name="asset_id" readonly="1"/>
<field name="product_id" readonly="1"/>
<field name="asset_category_id" readonly="1"/>
<field name="depreciated_amount" readonly="1" invisible="1"/>
<field name="sale_date"/>
<field name="partner_id"/>
<field name="sale_value"/>
</group>
<footer>
<button name="sale_asset" string="Confirm"
type="object"
class="oe_highlight" context="{}"/>
<button string="Cancel" class="oe_highlight"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="asset_sale_action" model="ir.actions.act_window">
<field name="name">Sale</field>
<field name="res_model">sale.asset.wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</flectra>