Server IP : 127.0.0.2 / Your IP : 3.15.195.46 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/odoo/addons/account_asset/data/ |
Upload File : |
- Creating demo data that require looking for accounts - !python {model: ir.model.data, id: False} : | company = self.env.user.company_id journal_id = self.env['account.journal'].search([('type', '=', 'general'), ('id', '!=', company.currency_exchange_journal_id.id)], limit=1).id expense_account_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_expenses'))], limit=1).id xfa_account_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_fixed_assets'))], limit=1).id if not xfa_account_id: xfa_account_id = self.env['account.account'].search([('user_type_id', '=', ref('account.data_account_type_current_assets'))], limit=1).id from datetime import datetime, timedelta import time if xfa_account_id and expense_account_id and journal_id: vals = { 'journal_id': journal_id, 'name': 'Hardware - 3 Years', 'method_number': 3, 'account_asset_id': xfa_account_id, 'account_depreciation_id': xfa_account_id, 'account_depreciation_expense_id': expense_account_id, } self._update('account.asset.category', 'account_asset', vals, 'account_asset_category_fixedassets0') vals = { 'journal_id': journal_id, 'name': 'Cars - 5 Years', 'method_number': 5, 'account_asset_id': xfa_account_id, 'account_depreciation_id': xfa_account_id, 'account_depreciation_expense_id': expense_account_id, } self._update('account.asset.category', 'account_asset', vals, 'account_asset_category_fixedassets1') vals = { 'salvage_value': 2000.0, 'state': 'open', 'method_period': 12, 'method_number': 5, 'name': "CEO's car", 'value': 12000.0, 'category_id': ref('account_asset_category_fixedassets0'), } self._update('account.asset.asset', 'account_asset', vals, 'account_asset_asset_vehicles0') vals = { 'method_end': (datetime.now().replace(month=8, day=11) + timedelta(days=3*365)).strftime('%Y-%m-%d'), 'salvage_value': 0.0, 'method_time': 'end', 'name': 'V6 Engine and 10 inches tires', 'value': 2800.0, 'category_id': ref('account_asset_category_fixedassets0'), } self._update('account.asset.asset', 'account_asset', vals, 'account_asset_asset_cab0') vals = { 'prorata': 1, 'salvage_value': 100000.0, 'state': 'open', 'method_period': 12, 'method_number': 20, 'date': time.strftime('%Y-01-01'), 'name': 'Office', 'value': 500000.0, 'category_id': ref('account_asset_category_fixedassets0'), } self._update('account.asset.asset', 'account_asset', vals, 'account_asset_asset_office0')