diff --git a/base_accounting_kit/__manifest__.py b/base_accounting_kit/__manifest__.py index cab85697b..5a23b513f 100644 --- a/base_accounting_kit/__manifest__.py +++ b/base_accounting_kit/__manifest__.py @@ -21,14 +21,16 @@ ############################################################################# { 'name': 'Odoo 17 Full Accounting Kit', - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Accounting', - 'summary': """Odoo 17 Accounting, Asset and Budget Management,Accounting Reports, PDC, + 'summary': """Odoo 17 Accounting, Asset and Budget Management, + Accounting Reports, PDC, Lock dates, Credit Limit, Follow Ups, Day-Bank-Cash book reports.""", - 'description': """ Odoo 17 Accounting, The module used to manage the Full Account Features. - that can manage the Account Reports,Journals Asset and Budget Management, - Accounting Reports, PDC, Lock dates, Credit Limit, Follow Ups, - Day-Bank-Cash book report, odoo17, odoo17 accounting, odoo accounting, v17 accounting,Odoo 17 Accounting, odoo apps""", + 'description': """ Odoo 17 Accounting, The module used to manage the Full + Account Features that can manage the Account Reports,Journals Asset and + Budget Management, Accounting Reports, PDC, Lock dates, Credit Limit, + Follow Ups, Day-Bank-Cash book report, odoo17, odoo17 accounting, + odoo accounting, v17 accounting,Odoo 17 Accounting, odoo apps""", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', diff --git a/base_accounting_kit/data/account_financial_report_data.xml b/base_accounting_kit/data/account_financial_report_data.xml index 73ccd9dce..8343a4f0b 100644 --- a/base_accounting_kit/data/account_financial_report_data.xml +++ b/base_accounting_kit/data/account_financial_report_data.xml @@ -8,7 +8,6 @@ sum - Income @@ -29,7 +28,6 @@ account_type income_other - Gross Profit @@ -39,7 +37,6 @@ sum 3 - Cost of Revenue @@ -50,7 +47,6 @@ account_type expense_direct_cost - Operating Income @@ -61,7 +57,6 @@ account_type income - Expense @@ -73,13 +68,11 @@ account_type expense - Balance Sheet sum - Assets @@ -89,7 +82,6 @@ account_type income_other - Liability @@ -99,7 +91,6 @@ no_detail sum - Liability @@ -109,7 +100,6 @@ account_type income_other - Profit (Loss) to report @@ -120,7 +110,6 @@ - Common Report account.report diff --git a/base_accounting_kit/data/account_pdc_data.xml b/base_accounting_kit/data/account_pdc_data.xml index 4392dc982..cdcb49d97 100644 --- a/base_accounting_kit/data/account_pdc_data.xml +++ b/base_accounting_kit/data/account_pdc_data.xml @@ -1,7 +1,7 @@ - + PDC diff --git a/base_accounting_kit/data/cash_flow_data.xml b/base_accounting_kit/data/cash_flow_data.xml index 9b4447dd3..202eb34e6 100644 --- a/base_accounting_kit/data/cash_flow_data.xml +++ b/base_accounting_kit/data/cash_flow_data.xml @@ -1,20 +1,20 @@ - - - + + + Cash Flow Statement sum - - + Operations 1 detail_with_hierarchy sum - Cash In 1 @@ -22,7 +22,6 @@ detail_with_hierarchy accounts - Cash Out 2 @@ -30,46 +29,47 @@ detail_with_hierarchy accounts - - + Investing Activities 2 detail_with_hierarchy sum - Cash In - + detail_with_hierarchy accounts - Cash Out - + detail_with_hierarchy accounts - - + Financing Activities 3 detail_with_hierarchy sum - Cash In - + detail_with_hierarchy accounts Cash Out - + detail_with_hierarchy accounts diff --git a/base_accounting_kit/data/followup_levels.xml b/base_accounting_kit/data/followup_levels.xml index 55883ca7f..591bbab6c 100644 --- a/base_accounting_kit/data/followup_levels.xml +++ b/base_accounting_kit/data/followup_levels.xml @@ -1,13 +1,14 @@ - - + + Reminder 5 - + diff --git a/base_accounting_kit/data/multiple_invoice_data.xml b/base_accounting_kit/data/multiple_invoice_data.xml index 2e9b5ac99..5c1932f21 100644 --- a/base_accounting_kit/data/multiple_invoice_data.xml +++ b/base_accounting_kit/data/multiple_invoice_data.xml @@ -1,7 +1,7 @@ - + Sample Name diff --git a/base_accounting_kit/data/recurring_entry_cron.xml b/base_accounting_kit/data/recurring_entry_cron.xml index 30c940a2c..ccfe9853d 100644 --- a/base_accounting_kit/data/recurring_entry_cron.xml +++ b/base_accounting_kit/data/recurring_entry_cron.xml @@ -1,7 +1,7 @@ - + Generate Recurring Entries diff --git a/base_accounting_kit/doc/RELEASE_NOTES.md b/base_accounting_kit/doc/RELEASE_NOTES.md index f49104ac7..25839d865 100644 --- a/base_accounting_kit/doc/RELEASE_NOTES.md +++ b/base_accounting_kit/doc/RELEASE_NOTES.md @@ -1,7 +1,11 @@ ## Module -#### 06.11.2022 -#### Version 16.0.1.0.0 +#### 06.11.2023 +#### Version 17.0.1.0.0 #### ADD - Initial commit for Odoo 17 Full Accounting Kit +#### 15.01.2024 +#### Version 17.0.1.0.1 +##### UPDT +- Bug Fix-Resolved the alignment issues. diff --git a/base_accounting_kit/models/account_account.py b/base_accounting_kit/models/account_account.py index 0c8c62bd9..531bdb5a4 100644 --- a/base_accounting_kit/models/account_account.py +++ b/base_accounting_kit/models/account_account.py @@ -30,11 +30,14 @@ class CashFlow(models.Model): def get_cash_flow_ids(self): """Returns a list of cashflows for the account""" - cash_flow_id = self.env.ref('base_accounting_kit.account_financial_report_cash_flow0') + cash_flow_id = self.env.ref( + 'base_accounting_kit.account_financial_report_cash_flow0') if cash_flow_id: return [('parent_id.id', '=', cash_flow_id.id)] - cash_flow_type = fields.Many2one('account.financial.report', string="Cash Flow type", domain=get_cash_flow_ids) + cash_flow_type = fields.Many2one('account.financial.report', + string="Cash Flow type", + domain=get_cash_flow_ids) @api.onchange('cash_flow_type') def onchange_cash_flow_type(self): @@ -63,7 +66,8 @@ class AccountCommonReport(models.Model): comodel_name='account.journal', string='Journals', required=True, - default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]), + default=lambda self: self.env['account.journal'].search( + [('company_id', '=', self.company_id.id)]), domain="[('company_id', '=', company_id)]") date_from = fields.Date(string='Start Date') date_to = fields.Date(string='End Date') @@ -84,8 +88,10 @@ class AccountCommonReport(models.Model): def _build_contexts(self, data): """Builds the context information for the given data""" result = {} - result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False - result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' + result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][ + 'journal_ids'] or False + result['state'] = 'target_move' in data['form'] and data['form'][ + 'target_move'] or '' result['date_from'] = data['form']['date_from'] or False result['date_to'] = data['form']['date_to'] or False result['strict_range'] = True if result['date_from'] else False @@ -103,9 +109,12 @@ class AccountCommonReport(models.Model): data = {} data['ids'] = self.env.context.get('active_ids', []) data['model'] = self.env.context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0] + data['form'] = self.read( + ['date_from', 'date_to', 'journal_ids', 'target_move', + 'company_id'])[0] used_context = self._build_contexts(data) - data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code) + data['form']['used_context'] = dict(used_context, + lang=get_lang(self.env).code) return self.with_context(discard_logo_check=True)._print_report(data) @@ -152,16 +161,21 @@ class AccountCommonJournalReport(models.TransientModel): data = {} data['ids'] = self.env.context.get('active_ids', []) data['model'] = self.env.context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0] + data['form'] = self.read( + ['date_from', 'date_to', 'journal_ids', 'target_move', + 'company_id'])[0] used_context = self._build_contexts(data) - data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code) + data['form']['used_context'] = dict(used_context, + lang=get_lang(self.env).code) return self.with_context(discard_logo_check=True)._print_report(data) def _build_contexts(self, data): """Builds the context information for the given data""" result = {} - result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False - result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' + result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][ + 'journal_ids'] or False + result['state'] = 'target_move' in data['form'] and data['form'][ + 'target_move'] or '' result['date_from'] = data['form']['date_from'] or False result['date_to'] = data['form']['date_to'] or False result['strict_range'] = True if result['date_from'] else False diff --git a/base_accounting_kit/models/account_asset.py b/base_accounting_kit/models/account_asset.py index f18c8badd..4e0d38dd1 100644 --- a/base_accounting_kit/models/account_asset.py +++ b/base_accounting_kit/models/account_asset.py @@ -21,9 +21,7 @@ ############################################################################# import calendar from datetime import date, datetime - from dateutil.relativedelta import relativedelta - from odoo import api, fields, models, _ from odoo.exceptions import UserError, ValidationError from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF @@ -47,48 +45,82 @@ class AccountAssetCategory(models.Model): readonly=True, hide=True) account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account', - domain="[('company_id', '=', company_id)]") + domain="[('company_id', '=', " + "company_id)]") account_asset_id = fields.Many2one('account.account', string='Asset Account', required=True, - domain="[('account_type', '!=', 'asset_receivable'),('account_type', '!=', 'liability_payable'),('account_type', '!=', 'asset_cash'),('account_type', '!=', 'liability_credit_card'),('deprecated', '=', False)]", - help="Account used to record the purchase of the asset at its original price.") + domain="[('account_type', '!=', " + "'asset_receivable')," + "('account_type', '!=', " + "'liability_payable')," + "('account_type', '!=', " + "'asset_cash'),('account_type', " + "'!=', 'liability_credit_card')," + "('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 Account', required=True, - domain="[('account_type', '!=', 'asset_receivable'),('account_type', '!=', 'liability_payable'),('account_type', '!=', 'asset_cash'),('account_type', '!=', 'liability_credit_card'),('deprecated', '=', False),('company_id', '=', company_id)]", - help="Account used in the depreciation entries, to decrease the asset value.") + domain="[('account_type', '!=', 'asset_receivable'),('account_type'," + " '!=', 'liability_payable')," + "('account_type', '!=', 'asset_cash')" + ",('account_type', '!=', 'liability_credit_card')," + "('deprecated', '=', False),('company_id', '=', company_id)]", + help="Account used in the depreciation entries," + " to decrease the asset value.") account_depreciation_expense_id = fields.Many2one( 'account.account', string='Expense Account', required=True, - domain="[('account_type', '!=', 'asset_receivable'),('account_type', '!=','liability_payable'),('account_type', '!=', 'asset_cash'),('account_type', '!=','liability_credit_card'),('deprecated', '=', False),('company_id', '=', company_id)]", - help="Account used in the periodical entries, to record a part of the asset as expense.") + domain="[('account_type', '!=', 'asset_receivable')," + "('account_type', '!=','liability_payable')," + "('account_type', '!=', 'asset_cash')," + "('account_type', '!=','liability_credit_card')," + "('deprecated', '=', False),('company_id', '=', company_id)]", + help="Account used in the periodical entries, to record a part of the " + "asset as expense.") journal_id = fields.Many2one('account.journal', string='Journal', required=True) method = fields.Selection( [('linear', 'Linear'), ('degressive', 'Degressive')], string='Computation Method', required=True, 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") + 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") method_number = fields.Integer(string='Number of Depreciations', default=5, - help="The number of depreciations needed to depreciate your asset") + 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", + 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', - 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.") + 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') + help='Indicates that the first depreciation entry' + ' for this asset have to be done from the ' + 'purchase date instead of the first of' + ' January') 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.") + 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.") + 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') @@ -127,57 +159,76 @@ class AccountAssetAsset(models.Model): digits=0) currency_id = fields.Many2one('res.currency', string='Currency', required=True, readonly=True, - default=lambda self: self.env.company.currency_id.id) + default=lambda + self: self.env.company.currency_id.id) company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company) note = fields.Text() - category_id = fields.Many2one('account.asset.category', string='Category', + category_id = fields.Many2one('account.asset.category', + string='Category', required=True, change_default=True, - readonly=True,) + readonly=True, ) date = fields.Date(string='Date', required=True, readonly=True, default=fields.Date.context_today) state = fields.Selection( [('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], 'Status', required=True, copy=False, default='draft', help="When an asset is created, the status is 'Draft'.\n" - "If the asset is confirmed, the status goes in 'Running' and the depreciation lines can be posted in the accounting.\n" - "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.") + "If the asset is confirmed, the status goes in 'Running' and the " + "depreciation lines can be posted in the accounting.\n" + "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) method = fields.Selection( [('linear', 'Linear'), ('degressive', 'Degressive')], - string='Computation Method', required=True, readonly=True, 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") + string='Computation Method', required=True, readonly=True, + 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") method_number = fields.Integer(string='Number of Depreciations', readonly=True, default=5, - help="The number of depreciations needed to depreciate your asset") + help="The number of depreciations needed " + "to depreciate your asset") method_period = fields.Integer(string='Number of Months in a Period', required=True, readonly=True, default=12, - help="The amount of time between two depreciations, in months") - method_end = fields.Date(string='Ending Date', readonly=True,) + help="The amount of time between two " + "depreciations, in months") + method_end = fields.Date(string='Ending Date', readonly=True, ) method_progress_factor = fields.Float(string='Degressive Factor', - readonly=True, default=0.3,) + readonly=True, default=0.3, ) value_residual = fields.Float(compute='_amount_residual', 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', - 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.") + 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.") prorata = fields.Boolean(string='Prorata Temporis', readonly=True, - 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') - depreciation_line_ids = fields.One2many('account.asset.depreciation.line', - 'asset_id', - string='Depreciation Lines', - readonly=True,) + 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') + depreciation_line_ids = fields.One2many( + 'account.asset.depreciation.line', + 'asset_id', + string='Depreciation Lines', + readonly=True, ) salvage_value = fields.Float(string='Salvage Value', digits=0, readonly=True, - help="It is the amount you plan to have that you cannot depreciate.") + help="It is the amount you plan to have that " + "you cannot depreciate.") invoice_id = fields.Many2one('account.move', string='Invoice', copy=False) type = fields.Selection(related="category_id.type", string='Type', @@ -192,18 +243,22 @@ class AccountAssetAsset(models.Model): for depreciation_line in asset.depreciation_line_ids: if depreciation_line.move_id: raise UserError(_( - 'You cannot delete a document that contains posted entries.')) + 'You cannot delete a document that contains ' + 'posted entries.')) return super(AccountAssetAsset, self).unlink() def _get_last_depreciation_date(self): """ @param id: ids of a account.asset.asset objects - @return: Returns a dictionary of the effective dates of the last depreciation entry made for given asset ids. If there isn't any, return the purchase date of this asset + @return: Returns a dictionary of the effective dates of the last + depreciation entry made for given asset ids. If there isn't any, + return the purchase date of this asset """ self.env.cr.execute(""" SELECT a.id as id, COALESCE(MAX(m.date),a.date) AS date FROM account_asset_asset a - LEFT JOIN account_asset_depreciation_line rel ON (rel.asset_id = a.id) + LEFT JOIN account_asset_depreciation_line rel ON + (rel.asset_id = a.id) LEFT JOIN account_move m ON (rel.move_id = m.id) WHERE a.id IN %s GROUP BY a.id, m.date """, (tuple(self.ids),)) @@ -219,7 +274,8 @@ class AccountAssetAsset(models.Model): @api.model def compute_generated_entries(self, date, asset_type=None): - # Entries generated : one by grouped category and one by asset from ungrouped category + # Entries generated : one by grouped category and one by asset + # from ungrouped category created_move_ids = [] type_domain = [] if asset_type: @@ -228,8 +284,8 @@ class AccountAssetAsset(models.Model): ungrouped_assets = self.env['account.asset.asset'].search( type_domain + [('state', '=', 'open'), ('category_id.group_entries', '=', False)]) - created_move_ids += ungrouped_assets._compute_entries(date, - group_entries=False) + created_move_ids += (ungrouped_assets. + _compute_entries(date, group_entries=False)) for grouped_category in self.env['account.asset.category'].search( type_domain + [('group_entries', '=', True)]): @@ -260,14 +316,16 @@ class AccountAssetAsset(models.Model): month_days = \ calendar.monthrange(date.year, date.month)[1] days = month_days - date.day + 1 - amount = ( - amount_to_depr / self.method_number) / month_days * days + amount = ((amount_to_depr / self.method_number) + / month_days * days) 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 + amount = (( + amount_to_depr / + self.method_number) / + total_days * days) elif self.method == 'degressive': amount = residual_amount * self.method_progress_factor if self.prorata: @@ -278,14 +336,18 @@ class AccountAssetAsset(models.Model): month_days = \ calendar.monthrange(date.year, date.month)[1] days = month_days - date.day + 1 - amount = ( - residual_amount * self.method_progress_factor) / month_days * days + amount = (( + residual_amount * + self.method_progress_factor) / + month_days * days) 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 + amount = (( + residual_amount * + self.method_progress_factor) / + total_days * days) return amount def _compute_board_undone_dotation_nb(self, depreciation_date, total_days): @@ -310,14 +372,16 @@ class AccountAssetAsset(models.Model): unposted_depreciation_line_ids = self.depreciation_line_ids.filtered( lambda x: not x.move_check) - # Remove old unposted depreciation lines. We cannot use unlink() with One2many field + # Remove old unposted depreciation lines. We cannot use unlink() + # with One2many field commands = [(2, line_id.id, False) for line_id in unposted_depreciation_line_ids] if self.value_residual != 0.0: amount_to_depr = residual_amount = self.value_residual if self.prorata: - # if we already have some previous validated entries, starting date is last entry + method perio + # 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( @@ -330,25 +394,29 @@ class AccountAssetAsset(models.Model): str(self._get_last_depreciation_date()[self.id]), DF).date() else: - # depreciation_date = 1st of January of purchase year if annual valuation, 1st of + # depreciation_date = 1st of January of purchase year if + # annual valuation, 1st of # purchase month in other cases if self.method_period >= 12: if self.company_id.fiscalyear_last_month: - asset_date = date(year=int(self.date.year), - month=int( - self.company_id.fiscalyear_last_month), - day=int( - self.company_id.fiscalyear_last_day)) + relativedelta( - days=1) + \ - relativedelta(year=int( - self.date.year)) # e.g. 2018-12-31 +1 -> 2019 + asset_date = (date(year=int(self.date.year), + month=int( + self.company_id.fiscalyear_last_month), + day=int( + self.company_id. + fiscalyear_last_day)) + + relativedelta(days=1) + relativedelta( + year=int( + self.date.year))) + # e.g. 2018-12-31 +1 -> 2019 else: asset_date = datetime.strptime( str(self.date)[:4] + '-01-01', DF).date() else: asset_date = datetime.strptime(str(self.date)[:7] + '-01', DF).date() - # if we already have some previous validated entries, starting date isn't 1st January but last entry + method period + # if we already have some previous validated entries, starting + # date isn't 1st January but last entry + method period if posted_depreciation_line_ids and \ posted_depreciation_line_ids[-1].depreciation_date: last_depreciation_date = datetime.strptime(str( @@ -386,7 +454,8 @@ class AccountAssetAsset(models.Model): 'asset_id': self.id, 'sequence': sequence, 'name': (self.code or '') + '/' + str(sequence), - 'remaining_value': residual_amount if residual_amount >= 0 else 0.0, + 'remaining_value': residual_amount if + residual_amount >= 0 else 0.0, 'depreciated_value': self.value - ( self.salvage_value + residual_amount), 'depreciation_date': depreciation_date.strftime(DF), @@ -433,8 +502,9 @@ class AccountAssetAsset(models.Model): def _get_disposal_moves(self): move_ids = [] for asset in self: - unposted_depreciation_line_ids = asset.depreciation_line_ids.filtered( - lambda x: not x.move_check) + unposted_depreciation_line_ids = ( + asset.depreciation_line_ids.filtered( + lambda x: not x.move_check)) if unposted_depreciation_line_ids: old_values = { 'method_end': asset.method_end, @@ -469,7 +539,8 @@ class AccountAssetAsset(models.Model): tracked_fields, old_values) if changes: asset.message_post(subject=_( - 'Asset sold or disposed. Accounting entry awaiting for validation.'), + 'Asset sold or disposed. Accounting entry awaiting ' + 'for validation.'), tracking_value_ids=tracking_value_ids) move_ids += asset.depreciation_line_ids[-1].create_move( post_move=False) @@ -498,7 +569,8 @@ class AccountAssetAsset(models.Model): def set_to_draft(self): self.write({'state': 'draft'}) - @api.depends('value', 'salvage_value', 'depreciation_line_ids.move_check', + @api.depends('value', 'salvage_value', + 'depreciation_line_ids.move_check', 'depreciation_line_ids.amount') def _amount_residual(self): for record in self: @@ -506,7 +578,8 @@ class AccountAssetAsset(models.Model): for line in record.depreciation_line_ids: if line.move_check: total_amount += line.amount - record.value_residual = record.value - total_amount - record.salvage_value + record.value_residual = (record.value - total_amount - + record.salvage_value) @api.onchange('company_id') def onchange_company_id(self): @@ -523,7 +596,8 @@ class AccountAssetAsset(models.Model): def _check_prorata(self): if self.prorata and self.method_time != 'number': raise ValidationError(_( - 'Prorata temporis can be applied only for time method "number of depreciations".')) + 'Prorata temporis can be applied only for time method ' + '"number of depreciations".')) @api.onchange('category_id') def onchange_category_id(self): @@ -614,7 +688,8 @@ class AccountAssetDepreciationLine(models.Model): depreciated_value = fields.Float(string='Cumulative Depreciation', required=True) depreciation_date = fields.Date('Depreciation Date', index=True) - move_id = fields.Many2one('account.move', string='Depreciation Entry') + move_id = fields.Many2one('account.move', string='Depreciation ' + 'Entry') move_check = fields.Boolean(compute='_get_move_check', string='Linked', store=True) move_posted_check = fields.Boolean(compute='_get_move_posted_check', @@ -628,61 +703,79 @@ class AccountAssetDepreciationLine(models.Model): @api.depends('move_id.state') def _get_move_posted_check(self): for line in self: - line.move_posted_check = True if line.move_id and line.move_id.state == 'posted' else False + line.move_posted_check = True if (line.move_id and + line.move_id.state == 'posted')\ + else False def create_move(self, post_move=True): created_moves = self.env['account.move'] prec = self.env['decimal.precision'].precision_get('Account') if self.mapped('move_id'): raise UserError(_( - 'This depreciation is already linked to a journal entry! Please post or delete it.')) + 'This depreciation is already linked to a journal entry! ' + 'Please post or delete it.')) for line in self: 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) + 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 current_currency = line.asset_id.currency_id amount = current_currency.with_context( date=depreciation_date).compute(line.amount, company_currency) - asset_name = line.asset_id.name + ' (%s/%s)' % (line.sequence, len(line.asset_id.depreciation_line_ids)) - partner = self.env['res.partner']._find_accounting_partner(line.asset_id.partner_id) + asset_name = line.asset_id.name + ' (%s/%s)' % ( + line.sequence, len(line.asset_id.depreciation_line_ids)) + partner = self.env['res.partner']._find_accounting_partner( + line.asset_id.partner_id) move_line_1 = { 'name': asset_name, 'account_id': category_id.account_depreciation_id.id, 'debit': 0.0 if float_compare(amount, 0.0, - precision_digits=prec) > 0 else -amount, + precision_digits=prec) > 0 + else -amount, 'credit': amount if float_compare(amount, 0.0, - precision_digits=prec) > 0 else 0.0, + precision_digits=prec) > 0 + else 0.0, 'journal_id': category_id.journal_id.id, 'partner_id': partner.id, - # 'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'sale' else False, - 'currency_id': company_currency != current_currency and current_currency.id or company_currency.id, - 'amount_currency': company_currency != current_currency and - 1.0 * line.amount or 0.0, + # 'analytic_account_id': category_id.account_analytic_id.id if + # category_id.type == 'sale' else False, + 'currency_id': company_currency != current_currency and + current_currency.id or company_currency.id, + 'amount_currency': company_currency != current_currency + and - 1.0 * line.amount or 0.0, } move_line_2 = { 'name': asset_name, 'account_id': category_id.account_depreciation_expense_id.id, 'credit': 0.0 if float_compare(amount, 0.0, - precision_digits=prec) > 0 else -amount, + precision_digits=prec) > 0 + else -amount, 'debit': amount if float_compare(amount, 0.0, - precision_digits=prec) > 0 else 0.0, + precision_digits=prec) > 0 + else 0.0, 'journal_id': category_id.journal_id.id, 'partner_id': partner.id, - # 'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'purchase' else False, - 'currency_id': company_currency != current_currency and current_currency.id or company_currency.id, - 'amount_currency': company_currency != current_currency and line.amount or 0.0, + # 'analytic_account_id': category_id.account_analytic_id.id + # if category_id.type == 'purchase' else False, + 'currency_id': company_currency != current_currency and + current_currency.id or company_currency.id, + 'amount_currency': company_currency != current_currency and + line.amount or 0.0, } line_ids = [(0, 0, { 'account_id': category_id.account_depreciation_id.id, 'partner_id': partner.id, 'credit': amount if float_compare(amount, 0.0, - precision_digits=prec) > 0 else 0.0, + precision_digits=prec) > 0 + else 0.0, }), (0, 0, { 'account_id': category_id.account_depreciation_expense_id.id, 'partner_id': partner.id, 'debit': amount if float_compare(amount, 0.0, - precision_digits=prec) > 0 else 0.0, + precision_digits=prec) > 0 + else 0.0, })] move = self.env['account.move'].create({ 'ref': line.asset_id.code, @@ -703,7 +796,6 @@ class AccountAssetDepreciationLine(models.Model): lambda x: x.name == 'Automatic Balancing Line').unlink() line.write({'move_id': move.id, 'move_check': True}) created_moves |= move - if post_move and created_moves: created_moves.filtered(lambda m: any( m.asset_depreciation_ids.mapped( @@ -713,10 +805,10 @@ class AccountAssetDepreciationLine(models.Model): def create_grouped_move(self, post_move=True): if not self.exists(): return [] - created_moves = self.env['account.move'] category_id = self[ - 0].asset_id.category_id # we can suppose that all lines have the same category + 0].asset_id.category_id # we can suppose that all lines have the + # same category depreciation_date = self.env.context.get( 'depreciation_date') or fields.Date.context_today(self) amount = 0.0 @@ -725,7 +817,6 @@ class AccountAssetDepreciationLine(models.Model): company_currency = line.asset_id.company_id.currency_id current_currency = line.asset_id.currency_id amount += current_currency.compute(line.amount, company_currency) - name = category_id.name + _(' (grouped)') move_line_1 = { 'name': name, @@ -733,7 +824,8 @@ class AccountAssetDepreciationLine(models.Model): 'debit': 0.0, 'credit': amount, 'journal_id': category_id.journal_id.id, - 'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'sale' else False, + 'analytic_account_id': category_id.account_analytic_id.id + if category_id.type == 'sale' else False, } move_line_2 = { 'name': name, @@ -741,7 +833,8 @@ class AccountAssetDepreciationLine(models.Model): 'credit': 0.0, 'debit': amount, 'journal_id': category_id.journal_id.id, - 'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'purchase' else False, + 'analytic_account_id': category_id.account_analytic_id.id + if category_id.type == 'purchase' else False, } move_vals = { 'ref': category_id.name, @@ -752,7 +845,6 @@ class AccountAssetDepreciationLine(models.Model): move = self.env['account.move'].create(move_vals) self.write({'move_id': move.id, 'move_check': True}) created_moves |= move - if post_move and created_moves: self.post_lines_and_close_asset() created_moves.post() @@ -762,7 +854,8 @@ class AccountAssetDepreciationLine(models.Model): # we re-evaluate the assets to determine whether we can close them # `message_post` invalidates the (whole) cache # preprocess the assets and lines in which a message should be posted, - # and then post in batch will prevent the re-fetch of the same data over and over. + # and then post in batch will prevent the re-fetch of the same + # data over and over. assets_to_close = self.env['account.asset.asset'] for line in self: asset = line.asset_id @@ -782,10 +875,10 @@ class AccountAssetDepreciationLine(models.Model): message += '
    • %s: ' % name message += '%s
' % values return message - # `message_post` invalidates the (whole) cache # preprocess the assets in which messages should be posted, - # and then post in batch will prevent the re-fetch of the same data over and over. + # and then post in batch will prevent the re-fetch of the same data + # over and over. assets_to_post = {} for line in self: if line.move_id and line.move_id.state == 'draft': diff --git a/base_accounting_kit/models/account_followup.py b/base_accounting_kit/models/account_followup.py index 9448974b0..44d5fab9f 100644 --- a/base_accounting_kit/models/account_followup.py +++ b/base_accounting_kit/models/account_followup.py @@ -19,7 +19,6 @@ # If not, see . # ############################################################################# - from odoo import fields, models @@ -28,7 +27,8 @@ class Followup(models.Model): _description = 'Account Follow-up' _rec_name = 'name' - followup_line_ids = fields.One2many('followup.line', 'followup_id', + followup_line_ids = fields.One2many('followup.line', + 'followup_id', 'Follow-up', copy=True) company_id = fields.Many2one('res.company', 'Company', default=lambda self: self.env.company) @@ -42,10 +42,14 @@ class FollowupLine(models.Model): name = fields.Char('Follow-Up Action', required=True, translate=True) sequence = fields.Integer( - help="Gives the sequence order when displaying a list of follow-up lines.") + help="Gives the sequence order when displaying a list of follow-up " + "lines.") delay = fields.Integer('Due Days', required=True, - help="The number of days after the due date of the invoice" + help="The number of days after the due date of " + "the invoice" " to wait before sending the reminder." - " Could be negative if you want to send a polite alert beforehand.") - followup_id = fields.Many2one('account.followup', 'Follow Ups', + " Could be negative if you want to send a " + "polite alert beforehand.") + followup_id = fields.Many2one('account.followup', + 'Follow Ups', ondelete="cascade") diff --git a/base_accounting_kit/models/account_journal.py b/base_accounting_kit/models/account_journal.py index 055c935dc..c75734636 100644 --- a/base_accounting_kit/models/account_journal.py +++ b/base_accounting_kit/models/account_journal.py @@ -27,29 +27,6 @@ class AccountJournal(models.Model): journal""" _inherit = "account.journal" - # def action_open_reconcile(self): - # self.ensure_one() - # - # if self.type in ('bank', 'cash'): - # return self.env['account.bank.statement.line']._action_open_bank_reconciliation_widget( - # default_context={ - # 'default_journal_id': self.id, - # 'search_default_journal_id': self.id, - # 'search_default_not_matched': True, - # }, - # ) - # else: - # # Open reconciliation view for customers/suppliers - # action_context = {'show_mode_selector': False, 'company_ids': self.mapped('company_id').ids} - # if self.type == 'sale': - # action_context.update({'mode': 'customers'}) - # elif self.type == 'purchase': - # action_context.update({'mode': 'suppliers'}) - # return { - # 'type': 'ir.actions.client', - # 'tag': 'manual_reconciliation_view', - # 'context': action_context, - # } def action_open_reconcile(self): """Function to open reconciliation view for bank statements belonging to this journal""" diff --git a/base_accounting_kit/models/account_move.py b/base_accounting_kit/models/account_move.py index 0b745926a..191fbe8b8 100644 --- a/base_accounting_kit/models/account_move.py +++ b/base_accounting_kit/models/account_move.py @@ -32,9 +32,10 @@ class AccountMove(models.Model): field to the account""" _inherit = 'account.move' - asset_depreciation_ids = fields.One2many('account.asset.depreciation.line', - 'move_id', - string='Assets Depreciation Lines') + asset_depreciation_ids = fields.One2many( + 'account.asset.depreciation.line', + 'move_id', + string='Assets Depreciation Lines') def button_cancel(self): """Button action to cancel the transfer""" @@ -108,7 +109,8 @@ class AccountInvoiceLine(models.Model): if cat: if cat.method_number == 0 or cat.method_period == 0: raise UserError(_( - 'The number of depreciations or the period length of your asset category cannot be null.')) + 'The number of depreciations or the period length of ' + 'your asset category cannot be null.')) months = cat.method_number * cat.method_period if record.move_id in ['out_invoice', 'out_refund']: record.asset_mrr = record.price_subtotal_signed / months @@ -167,9 +169,12 @@ class AccountInvoiceLine(models.Model): vals = super(AccountInvoiceLine, self)._compute_price_unit() if self.product_id: if self.move_id.move_type == 'out_invoice': - self.asset_category_id = self.product_id.product_tmpl_id.deferred_revenue_category_id + self.asset_category_id = ( + self.product_id.product_tmpl_id. + deferred_revenue_category_id) elif self.move_id.move_type == 'in_invoice': - self.asset_category_id = self.product_id.product_tmpl_id.asset_category_id + self.asset_category_id = ( + self.product_id.product_tmpl_id.asset_category_id) return vals def _set_additional_fields(self, invoice): @@ -177,9 +182,12 @@ class AccountInvoiceLine(models.Model): move types""" if not self.asset_category_id: if invoice.type == 'out_invoice': - self.asset_category_id = self.product_id.product_tmpl_id.deferred_revenue_category_id.id + self.asset_category_id =\ + (self.product_id.product_tmpl_id. + deferred_revenue_category_id.id) elif invoice.type == 'in_invoice': - self.asset_category_id = self.product_id.product_tmpl_id.asset_category_id.id + self.asset_category_id = ( + self.product_id.product_tmpl_id.asset_category_id.id) self.onchange_asset_category_id() super(AccountInvoiceLine, self)._set_additional_fields(invoice) @@ -193,12 +201,10 @@ class AccountInvoiceLine(models.Model): def _query_get(self, domain=None): """Used to add domain constraints to the query""" self.check_access_rights('read') - context = dict(self._context or {}) domain = domain or [] if not isinstance(domain, (list, tuple)): domain = ast.literal_eval(domain) - date_field = 'date' if context.get('aged_balance'): date_field = 'date_maturity' @@ -212,55 +218,49 @@ class AccountInvoiceLine(models.Model): domain += [(date_field, '<', context['date_from'])] else: domain += [(date_field, '>=', context['date_from'])] - if context.get('journal_ids'): domain += [('journal_id', 'in', context['journal_ids'])] - state = context.get('state') if state and state.lower() != 'all': domain += [('parent_state', '=', state)] - if context.get('company_id'): domain += [('company_id', '=', context['company_id'])] elif context.get('allowed_company_ids'): domain += [('company_id', 'in', self.env.companies.ids)] else: domain += [('company_id', '=', self.env.company.id)] - if context.get('reconcile_date'): domain += ['|', ('reconciled', '=', False), '|', - ('matched_debit_ids.max_date', '>', context['reconcile_date']), - ('matched_credit_ids.max_date', '>', context['reconcile_date'])] - + ('matched_debit_ids.max_date', '>', + context['reconcile_date']), + ('matched_credit_ids.max_date', '>', + context['reconcile_date'])] if context.get('account_tag_ids'): - domain += [('account_id.tag_ids', 'in', context['account_tag_ids'].ids)] - + domain += [ + ('account_id.tag_ids', 'in', context['account_tag_ids'].ids)] if context.get('account_ids'): domain += [('account_id', 'in', context['account_ids'].ids)] - if context.get('analytic_tag_ids'): - domain += [('analytic_tag_ids', 'in', context['analytic_tag_ids'].ids)] - + domain += [ + ('analytic_tag_ids', 'in', context['analytic_tag_ids'].ids)] if context.get('analytic_account_ids'): - domain += [('analytic_account_id', 'in', context['analytic_account_ids'].ids)] - + domain += [('analytic_account_id', 'in', + context['analytic_account_ids'].ids)] if context.get('partner_ids'): domain += [('partner_id', 'in', context['partner_ids'].ids)] - if context.get('partner_categories'): - domain += [('partner_id.category_id', 'in', context['partner_categories'].ids)] - + domain += [('partner_id.category_id', 'in', + context['partner_categories'].ids)] where_clause = "" where_clause_params = [] tables = '' if domain: - domain.append(('display_type', 'not in', ('line_section', 'line_note'))) + domain.append( + ('display_type', 'not in', ('line_section', 'line_note'))) domain.append(('parent_state', '!=', 'cancel')) - query = self._where_calc(domain) - - # Wrap the query with 'company_id IN (...)' to avoid bypassing company access rights. + # Wrap the query with 'company_id IN (...)' to avoid bypassing + # company access rights. self._apply_ir_rules(query) - tables, where_clause, where_clause_params = query.get_sql() return tables, where_clause, where_clause_params diff --git a/base_accounting_kit/models/credit_limit.py b/base_accounting_kit/models/credit_limit.py index 37d50b758..0ce78bc1b 100644 --- a/base_accounting_kit/models/credit_limit.py +++ b/base_accounting_kit/models/credit_limit.py @@ -19,8 +19,7 @@ # If not, see . # ############################################################################# - -from odoo import models, fields, api +from odoo import api, fields, models from odoo.exceptions import UserError from odoo.tools.translate import _ diff --git a/base_accounting_kit/models/multiple_invoice.py b/base_accounting_kit/models/multiple_invoice.py index e1c889655..3401ed807 100644 --- a/base_accounting_kit/models/multiple_invoice.py +++ b/base_accounting_kit/models/multiple_invoice.py @@ -30,7 +30,8 @@ class MultipleInvoice(models.Model): sequence = fields.Integer(string='Sequence No') copy_name = fields.Char(string='Invoice Copy Name') - journal_id = fields.Many2one('account.journal', string="Journal") + journal_id = fields.Many2one('account.journal', + string="Journal") class AccountJournal(models.Model): diff --git a/base_accounting_kit/models/multiple_invoice_layout.py b/base_accounting_kit/models/multiple_invoice_layout.py index 176e80939..aa12b64c6 100644 --- a/base_accounting_kit/models/multiple_invoice_layout.py +++ b/base_accounting_kit/models/multiple_invoice_layout.py @@ -42,9 +42,11 @@ class MultipleInvoiceLayout(models.TransientModel): [('id', '=', self.env.context.get('active_id'))]).id company_id = fields.Many2one( - 'res.company', default=lambda self: self.env.company, required=True) + 'res.company', default=lambda self: self.env.company, + required=True) layout = fields.Char(related="company_id.external_report_layout_id.key") - journal_id = fields.Many2one('account.journal', string='Journal', + journal_id = fields.Many2one('account.journal', + string='Journal', required=True, default=_get_default_journal) multiple_invoice_type = fields.Selection( related='journal_id.multiple_invoice_type', readonly=False, @@ -67,7 +69,8 @@ class MultipleInvoiceLayout(models.TransientModel): strip_style=False, strip_classes=False) - @api.depends('multiple_invoice_type', 'text_position', 'body_text_position', + @api.depends('multiple_invoice_type', 'text_position', + 'body_text_position', 'text_align') def _compute_preview(self): """ compute a qweb based preview to display on the wizard """ @@ -123,7 +126,8 @@ class MultipleInvoiceLayout(models.TransientModel): precision = 8 output_style = 'expanded' - bootstrap_path = get_resource_path('web', 'static', 'lib', 'bootstrap', + bootstrap_path = get_resource_path('web', 'static', + 'lib', 'bootstrap', 'scss') try: return libsass.compile( diff --git a/base_accounting_kit/models/product_template.py b/base_accounting_kit/models/product_template.py index c38f2340f..7b9ca1cf9 100644 --- a/base_accounting_kit/models/product_template.py +++ b/base_accounting_kit/models/product_template.py @@ -26,8 +26,12 @@ class ProductTemplate(models.Model): """Inherited the model for adding new fields and functions""" _inherit = 'product.template' - asset_category_id = fields.Many2one('account.asset.category', string='Asset Type', company_dependent=True, ondelete="restrict") - deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', company_dependent=True, ondelete="restrict") + asset_category_id = fields.Many2one( + 'account.asset.category', string='Asset Type', + company_dependent=True, ondelete="restrict") + deferred_revenue_category_id = fields.Many2one( + 'account.asset.category', string='Deferred Revenue Type', + company_dependent=True, ondelete="restrict") def _get_asset_accounts(self): res = super(ProductTemplate, self)._get_asset_accounts() diff --git a/base_accounting_kit/models/recurring_payments.py b/base_accounting_kit/models/recurring_payments.py index 7bf8d80fc..f8bd1c9ce 100644 --- a/base_accounting_kit/models/recurring_payments.py +++ b/base_accounting_kit/models/recurring_payments.py @@ -21,7 +21,7 @@ ############################################################################# from datetime import datetime, date from dateutil.relativedelta import relativedelta -from odoo import api, models, fields +from odoo import api, fields, models class FilterRecurringEntries(models.Model): @@ -55,19 +55,24 @@ class RecurringPayments(models.Model): self.next_date = start_date.date() name = fields.Char(string='Name') - debit_account = fields.Many2one('account.account', 'Debit Account', + debit_account = fields.Many2one('account.account', + 'Debit Account', required=True, domain="['|', ('company_id', '=', False), " "('company_id', '=', company_id)]") - credit_account = fields.Many2one('account.account', 'Credit Account', + credit_account = fields.Many2one('account.account', + 'Credit Account', required=True, domain="['|', ('company_id', '=', False), " "('company_id', '=', company_id)]") - journal_id = fields.Many2one('account.journal', 'Journal', required=True) + journal_id = fields.Many2one('account.journal', + 'Journal', required=True) analytic_account_id = fields.Many2one('account.analytic.account', 'Analytic Account') - date = fields.Date('Starting Date', required=True, default=date.today()) - next_date = fields.Date('Next Schedule', compute=_get_next_schedule, + date = fields.Date('Starting Date', required=True, + default=date.today()) + next_date = fields.Date('Next Schedule', + compute=_get_next_schedule, readonly=True, copy=False) recurring_period = fields.Selection(selection=[('days', 'Days'), ('weeks', 'Weeks'), @@ -90,7 +95,8 @@ class RecurringPayments(models.Model): store=True, required=True) company_id = fields.Many2one('res.company', default=lambda l: l.env.company.id) - recurring_lines = fields.One2many('account.recurring.entries.line', 'tmpl_id') + recurring_lines = fields.One2many( + 'account.recurring.entries.line', 'tmpl_id') @api.onchange('partner_id') def onchange_partner_id(self): @@ -115,7 +121,8 @@ class RecurringPayments(models.Model): for line in data: if line.date: recurr_dates = [] - start_date = datetime.strptime(str(line.date), '%Y-%m-%d') + start_date = datetime.strptime(str(line.date), + '%Y-%m-%d') while start_date <= today: recurr_dates.append(str(start_date.date())) if line.recurring_period == 'days': @@ -175,6 +182,7 @@ class GetAllRecurringEntries(models.TransientModel): date = fields.Date('Date') template_name = fields.Char('Name') amount = fields.Float('Amount') - tmpl_id = fields.Many2one('account.recurring.payments', string='id') + tmpl_id = fields.Many2one('account.recurring.payments', + string='id') diff --git a/base_accounting_kit/models/res_company.py b/base_accounting_kit/models/res_company.py index 93a2b1e89..c88019cf4 100644 --- a/base_accounting_kit/models/res_company.py +++ b/base_accounting_kit/models/res_company.py @@ -19,11 +19,8 @@ # If not, see . # ############################################################################# - -from datetime import date, timedelta - -from odoo import fields, models,_ -from odoo.exceptions import UserError, ValidationError, AccessError, RedirectWarning +from odoo import models, _ +from odoo.exceptions import RedirectWarning class ResCompany(models.Model): @@ -31,44 +28,51 @@ class ResCompany(models.Model): def _validate_fiscalyear_lock(self, values): if values.get('fiscalyear_lock_date'): - draft_entries = self.env['account.move'].search([ ('company_id', 'in', self.ids), ('state', '=', 'draft'), ('date', '<=', values['fiscalyear_lock_date'])]) if draft_entries: - error_msg = _('There are still unposted entries in the period you want to lock. You should either post or delete them.') + error_msg = _('There are still unposted entries in the ' + 'period you want to lock. You should either post ' + 'or delete them.') action_error = { 'view_mode': 'tree', 'name': 'Unposted Entries', 'res_model': 'account.move', 'type': 'ir.actions.act_window', 'domain': [('id', 'in', draft_entries.ids)], - 'search_view_id': [self.env.ref('account.view_account_move_filter').id, 'search'], - 'views': [[self.env.ref('account.view_move_tree').id, 'list'], [self.env.ref('account.view_move_form').id, 'form']], + 'search_view_id': [self.env.ref( + 'account.view_account_move_filter').id, 'search'], + 'views': [[self.env.ref( + 'account.view_move_tree').id, 'list'], + [self.env.ref('account.view_move_form').id, + 'form']], } - raise RedirectWarning(error_msg, action_error, _('Show unposted entries')) - - unreconciled_statement_lines = self.env['account.bank.statement.line'].search([ + raise RedirectWarning(error_msg, action_error, + _('Show unposted entries')) + unreconciled_statement_lines = self.env[ + 'account.bank.statement.line'].search([ ('company_id', 'in', self.ids), ('is_reconciled', '=', False), ('date', '<=', values['fiscalyear_lock_date']), ('move_id.state', 'in', ('draft', 'posted')), ]) if unreconciled_statement_lines: - error_msg = _("There are still unreconciled bank statement lines in the period you want to lock." - "You should either reconcile or delete them.") + error_msg = _( + "There are still unreconciled bank statement lines in the " + "period you want to lock." + "You should either reconcile or delete them.") action_error = { 'view_mode': 'tree', 'name': 'Unreconciled Transactions', 'res_model': 'account.bank.statement.line', 'type': 'ir.actions.act_window', 'domain': [('id', 'in', unreconciled_statement_lines.ids)], - # 'search_view_id': [self.env.ref('account.view_account_move_filter').id, 'search'], - 'views': [[self.env.ref('base_accounting_kit.view_bank_statement_line_tree').id, 'list']] - # [self.env.ref('account.view_move_form').id, 'form']], + 'views': [[self.env.ref( + 'base_accounting_kit.view_bank_statement_line_tree').id, + 'list']] } - # action_error = self._get_fiscalyear_lock_statement_lines_redirect_action(unreconciled_statement_lines) - raise RedirectWarning(error_msg, action_error, _('Show Unreconciled Bank Statement Line')) - - + raise RedirectWarning(error_msg, action_error, + _('Show Unreconciled Bank' + ' Statement Line')) diff --git a/base_accounting_kit/models/res_config_settings.py b/base_accounting_kit/models/res_config_settings.py index 09c4f5c33..f8b2d0a30 100644 --- a/base_accounting_kit/models/res_config_settings.py +++ b/base_accounting_kit/models/res_config_settings.py @@ -19,8 +19,7 @@ # If not, see . # ############################################################################# - -from odoo import models, fields, api +from odoo import api, fields, models class ResConfigSettings(models.TransientModel): @@ -28,8 +27,9 @@ class ResConfigSettings(models.TransientModel): customer_credit_limit = fields.Boolean(string="Customer Credit Limit") - use_anglo_saxon_accounting = fields.Boolean(string="Use Anglo-Saxon accounting", readonly=False, - related='company_id.anglo_saxon_accounting') + use_anglo_saxon_accounting = fields.Boolean( + string="Use Anglo-Saxon accounting", readonly=False, + related='company_id.anglo_saxon_accounting') @api.model def get_values(self): diff --git a/base_accounting_kit/models/res_partner.py b/base_accounting_kit/models/res_partner.py index 031c54ab6..7635e1fe8 100644 --- a/base_accounting_kit/models/res_partner.py +++ b/base_accounting_kit/models/res_partner.py @@ -19,16 +19,15 @@ # If not, see . # ############################################################################# - from datetime import date, timedelta - from odoo import fields, models class ResPartner(models.Model): _inherit = "res.partner" - invoice_list = fields.One2many('account.move', 'partner_id', + invoice_list = fields.One2many('account.move', + 'partner_id', string="Invoice Details", readonly=True, domain=( @@ -49,7 +48,8 @@ class ResPartner(models.Model): def _compute_for_followup(self): """ - Compute the fields 'total_due', 'total_overdue' , 'next_reminder_date' and 'followup_status' + Compute the fields 'total_due', 'total_overdue' , + 'next_reminder_date' and 'followup_status' """ for record in self: total_due = 0 @@ -60,7 +60,8 @@ class ResPartner(models.Model): amount = am.amount_residual total_due += amount - is_overdue = today > am.invoice_date_due if am.invoice_date_due else today > am.date + is_overdue = today > am.invoice_date_due \ + if am.invoice_date_due else today > am.date if is_overdue: total_overdue += amount or 0 min_date = record.get_min_date() @@ -99,14 +100,12 @@ class ResPartner(models.Model): order by delay limit 1""" self._cr.execute(delay, [self.env.company.id]) record = self._cr.dictfetchall() - return record def action_after(self): lines = self.env['followup.line'].search([( 'followup_id.company_id', '=', self.env.company.id)]) - if lines: record = self.get_delay() for i in record: diff --git a/base_accounting_kit/report/account_asset_report.py b/base_accounting_kit/report/account_asset_report.py index 30ab11dbb..011d05233 100644 --- a/base_accounting_kit/report/account_asset_report.py +++ b/base_accounting_kit/report/account_asset_report.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################# -from odoo import api, fields, models, tools +from odoo import fields, models, tools class AssetAssetReport(models.Model): @@ -30,19 +30,29 @@ class AssetAssetReport(models.Model): name = fields.Char(string='Year', required=False, readonly=True) date = fields.Date(readonly=True) depreciation_date = fields.Date(string='Depreciation Date', readonly=True) - asset_id = fields.Many2one('account.asset.asset', string='Asset', readonly=True) - asset_category_id = fields.Many2one('account.asset.category', string='Asset category', readonly=True) - partner_id = fields.Many2one('res.partner', string='Partner', readonly=True) - state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], string='Status', readonly=True) - depreciation_value = fields.Float(string='Amount of Depreciation Lines', readonly=True) - installment_value = fields.Float(string='Amount of Installment Lines', readonly=True) + asset_id = fields.Many2one('account.asset.asset', + string='Asset', readonly=True) + asset_category_id = fields.Many2one('account.asset.category', + string='Asset category', readonly=True) + partner_id = fields.Many2one('res.partner', string='Partner', + readonly=True) + state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), + ('close', 'Close')], string='Status', + readonly=True) + depreciation_value = fields.Float(string='Amount of Depreciation Lines', + readonly=True) + installment_value = fields.Float(string='Amount of Installment Lines', + readonly=True) move_check = fields.Boolean(string='Posted', readonly=True) - installment_nbr = fields.Integer(string='# of Installment Lines', readonly=True) - depreciation_nbr = fields.Integer(string='# of Depreciation Lines', readonly=True) + installment_nbr = fields.Integer(string='# of Installment Lines', + readonly=True) + depreciation_nbr = fields.Integer(string='# of Depreciation Lines', + readonly=True) gross_value = fields.Float(string='Gross Amount', readonly=True) posted_value = fields.Float(string='Posted Amount', readonly=True) unposted_value = fields.Float(string='Unposted Amount', readonly=True) - company_id = fields.Many2one('res.company', string='Company', readonly=True) + company_id = fields.Many2one('res.company', string='Company', + readonly=True) def init(self): tools.drop_view_if_exists(self._cr, 'asset_asset_report') @@ -77,10 +87,14 @@ class AssetAssetReport(models.Model): a.company_id as company_id from account_asset_depreciation_line dl left join account_asset_asset a on (dl.asset_id=a.id) - left join (select min(d.id) as id,ac.id as ac_id from account_asset_depreciation_line as d inner join account_asset_asset as ac ON (ac.id=d.asset_id) group by ac_id) as dlmin on dlmin.ac_id=a.id + left join (select min(d.id) as id,ac.id as ac_id from + account_asset_depreciation_line as d inner join + account_asset_asset as ac ON (ac.id=d.asset_id) group by + ac_id) as dlmin on dlmin.ac_id=a.id where a.active is true group by dl.amount,dl.asset_id,dl.depreciation_date,dl.name, - a.date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id, + a.date, dl.move_check, a.state, a.category_id, + a.partner_id, a.company_id, a.value, a.id, a.salvage_value, dlmin.id )""") diff --git a/base_accounting_kit/report/account_asset_report_views.xml b/base_accounting_kit/report/account_asset_report_views.xml index b9cbea4fe..fbea88b5e 100644 --- a/base_accounting_kit/report/account_asset_report_views.xml +++ b/base_accounting_kit/report/account_asset_report_views.xml @@ -1,6 +1,5 @@ - asset.asset.report.pivot asset.asset.report @@ -23,7 +22,6 @@
- asset.asset.report.search asset.asset.report @@ -31,46 +29,62 @@ - - - + + + - + - + - - - + + + - - + +
- Assets Analysis asset.asset.report graph,pivot - [('asset_category_id.type', '=', 'purchase')] + [('asset_category_id.type', '=', 'purchase')] + {'search_default_only_active': 1} -

- From this report, you can have an overview on all depreciations. The - search bar can also be used to personalize your assets depreciation reporting. -

+

+ From this report, you can have an overview on all depreciations. + The + search bar can also be used to personalize your assets + depreciation reporting. +

- diff --git a/base_accounting_kit/report/account_bank_book.py b/base_accounting_kit/report/account_bank_book.py index 3dd7a2d06..6d974f837 100644 --- a/base_accounting_kit/report/account_bank_book.py +++ b/base_accounting_kit/report/account_bank_book.py @@ -34,19 +34,19 @@ class ReportBankBook(models.AbstractModel): cr = self.env.cr move_line = self.env['account.move.line'] move_lines = {x: [] for x in accounts.ids} - # Prepare initial sql query and Get the initial move lines if init_balance: - init_tables, init_where_clause, init_where_params = move_line.with_context( - date_from=self.env.context.get('date_from'), date_to=False, - initial_bal=True)._query_get() + init_tables, init_where_clause, init_where_params = ( + move_line.with_context( + date_from=self.env.context.get('date_from'), date_to=False, + initial_bal=True)._query_get()) init_wheres = [""] if init_where_clause.strip(): init_wheres.append(init_where_clause.strip()) init_filters = " AND ".join(init_wheres) filters = init_filters.replace('account_move_line__move_id', - 'm').replace('account_move_line', - 'l') + 'm').replace( + 'account_move_line', 'l') sql = ("""SELECT 0 AS lid, l.account_id AS account_id, \ '' AS ldate, '' AS lcode, 0.0 AS amount_currency, \ '' AS lref, 'Initial Balance' AS lname, \ @@ -78,7 +78,8 @@ class ReportBankBook(models.AbstractModel): if where_clause.strip(): wheres.append(where_clause.strip()) filters = " AND ".join(wheres) - filters = filters.replace('account_move_line__move_id', 'm').replace( + filters = filters.replace( + 'account_move_line__move_id', 'm').replace( 'account_move_line', 'l') # Get move lines base on sql query and Calculate the total @@ -131,7 +132,6 @@ class ReportBankBook(models.AbstractModel): if display_account == 'not_zero' and not currency.is_zero( res['balance']): account_res.append(res) - return account_res @api.model @@ -139,7 +139,6 @@ class ReportBankBook(models.AbstractModel): if not data.get('form') or not self.env.context.get('active_model'): raise UserError( _("Form content is missing, this report cannot be printed.")) - model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_ids', [])) init_balance = data['form'].get('initial_balance', True) @@ -154,13 +153,17 @@ class ReportBankBook(models.AbstractModel): accounts = self.env['account.account'].search( [('id', 'in', account_ids)]) if not accounts: - journals = self.env['account.journal'].search([('type', '=', 'bank')]) + journals = self.env['account.journal'].search( + [('type', '=', 'bank')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) - accounts = self.env['account.account'].search([('id', 'in', accounts)]) - - accounts_res = self.with_context(data['form'].get('used_context', {}))._get_account_move_entry( + accounts.append( + journal.company_id. + account_journal_payment_credit_account_id.id) + accounts = self.env['account.account'].search( + [('id', 'in', accounts)]) + accounts_res = self.with_context( + data['form'].get('used_context', {}))._get_account_move_entry( accounts, init_balance, sortby, diff --git a/base_accounting_kit/report/account_bank_book_view.xml b/base_accounting_kit/report/account_bank_book_view.xml index e2eeb42bd..2c63e706c 100644 --- a/base_accounting_kit/report/account_bank_book_view.xml +++ b/base_accounting_kit/report/account_bank_book_view.xml @@ -5,12 +5,10 @@ -

: Bank Book Report

-
Journals: @@ -19,15 +17,24 @@
Display Account

- All accounts' - With movements - With balance not equal to zero + + All accounts' + + + With movements + + + With balance not equal to zero +

Target Moves: -

All Entries

-

All Posted Entries

+

All Entries +

+

All Posted + Entries +


@@ -35,7 +42,9 @@
Sorted By:

Date

-

Journal and Partner

+

+ Journal and Partner +

@@ -52,7 +61,7 @@
- + @@ -62,14 +71,17 @@ - + @@ -87,7 +99,8 @@ - + @@ -98,7 +111,8 @@ - diff --git a/base_accounting_kit/report/account_cash_book.py b/base_accounting_kit/report/account_cash_book.py index 09918e48c..31728e62a 100644 --- a/base_accounting_kit/report/account_cash_book.py +++ b/base_accounting_kit/report/account_cash_book.py @@ -31,16 +31,15 @@ class ReportCashBook(models.AbstractModel): def _get_account_move_entry(self, accounts, init_balance, sortby, display_account): - cr = self.env.cr move_line = self.env['account.move.line'] move_lines = {x: [] for x in accounts.ids} - # Prepare initial sql query and Get the initial move lines if init_balance: - init_tables, init_where_clause, init_where_params = move_line.with_context( + init_tables, init_where_clause, init_where_params = ( + move_line.with_context( date_from=self.env.context.get('date_from'), date_to=False, - initial_bal=True)._query_get() + initial_bal=True)._query_get()) init_wheres = [""] if init_where_clause.strip(): init_wheres.append(init_where_clause.strip()) @@ -48,7 +47,11 @@ class ReportCashBook(models.AbstractModel): filters = init_filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l') - sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\ + sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, + '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' + AS lname, COALESCE(SUM(l.debit),0.0) AS debit, + COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) + - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\ '' AS move_name, '' AS mmove_id, '' AS currency_code,\ NULL AS currency_id,\ '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\ @@ -58,7 +61,8 @@ class ReportCashBook(models.AbstractModel): LEFT JOIN res_currency c ON (l.currency_id=c.id)\ LEFT JOIN res_partner p ON (l.partner_id=p.id)\ JOIN account_journal j ON (l.journal_id=j.id)\ - WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id') + WHERE l.account_id IN %s""" + filters + + ' GROUP BY l.account_id') params = (tuple(accounts.ids),) + tuple(init_where_params) cr.execute(sql, params) for row in cr.dictfetchall(): @@ -73,39 +77,48 @@ class ReportCashBook(models.AbstractModel): if where_clause.strip(): wheres.append(where_clause.strip()) filters = " AND ".join(wheres) - filters = filters.replace('account_move_line__move_id', 'm').replace( + filters = filters.replace('account_move_line__move_id', + 'm').replace( 'account_move_line', 'l') if not accounts: - journals = self.env['account.journal'].search([('type', '=', 'cash')]) + journals = self.env['account.journal'].search( + [('type', '=', 'cash')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) - accounts = self.env['account.account'].search([('id','in',accounts)]) + accounts.append( + journal.company_id. + account_journal_payment_credit_account_id.id) + accounts = self.env['account.account'].search( + [('id', 'in', accounts)]) - # Get move lines base on sql query and Calculate the total balance of move lines - sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\ - m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\ + # Get move lines base on sql query and Calculate the total balance of + # move lines + sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS + ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\ + m.name AS move_name, c.symbol AS currency_code, p.name AS + partner_name\ FROM account_move_line l\ JOIN account_move m ON (l.move_id=m.id)\ LEFT JOIN res_currency c ON (l.currency_id=c.id)\ LEFT JOIN res_partner p ON (l.partner_id=p.id)\ JOIN account_journal j ON (l.journal_id=j.id)\ JOIN account_account acc ON (l.account_id = acc.id) \ - WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort) + WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, + l.account_id, l.date, j.code, l.currency_id, l.amount_currency, + l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort) params = (tuple(accounts.ids),) + tuple(where_params) cr.execute(sql, params) - for row in cr.dictfetchall(): balance = 0 for line in move_lines.get(row['account_id']): balance += line['debit'] - line['credit'] row['balance'] += balance move_lines[row.pop('account_id')].append(row) - # Calculate the debit, credit and balance for Accounts account_res = [] for account in accounts: - currency = account.currency_id and account.currency_id or account.company_id.currency_id + currency = (account.currency_id and account.currency_id or + account.company_id.currency_id) res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) res['code'] = account.code res['name'] = account.name @@ -121,7 +134,6 @@ class ReportCashBook(models.AbstractModel): if display_account == 'not_zero' and not currency.is_zero( res['balance']): account_res.append(res) - return account_res @api.model @@ -129,7 +141,6 @@ class ReportCashBook(models.AbstractModel): if not data.get('form') or not self.env.context.get('active_model'): raise UserError( _("Form content is missing, this report cannot be printed.")) - model = self.env.context.get('active_model') docs = self.env[model].browse( self.env.context.get('active_ids', [])) @@ -145,11 +156,15 @@ class ReportCashBook(models.AbstractModel): accounts = self.env['account.account'].search( [('id', 'in', account_ids)]) if not accounts: - journals = self.env['account.journal'].search([('type', '=', 'cash')]) + journals = self.env['account.journal'].search( + [('type', '=', 'cash')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) - accounts = self.env['account.account'].search([('id', 'in', accounts)]) + accounts.append( + journal. + company_id.account_journal_payment_credit_account_id.id) + accounts = self.env['account.account'].search( + [('id', 'in', accounts)]) accounts_res = self.with_context( data['form'].get('used_context', {}))._get_account_move_entry( accounts, diff --git a/base_accounting_kit/report/account_cash_book_view.xml b/base_accounting_kit/report/account_cash_book_view.xml index e26ae7e08..9ef85057d 100644 --- a/base_accounting_kit/report/account_cash_book_view.xml +++ b/base_accounting_kit/report/account_cash_book_view.xml @@ -1,108 +1,167 @@ - - diff --git a/base_accounting_kit/report/account_day_book.py b/base_accounting_kit/report/account_day_book.py index e9b40845e..6a8d8b316 100644 --- a/base_accounting_kit/report/account_day_book.py +++ b/base_accounting_kit/report/account_day_book.py @@ -42,19 +42,25 @@ class DayBookPdfReport(models.AbstractModel): else: target_move = '' sql = (''' - SELECT l.id AS lid, acc.name as accname, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, - l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, - COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance, - m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name + SELECT l.id AS lid, acc.name as accname, l.account_id AS + account_id, l.date AS ldate, j.code AS lcode, l.currency_id, + l.amount_currency, l.ref AS lref, l.name AS lname, + COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, + COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS + balance, + m.name AS move_name, c.symbol AS currency_code, p.name + AS partner_name FROM account_move_line l JOIN account_move m ON (l.move_id=m.id) LEFT JOIN res_currency c ON (l.currency_id=c.id) LEFT JOIN res_partner p ON (l.partner_id=p.id) JOIN account_journal j ON (l.journal_id=j.id) JOIN account_account acc ON (l.account_id = acc.id) - WHERE l.account_id IN %s AND l.journal_id IN %s ''' + target_move + ''' AND l.date = %s + WHERE l.account_id IN %s AND l.journal_id IN %s ''' + + target_move + ''' AND l.date = %s GROUP BY l.id, l.account_id, l.date, - j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name , acc.name + j.code, l.currency_id, l.amount_currency, l.ref, + l.name, m.name, c.symbol, p.name , acc.name ORDER BY l.date DESC ''') params = ( @@ -78,7 +84,6 @@ class DayBookPdfReport(models.AbstractModel): if not data.get('form') or not self.env.context.get('active_model'): raise UserError( _("Form content is missing, this report cannot be printed.")) - model = self.env.context.get('active_model') docs = self.env[model].browse( self.env.context.get('active_ids', [])) @@ -95,7 +100,8 @@ class DayBookPdfReport(models.AbstractModel): date_start = datetime.strptime(form_data['date_from'], '%Y-%m-%d').date() - date_end = datetime.strptime(form_data['date_to'], '%Y-%m-%d').date() + date_end = datetime.strptime(form_data['date_to'], + '%Y-%m-%d').date() days = date_end - date_start dates = [] record = [] diff --git a/base_accounting_kit/report/account_day_book_view.xml b/base_accounting_kit/report/account_day_book_view.xml index 8d80aadaa..f93530839 100644 --- a/base_accounting_kit/report/account_day_book_view.xml +++ b/base_accounting_kit/report/account_day_book_view.xml @@ -12,12 +12,15 @@
Journals: -

+

Target Moves: -

All Entries

-

All Posted Entries

+

+ All Entries

+

+ All Posted Entries

@@ -31,10 +34,9 @@
-
Date JRNL PartnerDebit Credit BalanceCurrency + Currency +
- +
- + @@ -116,12 +130,17 @@ + t-options="{'widget': 'monetary', + 'display_currency': env.company.currency_id}"/> - - + + +
- + @@ -49,26 +51,34 @@ - + - + @@ -79,7 +89,8 @@ - diff --git a/base_accounting_kit/report/account_report_common_account.py b/base_accounting_kit/report/account_report_common_account.py index 2c51c6f0a..ffcbbb005 100644 --- a/base_accounting_kit/report/account_report_common_account.py +++ b/base_accounting_kit/report/account_report_common_account.py @@ -45,16 +45,21 @@ class AccountCommonAccountReport(models.TransientModel): string='Display Accounts', required=True, default='movement') target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries'), - ], string='Target Moves', required=True, default='posted') + ], string='Target Moves', required=True, + default='posted') date_from = fields.Date(string='Start Date') date_to = fields.Date(string='End Date') - company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, + company_id = fields.Many2one('res.company', string='Company', + required=True, + readonly=True, default=lambda self: self.env.company) def _build_contexts(self, data): result = {} - result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False - result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' + result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][ + 'journal_ids'] or False + result['state'] = 'target_move' in data['form'] and data['form'][ + 'target_move'] or '' result['date_from'] = data['form']['date_from'] or False result['date_to'] = data['form']['date_to'] or False result['strict_range'] = True if result['date_from'] else False @@ -69,9 +74,12 @@ class AccountCommonAccountReport(models.TransientModel): data = {} data['ids'] = self.env.context.get('active_ids', []) data['model'] = self.env.context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0] + data['form'] = self.read( + ['date_from', 'date_to', 'journal_ids', 'target_move', + 'company_id'])[0] used_context = self._build_contexts(data) - data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code) + data['form']['used_context'] = dict(used_context, + lang=get_lang(self.env).code) return self.with_context(discard_logo_check=True)._print_report(data) def pre_print_report(self, data): diff --git a/base_accounting_kit/report/cash_flow_report.py b/base_accounting_kit/report/cash_flow_report.py index 1defd8e8e..bff43f763 100644 --- a/base_accounting_kit/report/cash_flow_report.py +++ b/base_accounting_kit/report/cash_flow_report.py @@ -32,11 +32,11 @@ class ReportFinancial(models.AbstractModel): def _compute_account_balance(self, accounts): mapping = { - 'balance': "COALESCE(SUM(debit),0) - COALESCE(SUM(credit), 0) as balance", + 'balance': "COALESCE(SUM(debit),0)" + " - COALESCE(SUM(credit), 0) as balance", 'debit': "COALESCE(SUM(debit), 0) as debit", 'credit': "COALESCE(SUM(credit), 0) as credit", } - res = {} for account in accounts: res[account.id] = dict.fromkeys(mapping, 0.0) @@ -83,10 +83,12 @@ class ReportFinancial(models.AbstractModel): 'base_accounting_kit.cash_in_investing0') cash_out_investing = self.env.ref( 'base_accounting_kit.cash_out_investing1') - if report == cash_in_operation or report == cash_in_financial or report == cash_in_investing: + if (report == cash_in_operation or report == + cash_in_financial or report == cash_in_investing): res[report.id]['debit'] += value['debit'] res[report.id]['balance'] += value['debit'] - elif report == cash_out_operation or report == cash_out_financial or report == cash_out_investing: + elif (report == cash_out_operation or report == + cash_out_financial or report == cash_out_investing): res[report.id]['credit'] += value['credit'] res[report.id]['balance'] += -(value['credit']) elif report.type == 'account_type': @@ -105,7 +107,6 @@ class ReportFinancial(models.AbstractModel): for value in res[report.id]['account'].values(): for field in fields: res[report.id][field] += value.get(field) - elif report.type == 'sum': # it's the sum of the linked accounts res[report.id]['account'] = self._compute_account_balance( @@ -133,7 +134,6 @@ class ReportFinancial(models.AbstractModel): for account_id, val in comparison_res[report_id].get( 'account').items(): report_acc[account_id]['comp_bal'] = val['balance'] - for report in child_reports: vals = { 'name': report.name, @@ -147,39 +147,40 @@ class ReportFinancial(models.AbstractModel): if data['debit_credit']: vals['debit'] = res[report.id]['debit'] vals['credit'] = res[report.id]['credit'] - if data['enable_filter']: vals['balance_cmp'] = res[report.id]['comp_bal'] * int( report.sign) - lines.append(vals) if report.display_detail == 'no_detail': - # the rest of the loop is used to display the details of the financial report, so it's not needed here. + # the rest of the loop is used to display the details of the + # financial report, so it's not needed here. continue if res[report.id].get('account'): # if res[report.id].get('debit'): sub_lines = [] for account_id, value in res[report.id]['account'].items(): - # if there are accounts to display, we add them to the lines with a level equals to their level in - # the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data + # if there are accounts to display, we add them to the + # lines with a level equals to their level in + # the COA + 1 (to avoid having them with a too low level + # that would conflicts with the level of data # financial reports for Assets, liabilities...) flag = False account = self.env['account.account'].browse(account_id) - vals = { 'name': account.code + ' ' + account.name, 'balance': value['balance'] * int(report.sign) or 0.0, 'type': 'account', - 'level': report.display_detail == 'detail_with_hierarchy' and 4, + 'level': report.display_detail == + 'detail_with_hierarchy' and 4, 'account_type': account.internal_type, } if data['debit_credit']: vals['debit'] = value['debit'] vals['credit'] = value['credit'] - if not account.company_id.currency_id.is_zero( + if (not account.company_id.currency_id.is_zero( vals[ - 'debit']) or not account.company_id.currency_id.is_zero( - vals['credit']): + 'debit']) or not account.company_id. + currency_id.is_zero(vals['credit'])): flag = True if not account.company_id.currency_id.is_zero( vals['balance']): diff --git a/base_accounting_kit/report/cash_flow_report.xml b/base_accounting_kit/report/cash_flow_report.xml index 839767d64..0445dfc5c 100644 --- a/base_accounting_kit/report/cash_flow_report.xml +++ b/base_accounting_kit/report/cash_flow_report.xml @@ -6,13 +6,16 @@

-
Target Moves:

- All Entries - All Posted Entries + + All Entries + + + All Posted Entries +

@@ -27,20 +30,23 @@

Date JRNL Partner
+ t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/>
- + @@ -89,19 +100,31 @@ + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> - - + + +
- + - - - - @@ -49,32 +55,59 @@ - + - + - - - diff --git a/base_accounting_kit/report/general_ledger_report.py b/base_accounting_kit/report/general_ledger_report.py index cda0daaae..8f87dff8c 100644 --- a/base_accounting_kit/report/general_ledger_report.py +++ b/base_accounting_kit/report/general_ledger_report.py @@ -55,17 +55,23 @@ class ReportGeneralLedger(models.AbstractModel): # Prepare initial sql query and Get the initial move lines if init_balance: - init_tables, init_where_clause, init_where_params = MoveLine.with_context( + init_tables, init_where_clause, init_where_params = ( + MoveLine.with_context( date_from=self.env.context.get('date_from'), date_to=False, - initial_bal=True)._query_get() + initial_bal=True)._query_get()) init_wheres = [""] if init_where_clause.strip(): init_wheres.append(init_where_clause.strip()) init_filters = " AND ".join(init_wheres) filters = init_filters.replace('account_move_line__move_id', - 'm').replace('account_move_line', + 'm').replace( + 'account_move_line', 'l') - sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\ + sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' + AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, + 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, + COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) + - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\ '' AS move_name, '' AS mmove_id, '' AS currency_code,\ NULL AS currency_id,\ '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\ @@ -76,7 +82,8 @@ class ReportGeneralLedger(models.AbstractModel): LEFT JOIN res_partner p ON (l.partner_id=p.id)\ LEFT JOIN account_move i ON (m.id =i.id)\ JOIN account_journal j ON (l.journal_id=j.id)\ - WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id') + WHERE l.account_id IN %s""" + filters + + ' GROUP BY l.account_id') params = (tuple(accounts.ids),) + tuple(init_where_params) cr.execute(sql, params) for row in cr.dictfetchall(): @@ -92,19 +99,27 @@ class ReportGeneralLedger(models.AbstractModel): if where_clause.strip(): wheres.append(where_clause.strip()) filters = " AND ".join(wheres) - filters = filters.replace('account_move_line__move_id', 'm').replace( + filters = filters.replace('account_move_line__move_id', + 'm').replace( 'account_move_line', 'l') # Get move lines base on sql query and Calculate the total balance of move lines - sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\ - m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\ + sql = ('''SELECT l.id AS lid, l.account_id AS account_id, + l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, + l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, + COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - + COALESCE(SUM(l.credit), 0) AS balance,\ + m.name AS move_name, c.symbol AS currency_code, p.name AS + partner_name\ FROM account_move_line l\ JOIN account_move m ON (l.move_id=m.id)\ LEFT JOIN res_currency c ON (l.currency_id=c.id)\ LEFT JOIN res_partner p ON (l.partner_id=p.id)\ JOIN account_journal j ON (l.journal_id=j.id)\ JOIN account_account acc ON (l.account_id = acc.id) \ - WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort) + WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, + l.account_id, l.date, j.code, l.currency_id, l.amount_currency, + l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort) params = (tuple(accounts.ids),) + tuple(where_params) cr.execute(sql, params) @@ -118,7 +133,8 @@ class ReportGeneralLedger(models.AbstractModel): # Calculate the debit, credit and balance for Accounts account_res = [] for account in accounts: - currency = account.currency_id and account.currency_id or account.company_id.currency_id + currency = (account.currency_id and account.currency_id or + account.company_id.currency_id) res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) res['code'] = account.code res['name'] = account.name @@ -134,7 +150,6 @@ class ReportGeneralLedger(models.AbstractModel): if display_account == 'not_zero' and not currency.is_zero( res['balance']): account_res.append(res) - return account_res @api.model @@ -142,11 +157,9 @@ class ReportGeneralLedger(models.AbstractModel): if not data.get('form') or not self.env.context.get('active_model'): raise UserError( _("Form content is missing, this report cannot be printed.")) - model = self.env.context.get('active_model') docs = self.env[model].browse( self.env.context.get('active_ids', [])) - init_balance = data['form'].get('initial_balance', True) sortby = data['form'].get('sortby', 'sort_date') display_account = data['form']['display_account'] @@ -155,7 +168,6 @@ class ReportGeneralLedger(models.AbstractModel): codes = [journal.code for journal in self.env['account.journal'].search( [('id', 'in', data['form']['journal_ids'])])] - accounts = docs if model == 'account.account' else self.env[ 'account.account'].search([]) accounts_res = self.with_context( diff --git a/base_accounting_kit/report/general_ledger_report.xml b/base_accounting_kit/report/general_ledger_report.xml index ef78ebacc..3f1a5060b 100644 --- a/base_accounting_kit/report/general_ledger_report.xml +++ b/base_accounting_kit/report/general_ledger_report.xml @@ -7,42 +7,62 @@
-

: General ledger

- +

: General ledger +

Journals: -

+

Display Account

- All accounts' - With movements - With balance not equal to zero + + All accounts' + + + With movements + + + With balance not equal to zero +

Target Moves: -

All Entries

-

All Posted Entries

+

All Entries +

+

All Posted + Entries +

Sorted By:

Date

-

Journal and Partner

+

+ Journal and Partner +

- Date from :
- Date to : + + Date from : + +
+
+ + Date to : + +
-
Name + Debit + Credit + Balance +
- - + + - + + - + + t-options="{'widget': + 'monetary', + 'display_currency': + env.company.currency_id}"/> - + + - + t-options="{ + 'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/>
- + @@ -52,48 +72,88 @@ - + - - - - - - - + + + + + + + - diff --git a/base_accounting_kit/report/multiple_invoice_layouts.xml b/base_accounting_kit/report/multiple_invoice_layouts.xml index 60daddbe8..cb1bbd42d 100644 --- a/base_accounting_kit/report/multiple_invoice_layouts.xml +++ b/base_accounting_kit/report/multiple_invoice_layouts.xml @@ -1,334 +1,434 @@ - - - - - - - - - \ No newline at end of file + diff --git a/base_accounting_kit/report/multiple_invoice_report.py b/base_accounting_kit/report/multiple_invoice_report.py index ddd955cd4..7ef405f2d 100644 --- a/base_accounting_kit/report/multiple_invoice_report.py +++ b/base_accounting_kit/report/multiple_invoice_report.py @@ -19,8 +19,7 @@ # If not, see . # ############################################################################# - -from odoo import models, api +from odoo import api, models class ReportInvoiceMultiple(models.AbstractModel): @@ -31,28 +30,21 @@ class ReportInvoiceMultiple(models.AbstractModel): @api.model def _get_report_values(self, docids, data=None): rslt = super()._get_report_values(docids, data) - inv = rslt['docs'] layout = inv.journal_id.company_id.external_report_layout_id.key - if layout == 'web.external_layout_boxed': new_layout = 'base_accounting_kit.boxed' - elif layout == 'web.external_layout_bold': new_layout = 'base_accounting_kit.bold' - elif layout == 'web.external_layout_striped': new_layout = 'base_accounting_kit.striped' - else: new_layout = 'base_accounting_kit.standard' - rslt['mi_type'] = inv.journal_id.multiple_invoice_type rslt['mi_ids'] = inv.journal_id.multiple_invoice_ids rslt['txt_position'] = inv.journal_id.text_position rslt['body_txt_position'] = inv.journal_id.body_text_position rslt['txt_align'] = inv.journal_id.text_align rslt['layout'] = new_layout - rslt['report_type'] = data.get('report_type') if data else '' - return rslt \ No newline at end of file + return rslt diff --git a/base_accounting_kit/report/multiple_invoice_report.xml b/base_accounting_kit/report/multiple_invoice_report.xml index 128a518c3..3e9f3d665 100644 --- a/base_accounting_kit/report/multiple_invoice_report.xml +++ b/base_accounting_kit/report/multiple_invoice_report.xml @@ -1,252 +1,328 @@ + - - - - Multiple Invoice Copies account.move @@ -256,5 +332,4 @@ report - - \ No newline at end of file + diff --git a/base_accounting_kit/report/report.xml b/base_accounting_kit/report/report.xml index 330b4f8ce..6f97c0a33 100644 --- a/base_accounting_kit/report/report.xml +++ b/base_accounting_kit/report/report.xml @@ -1,96 +1,96 @@ - - Financial reports - financial.report - qweb-pdf - base_accounting_kit.report_financial - base_accounting_kit.report_financial - + + Financial reports + financial.report + qweb-pdf + base_accounting_kit.report_financial + base_accounting_kit.report_financial + - General Ledger - account.report.general.ledger - qweb-pdf - base_accounting_kit.report_general_ledger - base_accounting_kit.report_general_ledger - + General Ledger + account.report.general.ledger + qweb-pdf + base_accounting_kit.report_general_ledger + base_accounting_kit.report_general_ledger + - - Partner Ledger - account.report.partner.ledger - qweb-pdf - base_accounting_kit.report_partnerledger - base_accounting_kit.report_partnerledger - + + Partner Ledger + account.report.partner.ledger + qweb-pdf + base_accounting_kit.report_partnerledger + base_accounting_kit.report_partnerledger + - Aged Partner Balance - res.partner - qweb-pdf - base_accounting_kit.report_agedpartnerbalance - base_accounting_kit.report_agedpartnerbalance - + Aged Partner Balance + res.partner + qweb-pdf + base_accounting_kit.report_agedpartnerbalance + base_accounting_kit.report_agedpartnerbalance + - Journals Audit - account.common.journal.report - qweb-pdf - base_accounting_kit.report_journal_audit - base_accounting_kit.report_journal_audit - + Journals Audit + account.common.journal.report + qweb-pdf + base_accounting_kit.report_journal_audit + base_accounting_kit.report_journal_audit + - Tax Report - kit.account.tax.report - qweb-pdf - base_accounting_kit.report_tax - base_accounting_kit.report_tax - + Tax Report + kit.account.tax.report + qweb-pdf + base_accounting_kit.report_tax + base_accounting_kit.report_tax + - - Trial Balance - account.balance.report - qweb-pdf - base_accounting_kit.report_trial_balance - base_accounting_kit.report_trial_balance - + + Trial Balance + account.balance.report + qweb-pdf + base_accounting_kit.report_trial_balance + base_accounting_kit.report_trial_balance + - Cash Flow Statement - account.financial.report - qweb-pdf - base_accounting_kit.report_cash_flow - base_accounting_kit.report_cash_flow - + Cash Flow Statement + account.financial.report + qweb-pdf + base_accounting_kit.report_cash_flow + base_accounting_kit.report_cash_flow + - Bank Book Report - account.bank.book.report - qweb-pdf - base_accounting_kit.report_bank_book - base_accounting_kit.report_bank_book - False - + Bank Book Report + account.bank.book.report + qweb-pdf + base_accounting_kit.report_bank_book + base_accounting_kit.report_bank_book + False + - - Cash Book Report - account.cash.book.report - qweb-pdf - base_accounting_kit.report_cash_book - base_accounting_kit.report_cash_book - False - + + Cash Book Report + account.cash.book.report + qweb-pdf + base_accounting_kit.report_cash_book + base_accounting_kit.report_cash_book + False + - Day Book PDF Report - account.day.book.report - qweb-pdf - base_accounting_kit.day_book_report_template - base_accounting_kit.day_book_report_template - True - - \ No newline at end of file + Day Book PDF Report + account.day.book.report + qweb-pdf + base_accounting_kit.day_book_report_template + base_accounting_kit.day_book_report_template + True + + diff --git a/base_accounting_kit/report/report_aged_partner.py b/base_accounting_kit/report/report_aged_partner.py index 1b82e1fd9..5926a387a 100644 --- a/base_accounting_kit/report/report_aged_partner.py +++ b/base_accounting_kit/report/report_aged_partner.py @@ -19,12 +19,9 @@ # If not, see . # ############################################################################# - import time from datetime import datetime - from dateutil.relativedelta import relativedelta - from odoo import api, models, _ from odoo.exceptions import UserError from odoo.tools import float_is_zero @@ -36,11 +33,14 @@ class ReportAgedPartnerBalance(models.AbstractModel): def _get_partner_move_lines(self, account_type, date_from, target_move, period_length): - # This method can receive the context key 'include_nullified_amount' {Boolean} - # Do an invoice and a payment and unreconcile. The amount will be nullified + # This method can receive the context key 'include_nullified_amount' + # {Boolean} + # Do an invoice and a payment and unreconcile. The amount will be + # nullified # By default, the partner wouldn't appear in this report. # The context key allow it to appear - # In case of a period_length of 30 days as of 2019-02-08, we want the following periods: + # In case of a period_length of 30 days as of 2019-02-08, + # we want the following periods: # Name Stop Start # 1 - 30 : 2019-02-07 - 2019-01-09 # 31 - 60 : 2019-01-08 - 2018-12-10 @@ -63,7 +63,6 @@ class ReportAgedPartnerBalance(models.AbstractModel): 'start': (i != 0 and stop.strftime('%Y-%m-%d') or False), } start = stop - res = [] total = [] cr = self.env.cr @@ -78,20 +77,20 @@ class ReportAgedPartnerBalance(models.AbstractModel): # build the reconciliation clause to see what partner needs to be printed reconciliation_clause = '(l.reconciled IS FALSE)' cr.execute( - 'SELECT debit_move_id, credit_move_id FROM account_partial_reconcile where max_date > %s', + 'SELECT debit_move_id, credit_move_id FROM account_partial_reconcile' + ' where max_date > %s', (date_from,)) reconciled_after_date = [] - for row in cr.fetchall(): reconciled_after_date += [row[0], row[1]] - if reconciled_after_date: reconciliation_clause = '(l.reconciled IS FALSE OR l.id IN %s)' arg_list += (tuple(reconciled_after_date),) arg_list += (date_from, tuple(company_ids)) query = ''' SELECT DISTINCT l.partner_id, UPPER(res_partner.name) - FROM account_move_line AS l left join res_partner on l.partner_id = res_partner.id, account_account, account_move am + FROM account_move_line AS l left join res_partner on l.partner_id = + res_partner.id, account_account, account_move am WHERE (l.account_id = account_account.id) AND (l.move_id = am.id) AND (am.state IN %s) @@ -101,12 +100,10 @@ class ReportAgedPartnerBalance(models.AbstractModel): AND l.company_id IN %s ORDER BY UPPER(res_partner.name)''' cr.execute(query, arg_list) - partners = cr.dictfetchall() # put a total of 0 for i in range(7): total.append(0) - # Build a string like (1,2,3) for easy use in SQL query partner_ids = [partner['partner_id'] for partner in partners if partner['partner_id']] @@ -114,7 +111,6 @@ class ReportAgedPartnerBalance(models.AbstractModel): (partner['partner_id'] or False, []) for partner in partners) if not partner_ids: return [], [], {} - # This dictionary will store the not due amount of all partners undue_amounts = {} query = '''SELECT l.id @@ -177,7 +173,8 @@ class ReportAgedPartnerBalance(models.AbstractModel): args_list += (date_from, tuple(company_ids)) query = '''SELECT l.id FROM account_move_line AS l, account_account, account_move am - WHERE (l.account_id = account_account.id) AND (l.move_id = am.id) + WHERE (l.account_id = account_account.id) AND + (l.move_id = am.id) AND (am.state IN %s) AND (account_account.account_type IN %s) AND ((l.partner_id IN %s) OR (l.partner_id IS NULL)) @@ -192,7 +189,8 @@ class ReportAgedPartnerBalance(models.AbstractModel): partner_id = line.partner_id.id or False if partner_id not in partners_amount: partners_amount[partner_id] = 0.0 - line_amount = ResCurrency._get_conversion_rate(line.company_id.currency_id, + line_amount = ResCurrency._get_conversion_rate( + line.company_id.currency_id, user_currency, line.balance) if user_currency.is_zero(line_amount): continue @@ -206,7 +204,6 @@ class ReportAgedPartnerBalance(models.AbstractModel): line_amount -= ResCurrency._get_conversion_rate( partial_line.company_id.currency_id, user_currency, partial_line.amount) - if not self.env.company.currency_id.is_zero( line_amount): partners_amount[partner_id] += line_amount @@ -223,15 +220,14 @@ class ReportAgedPartnerBalance(models.AbstractModel): values = {} undue_amt = 0.0 if partner[ - 'partner_id'] in undue_amounts: # Making sure this partner actually was found by the query + 'partner_id'] in undue_amounts: + # Making sure this partner actually was found by the query undue_amt = undue_amounts[partner['partner_id']] - total[6] = total[6] + undue_amt values['direction'] = undue_amt if not float_is_zero(values['direction'], precision_rounding=self.env.company.currency_id.rounding): at_least_one_amount = True - for i in range(5): during = False if partner['partner_id'] in history[i]: @@ -240,7 +236,8 @@ class ReportAgedPartnerBalance(models.AbstractModel): total[(i)] = total[(i)] + (during and during[0] or 0) values[str(i)] = during and during[0] or 0.0 if not float_is_zero(values[str(i)], - precision_rounding=self.env.company.currency_id.rounding): + precision_rounding= + self.env.company.currency_id.rounding): at_least_one_amount = True values['total'] = sum( [values['direction']] + [values[str(i)] for i in range(5)]) @@ -257,7 +254,6 @@ class ReportAgedPartnerBalance(models.AbstractModel): else: values['name'] = _('Unknown Partner') values['trust'] = False - if at_least_one_amount or ( self._context.get('include_nullified_amount') and lines[ partner['partner_id']]): @@ -270,8 +266,6 @@ class ReportAgedPartnerBalance(models.AbstractModel): 'active_model') or not self.env.context.get('active_id'): raise UserError( _("Form content is missing, this report cannot be printed.")) - - total = [] model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_id')) @@ -284,11 +278,12 @@ class ReportAgedPartnerBalance(models.AbstractModel): account_type = ['liability_payable'] else: account_type = ['liability_payable', 'asset_receivable'] - movelines, total, dummy = self._get_partner_move_lines(account_type, date_from, target_move, - data['form']['period_length']) + data['form'] + ['period_length'] + ) return { 'doc_ids': self.ids, 'doc_model': model, diff --git a/base_accounting_kit/report/report_aged_partner.xml b/base_accounting_kit/report/report_aged_partner.xml index d21269240..1a80785a3 100644 --- a/base_accounting_kit/report/report_aged_partner.xml +++ b/base_accounting_kit/report/report_aged_partner.xml @@ -8,7 +8,6 @@

Aged Partner Balance

-
Start Date: @@ -23,43 +22,90 @@
Partner's:

- Receivable Accounts - Payable Accounts - Receivable and Payable Accounts + + Receivable Accounts + + + Payable Accounts + + + Receivable and Payable Accounts +

Target Moves:

- All Entries - All Posted Entries + All + Entries + + All + Posted Entries +

-
Date JRNL PartnerDebit Credit BalanceCurrency + Currency +
- + - + - + - +
+ + + + + + + + + + + + - + - + - + - - + + +
- + - - - - - - - + + + + + + - + - - - - - - - + + + + + + + @@ -68,25 +114,32 @@ diff --git a/base_accounting_kit/report/report_financial.py b/base_accounting_kit/report/report_financial.py index 3a99edf09..cd2cd1e02 100644 --- a/base_accounting_kit/report/report_financial.py +++ b/base_accounting_kit/report/report_financial.py @@ -35,8 +35,9 @@ class AccountTypes(models.Model): ('payable', 'Payable'), ('liquidity', 'Liquidity'), ], required=True, default='other', - help="The 'Internal Type' is used for features available on " \ - "different types of accounts: liquidity type is for cash or bank accounts" \ + help="The 'Internal Type' is used for features available on " + "different types of accounts: liquidity type is for cash or " + "bank accounts" \ ", payable/receivable is for vendor/customer accounts.") @@ -68,13 +69,15 @@ class AccountFinancialReport(models.Model): return res name = fields.Char('Report Name', required=True, translate=True) - parent_id = fields.Many2one('account.financial.report', 'Parent') + parent_id = fields.Many2one('account.financial.report', + 'Parent') children_ids = fields.One2many( 'account.financial.report', 'parent_id', 'Account Report') sequence = fields.Integer('Sequence') - level = fields.Integer(compute='_get_level', string='Level', store=True, recursive=True) + level = fields.Integer(compute='_get_level', string='Level', store=True, + recursive=True) type = fields.Selection( [('sum', 'View'), ('accounts', 'Accounts'), @@ -116,15 +119,10 @@ class AccountFinancialReport(models.Model): ("off_balance", "Off-Balance Sheet"), ], string="Type", - help="These types are defined according to your country. The type contains more information " \ + help="These types are defined according to your country. " + "The type contains more information " "about the account and its specificities." ) - # account_type_ids = fields.Many2many( - # 'account.account.template', - # 'account_account_financial_report_type', - # 'report_id', 'account_type_id', - # 'Account Types') - sign = fields.Selection( [("-1", 'Reverse balance sign'), ("1", 'Preserve balance sign')], 'Sign on Reports', required=True, default="1", diff --git a/base_accounting_kit/report/report_financial.xml b/base_accounting_kit/report/report_financial.xml index 1ca5812d0..bdcf06e23 100644 --- a/base_accounting_kit/report/report_financial.xml +++ b/base_accounting_kit/report/report_financial.xml @@ -8,13 +8,16 @@

-
Target Moves:

- All Entries - All Posted Entries + + All Entries + + + All Posted Entries +

@@ -31,47 +34,56 @@

- -

Partners + Not due Total + + + + + + + + + + Total
Account Total + + + + + + + + + + + + + +
- + - + - + - + - + - + - +
+
- + - - - + + + - + - + - - -
NameDebitCreditBalanceDebitCreditBalance
- - + + - + - + - +
- @@ -84,25 +96,29 @@ - + - +
- - + + -
- @@ -110,7 +126,6 @@ @@ -119,21 +134,27 @@ - + - + @@ -143,4 +164,4 @@ - \ No newline at end of file + diff --git a/base_accounting_kit/report/report_journal_audit.py b/base_accounting_kit/report/report_journal_audit.py index 5ff6b99b4..9ec9c8458 100644 --- a/base_accounting_kit/report/report_journal_audit.py +++ b/base_accounting_kit/report/report_journal_audit.py @@ -19,9 +19,7 @@ # If not, see . # ############################################################################# - import time - from odoo import api, models, _ from odoo.exceptions import UserError @@ -36,11 +34,13 @@ class ReportJournal(models.AbstractModel): move_state = ['draft', 'posted'] if target_move == 'posted': move_state = ['posted'] - query_get_clause = self._get_query_get_clause(data) params = [tuple(move_state), tuple(journal_ids)] + query_get_clause[2] query = 'SELECT "account_move_line".id FROM ' + query_get_clause[ - 0] + ', account_move am, account_account acc WHERE "account_move_line".account_id = acc.id AND "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + \ + 0] + (', account_move am, account_account acc WHERE ' + '"account_move_line".account_id = acc.id AND ' + '"account_move_line".move_id=am.id AND am.state IN %s AND ' + '"account_move_line".journal_id IN %s AND ') + \ query_get_clause[1] + ' ORDER BY ' if sort_selection == 'date': query += '"account_move_line".date' @@ -55,13 +55,13 @@ class ReportJournal(models.AbstractModel): move_state = ['draft', 'posted'] if data['form'].get('target_move', 'all') == 'posted': move_state = ['posted'] - query_get_clause = self._get_query_get_clause(data) params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[ 2] self.env.cr.execute('SELECT SUM(debit) FROM ' + query_get_clause[ 0] + ', account_move am ' - 'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + + 'WHERE "account_move_line".move_id=am.id AND am.state IN %s' + ' AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ', tuple(params)) return self.env.cr.fetchone()[0] or 0.0 @@ -70,13 +70,13 @@ class ReportJournal(models.AbstractModel): move_state = ['draft', 'posted'] if data['form'].get('target_move', 'all') == 'posted': move_state = ['posted'] - query_get_clause = self._get_query_get_clause(data) params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[ 2] self.env.cr.execute('SELECT SUM(credit) FROM ' + query_get_clause[ 0] + ', account_move am ' - 'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + + 'WHERE "account_move_line".move_id=am.id AND am.state IN %s ' + 'AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ', tuple(params)) return self.env.cr.fetchone()[0] or 0.0 @@ -85,12 +85,12 @@ class ReportJournal(models.AbstractModel): move_state = ['draft', 'posted'] if data['form'].get('target_move', 'all') == 'posted': move_state = ['posted'] - query_get_clause = self._get_query_get_clause(data) params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[ 2] query = """ - SELECT rel.account_tax_id, SUM("account_move_line".balance) AS base_amount + SELECT rel.account_tax_id, SUM("account_move_line".balance) + AS base_amount FROM account_move_line_account_tax_rel rel, """ + query_get_clause[ 0] + """ LEFT JOIN account_move am ON "account_move_line".move_id = am.id @@ -105,13 +105,13 @@ class ReportJournal(models.AbstractModel): for row in self.env.cr.fetchall(): ids.append(row[0]) base_amounts[row[0]] = row[1] - res = {} for tax in self.env['account.tax'].browse(ids): self.env.cr.execute( 'SELECT sum(debit - credit) FROM ' + query_get_clause[ 0] + ', account_move am ' - 'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + + 'WHERE "account_move_line".move_id=am.id AND am.state' + ' IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' AND tax_line_id = %s', tuple(params + [tax.id])) res[tax] = { @@ -133,10 +133,8 @@ class ReportJournal(models.AbstractModel): if not data.get('form'): raise UserError( _("Form content is missing, this report cannot be printed.")) - target_move = data['form'].get('target_move', 'all') sort_selection = data['form'].get('sort_selection', 'date') - res = {} for journal in data['form']['journal_ids']: res[journal] = self.with_context( diff --git a/base_accounting_kit/report/report_journal_audit.xml b/base_accounting_kit/report/report_journal_audit.xml index 0ab38ac43..6fd2267d8 100644 --- a/base_accounting_kit/report/report_journal_audit.xml +++ b/base_accounting_kit/report/report_journal_audit.xml @@ -14,36 +14,37 @@ Journal -
-
Company:

-
Journal:

-
Entries Sorted By: -

Journal Entry Number

-

Date

+

+ Journal Entry Number +

+

+ Date +

-
Target Moves: -

All Entries

-

All Posted Entries

+

+ All Entries +

+

+ All Posted Entries +

-
-
Name Balance - Comp
- - + + - - +
- + @@ -51,10 +52,11 @@ - + -
Move Date AccountLabel Debit CreditCurrency + Currency +
@@ -87,7 +89,6 @@
-
@@ -107,13 +108,14 @@
-
- + @@ -122,7 +124,8 @@ - +
Tax DeclarationTax + Declaration +
Name
diff --git a/base_accounting_kit/report/report_partner_ledger.py b/base_accounting_kit/report/report_partner_ledger.py index 3ef1e6a21..da2387bf9 100644 --- a/base_accounting_kit/report/report_partner_ledger.py +++ b/base_accounting_kit/report/report_partner_ledger.py @@ -19,9 +19,7 @@ # If not, see . # ############################################################################# - import time - from odoo import api, models, _ from odoo.exceptions import UserError @@ -41,7 +39,12 @@ class ReportPartnerLedger(models.AbstractModel): tuple(data['computed']['account_ids'])] + \ query_get_data[2] query = """ - SELECT "account_move_line".id, "account_move_line".date, j.code, acc.code as a_code, acc.name as a_name, "account_move_line".ref, m.name as move_name, "account_move_line".name, "account_move_line".debit, "account_move_line".credit, "account_move_line".amount_currency,"account_move_line".currency_id, c.symbol AS currency_code + SELECT "account_move_line".id, "account_move_line".date, j.code, + acc.code as a_code, acc.name as a_name, "account_move_line".ref, + m.name as move_name, "account_move_line".name, + "account_move_line".debit, "account_move_line".credit, + "account_move_line".amount_currency, + "account_move_line".currency_id, c.symbol AS currency_code FROM """ + query_get_data[0] + """ LEFT JOIN account_journal j ON ("account_move_line".journal_id = j.id) LEFT JOIN account_account acc ON ("account_move_line".account_id = acc.id) @@ -79,7 +82,6 @@ class ReportPartnerLedger(models.AbstractModel): data['form'].get('used_context', {}))._query_get() reconcile_clause = "" if data['form'][ 'reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL ' - params = [partner.id, tuple(data['computed']['move_state']), tuple(data['computed']['account_ids'])] + \ query_get_data[2] @@ -102,9 +104,7 @@ class ReportPartnerLedger(models.AbstractModel): if not data.get('form'): raise UserError( _("Form content is missing, this report cannot be printed.")) - data['computed'] = {} - obj_partner = self.env['res.partner'] query_get_data = self.env['account.move.line'].with_context( data['form'].get('used_context', {}))._query_get() @@ -118,7 +118,6 @@ class ReportPartnerLedger(models.AbstractModel): data['computed']['ACCOUNT_TYPE'] = ['asset_receivable'] else: data['computed']['ACCOUNT_TYPE'] = ['liability_payable', 'asset_receivable'] - self.env.cr.execute(""" SELECT a.id FROM account_account a diff --git a/base_accounting_kit/report/report_partner_ledger.xml b/base_accounting_kit/report/report_partner_ledger.xml index cd5e9fbe4..aeda5e093 100644 --- a/base_accounting_kit/report/report_partner_ledger.xml +++ b/base_accounting_kit/report/report_partner_ledger.xml @@ -26,14 +26,17 @@
Target Moves: -

All Entries

-

All Posted Entries

+

All + Entries +

+

+ All Posted Entries +

- - + @@ -41,7 +44,9 @@ - + @@ -80,20 +85,28 @@ - diff --git a/base_accounting_kit/report/report_tax.py b/base_accounting_kit/report/report_tax.py index 24128a25b..23e9566f2 100644 --- a/base_accounting_kit/report/report_tax.py +++ b/base_accounting_kit/report/report_tax.py @@ -19,9 +19,7 @@ # If not, see . # ############################################################################# - from _datetime import datetime - from odoo import api, models, _ from odoo.exceptions import UserError @@ -41,15 +39,18 @@ class ReportTax(models.AbstractModel): } def _sql_from_amls_one(self): - sql = """SELECT "account_move_line".tax_line_id, COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0) + sql = """SELECT "account_move_line".tax_line_id, + COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0) FROM %s WHERE %s GROUP BY "account_move_line".tax_line_id""" return sql def _sql_from_amls_two(self): - sql = """SELECT r.account_tax_id, COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0) + sql = """SELECT r.account_tax_id, COALESCE(SUM( + "account_move_line".debit-"account_move_line".credit), 0) FROM %s - INNER JOIN account_move_line_account_tax_rel r ON ("account_move_line".id = r.account_move_line_id) + INNER JOIN account_move_line_account_tax_rel r ON + ("account_move_line".id = r.account_move_line_id) INNER JOIN account_tax t ON (r.account_tax_id = t.id) WHERE %s GROUP BY r.account_tax_id""" return sql @@ -59,14 +60,12 @@ class ReportTax(models.AbstractModel): sql = self._sql_from_amls_one() tables, where_clause, where_params = self.env[ 'account.move.line']._query_get() - query = sql % (tables, where_clause) self.env.cr.execute(query, where_params) results = self.env.cr.fetchall() for result in results: if result[0] in taxes: taxes[result[0]]['tax'] = abs(result[1]) - # compute the net amount sql2 = self._sql_from_amls_two() query = sql2 % (tables, where_clause) @@ -108,7 +107,6 @@ class ReportTax(models.AbstractModel): self.with_context(date_to=date_to, strict_range=True)._compute_from_amls(options, taxes) - groups = dict((tp, []) for tp in ['sale', 'purchase']) for tax in taxes.values(): if tax['tax']: diff --git a/base_accounting_kit/report/report_tax.xml b/base_accounting_kit/report/report_tax.xml index b7f49c512..2c177ede9 100644 --- a/base_accounting_kit/report/report_tax.xml +++ b/base_accounting_kit/report/report_tax.xml @@ -27,7 +27,7 @@
Date JRNL AccountDebit Credit BalanceCurrency + Currency +
+ t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + t-options="{'widget': 'monetary', + 'display_currency': + env.company.currency_id}"/> + + t-options="{'widget': 'monetary', + 'display_currency': line['currency_id']}"/>
- + @@ -38,12 +38,16 @@
@@ -54,17 +58,22 @@ - +
Sale Net Tax - + - +
- + - +
diff --git a/base_accounting_kit/report/report_trial_balance.py b/base_accounting_kit/report/report_trial_balance.py index f702f8ded..bc7f5bff8 100644 --- a/base_accounting_kit/report/report_trial_balance.py +++ b/base_accounting_kit/report/report_trial_balance.py @@ -19,9 +19,7 @@ # If not, see . # ############################################################################# - import time - from odoo import api, models, _ from odoo.exceptions import UserError @@ -34,8 +32,10 @@ class ReportTrialBalance(models.AbstractModel): """ compute the balance, debit and credit for the provided accounts :Arguments: `accounts`: list of accounts record, - `display_account`: it's used to display either all accounts or those accounts which balance is > 0 - :Returns a list of dictionary of Accounts with following key and value + `display_account`: it's used to display either all accounts or + those accounts which balance is > 0 + :Returns a list of dictionary of Accounts with following key + and value `name`: Account name, `code`: Account code, `credit`: total amount of credit, @@ -56,8 +56,11 @@ class ReportTrialBalance(models.AbstractModel): filters = " AND ".join(wheres) # compute the balance, debit and credit for the provided accounts request = ( - "SELECT account_id AS id, SUM(debit) AS debit, SUM(credit) AS credit, (SUM(debit) - SUM(credit)) AS balance" + \ - " FROM " + tables + " WHERE account_id IN %s " + filters + " GROUP BY account_id") + "SELECT account_id AS id, SUM(debit) AS debit, " + "SUM(credit) AS credit, (SUM(debit) - SUM(credit)) " + "AS balance" + + " FROM " + tables + " WHERE account_id IN %s " + + filters + " GROUP BY account_id") params = (tuple(accounts.ids),) + tuple(where_params) self.env.cr.execute(request, params) for row in self.env.cr.dictfetchall(): @@ -66,7 +69,8 @@ class ReportTrialBalance(models.AbstractModel): account_res = [] for account in accounts: res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) - currency = account.currency_id and account.currency_id or account.company_id.currency_id + currency = (account.currency_id and account.currency_id or + account.company_id.currency_id) res['code'] = account.code res['name'] = account.name if account.id in account_result: @@ -89,7 +93,6 @@ class ReportTrialBalance(models.AbstractModel): if not data.get('form') or not self.env.context.get('active_model'): raise UserError( _("Form content is missing, this report cannot be printed.")) - model = self.env.context.get('active_model') docs = self.env[model].browse( self.env.context.get('active_ids', [])) diff --git a/base_accounting_kit/report/report_trial_balance.xml b/base_accounting_kit/report/report_trial_balance.xml index 88d8f1f98..0e0b81291 100644 --- a/base_accounting_kit/report/report_trial_balance.xml +++ b/base_accounting_kit/report/report_trial_balance.xml @@ -7,35 +7,51 @@
-

: Trial Balance

- +

: Trial Balance +

Display Account:

- All accounts - With movements - With balance not equal to zero + + All accounts + + + With movements + + + With balance not equal to zero +

- Date from :
- Date to : + + Date from : + +
+
+ + Date to : + +

Target Moves:

- All Entries - All Posted Entries + All + Entries + + All + Posted Entries +

- - + @@ -46,20 +62,31 @@ diff --git a/base_accounting_kit/security/security.xml b/base_accounting_kit/security/security.xml index 1e4d9ff04..95eb34df9 100644 --- a/base_accounting_kit/security/security.xml +++ b/base_accounting_kit/security/security.xml @@ -4,45 +4,37 @@ Access to Accounting Dashboard - Account Asset Category multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] - Account Asset multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] Accountant - - + + - Chief Accountant - + - - - - - - - - - - diff --git a/base_accounting_kit/views/account_asset_views.xml b/base_accounting_kit/views/account_asset_views.xml index 016523feb..e3d9e7603 100644 --- a/base_accounting_kit/views/account_asset_views.xml +++ b/base_accounting_kit/views/account_asset_views.xml @@ -1,10 +1,8 @@ - - account.asset.category.form account.asset.category @@ -13,44 +11,66 @@
-
- +
-
- +
-
- +
-
- +
- - + - - +
- account.asset.category.kanban account.asset.category @@ -88,20 +108,29 @@
- + + + + +
- + + + + +
-
+
+ +
- account.asset.category.tree account.asset.category @@ -114,63 +143,83 @@ - account.asset.category.search account.asset.category - - + + - + - account.asset.asset.form account.asset.asset
-
-
- + help="Category of asset" + readonly="state != 'draft'"/> - - + + - - + - + - - - - + + + - + - + - + - + @@ -225,13 +286,15 @@ + invisible="type in 'sale'" + readonly="state != 'draft'"/> - + + /> @@ -260,7 +324,6 @@
- account.asset.asset.kanban account.asset.asset @@ -275,19 +338,29 @@
- + + + + +
- + + +
- + + +
- +
@@ -297,12 +370,12 @@ - account.asset.asset.purchase.tree account.asset.asset - + @@ -315,7 +388,6 @@ - account.asset.asset.search account.asset.asset @@ -323,20 +395,24 @@ - - + + - + - - + + - - - Assets account.asset.asset @@ -344,22 +420,23 @@ [('category_id.type', '=', 'purchase')] - - - - + - - - - + + Asset Types account.asset.category [('type', '=', 'purchase')] tree,kanban,form {'default_type': 'purchase'} - - - + diff --git a/base_accounting_kit/views/account_configuration.xml b/base_accounting_kit/views/account_configuration.xml index 145d35669..f2269c67f 100644 --- a/base_accounting_kit/views/account_configuration.xml +++ b/base_accounting_kit/views/account_configuration.xml @@ -12,8 +12,4 @@ - - - - diff --git a/base_accounting_kit/views/account_followup.xml b/base_accounting_kit/views/account_followup.xml index 08558c82d..03c227560 100644 --- a/base_accounting_kit/views/account_followup.xml +++ b/base_accounting_kit/views/account_followup.xml @@ -1,113 +1,123 @@ - - - followup.line.tree - followup.line - - + + followup.line.tree + followup.line + + + + + + + + + followup.line.form + followup.line + +
+
+
+ + account.followup.form + account.followup + +
+

- - -
-
- -
+

+
+ + account.followup.tree + account.followup + + + + + + + + account.followup.select + account.followup + + + + + + + + account.followup.kanban + account.followup + + + + + +
+
+ + + +
- - - - - - - - Payment Follow-ups - ir.actions.act_window - account.followup - - tree,kanban,form - -

+

+
+
+
+
+
+ + Payment Follow-ups + ir.actions.act_window + account.followup + + tree,kanban,form + +

Define follow-up levels and their related actions -

- For each step, specify the actions to be taken and delay in days. It is - possible to use print and e-mail templates to send specific messages to +

+

+ For each step, specify the actions to be taken and delay in + days. It is + possible to use print and e-mail templates to send specific + messages to the customer. -

-
-
- - - -
+

+ + +
\ No newline at end of file diff --git a/base_accounting_kit/views/account_group.xml b/base_accounting_kit/views/account_group.xml index 9b4de4c18..d47d16d72 100644 --- a/base_accounting_kit/views/account_group.xml +++ b/base_accounting_kit/views/account_group.xml @@ -1,16 +1,11 @@ + - - - - Account Groups - account.group - tree,form - - - - - - + + Account Groups + account.group + tree,form + + \ No newline at end of file diff --git a/base_accounting_kit/views/account_move_views.xml b/base_accounting_kit/views/account_move_views.xml index c3bf5a87b..d92936d31 100644 --- a/base_accounting_kit/views/account_move_views.xml +++ b/base_accounting_kit/views/account_move_views.xml @@ -1,20 +1,24 @@ - account.invoice.supplier.form account.move - - + + - - + + - diff --git a/base_accounting_kit/views/account_payment_view.xml b/base_accounting_kit/views/account_payment_view.xml index 9c422be4f..ed2e87217 100644 --- a/base_accounting_kit/views/account_payment_view.xml +++ b/base_accounting_kit/views/account_payment_view.xml @@ -1,14 +1,15 @@ - + account.payment.form.inherited account.payment - - - + + +
- + - +
-
diff --git a/base_accounting_kit/views/multiple_invoice_layout_view.xml b/base_accounting_kit/views/multiple_invoice_layout_view.xml index b6e5d60cc..684fcba71 100644 --- a/base_accounting_kit/views/multiple_invoice_layout_view.xml +++ b/base_accounting_kit/views/multiple_invoice_layout_view.xml @@ -1,42 +1,44 @@ - - Document Layout - multiple.invoice.layout - -
- - - - - - - - - -
- -
+ + Document Layout + multiple.invoice.layout + + + + + + + + + + -
-
- -
-
- - - ir.actions.act_window - Configure Copy layout - form - new - multiple.invoice.layout - - - +
+ +
+
+
+
+ +
+
+ + ir.actions.act_window + Configure Copy layout + form + new + multiple.invoice.layout + +
diff --git a/base_accounting_kit/views/product_template_views.xml b/base_accounting_kit/views/product_template_views.xml index 2f0ba6c04..d8634d3bf 100644 --- a/base_accounting_kit/views/product_template_views.xml +++ b/base_accounting_kit/views/product_template_views.xml @@ -14,4 +14,4 @@
-
\ No newline at end of file + diff --git a/base_accounting_kit/views/product_views.xml b/base_accounting_kit/views/product_views.xml index d58c8ae31..0c9399d53 100644 --- a/base_accounting_kit/views/product_views.xml +++ b/base_accounting_kit/views/product_views.xml @@ -14,4 +14,4 @@ - \ No newline at end of file + diff --git a/base_accounting_kit/views/recurring_payments_view.xml b/base_accounting_kit/views/recurring_payments_view.xml index c40425348..51d88a19b 100644 --- a/base_accounting_kit/views/recurring_payments_view.xml +++ b/base_accounting_kit/views/recurring_payments_view.xml @@ -1,99 +1,101 @@ - - - - - Recurring Template - account.recurring.payments - -
-
- -
- + + + Recurring Template + account.recurring.payments + + +
+ +
+ + - - - - - - - - - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + - - - - - - - - + + - - - + + - - + + - + - - - - -
-
- - - - Recurring Templates - account.recurring.payments - - - - - - - - - - - - - - - - - - Recurring Templates - account.recurring.payments - ir.actions.act_window - tree,form - - current - -

Click to create new recurring payment template

-
-
- - -
+ + + + + + + + + + + + + + + Recurring Templates + account.recurring.payments + + + + + + + + + + + + + + + + Recurring Templates + account.recurring.payments + ir.actions.act_window + tree,form + + current + +

Click to create new recurring + payment template +

+
+
+
diff --git a/base_accounting_kit/views/reports_config_view.xml b/base_accounting_kit/views/reports_config_view.xml index 4c80038b4..7ef312370 100644 --- a/base_accounting_kit/views/reports_config_view.xml +++ b/base_accounting_kit/views/reports_config_view.xml @@ -1,86 +1,82 @@ - - - - - account.financial.report.form - account.financial.report - -
- - - - - - - - - - - - - - - - - - - -
-
- - - account.financial.report.tree - account.financial.report - - + + + account.financial.report.form + account.financial.report + +
+ - + + - -
-
-
- - - account.financial.report.search - account.financial.report - - - - - - - - - - - - - - - Financial Reports - ir.actions.act_window - account.financial.report - tree,form - - - - - -
+ + + + + + + + + + + + + + + + + + account.financial.report.tree + account.financial.report + + + + + + + + + + + account.financial.report.search + account.financial.report + + + + + + + + + + + + + + Financial Reports + ir.actions.act_window + account.financial.report + tree,form + + + +
diff --git a/base_accounting_kit/views/res_config_view.xml b/base_accounting_kit/views/res_config_view.xml index e2446d514..1d6b2fd3e 100644 --- a/base_accounting_kit/views/res_config_view.xml +++ b/base_accounting_kit/views/res_config_view.xml @@ -1,43 +1,40 @@ + - - - res.config.view.inherited.base.accounting.kit - res.config.settings - - - - -
-
- -
-
-
+ + res.config.view.inherited.base.accounting.kit + res.config.settings + + + + +
+
+
- - - - - - -
-
- +
+
+ + + + +
+
+ +
+
+
- - - - - +
+
+
+ \ No newline at end of file diff --git a/base_accounting_kit/wizard/account_bank_book_wizard.py b/base_accounting_kit/wizard/account_bank_book_wizard.py index 89f30a7cc..f266fca5f 100644 --- a/base_accounting_kit/wizard/account_bank_book_wizard.py +++ b/base_accounting_kit/wizard/account_bank_book_wizard.py @@ -20,7 +20,7 @@ # ############################################################################# from datetime import date -from odoo import models, fields, api, _ +from odoo import api, fields, models, _ from odoo.exceptions import UserError @@ -32,7 +32,8 @@ class BankBookWizard(models.TransientModel): readonly=True, default=lambda self: self.env.company) target_move = fields.Selection([('posted', 'All Posted Entries'), - ('all', 'All Entries')], string='Target Moves', required=True, + ('all', 'All Entries')], + string='Target Moves', required=True, default='posted') date_from = fields.Date(string='Start Date', default=date.today(), required=True) @@ -43,19 +44,22 @@ class BankBookWizard(models.TransientModel): ('not_zero', 'With balance is not equal to 0')], string='Display Accounts', required=True, default='movement') sortby = fields.Selection( - [('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], + [('sort_date', 'Date'), ('sort_journal_partner', + 'Journal & Partner')], string='Sort by', required=True, default='sort_date') initial_balance = fields.Boolean(string='Include Initial Balances', - help='If you selected date, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.') + help='If you selected date, this field ' + 'allow you to add a row to display ' + 'the amount of debit/credit/balance that precedes the filter you\'ve set.') def _get_default_account_ids(self): journals = self.env['account.journal'].search([('type', '=', 'bank')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) + accounts.append( + journal.company_id.account_journal_payment_credit_account_id.id) return accounts - account_ids = fields.Many2many('account.account', 'account_report_bankbook_account_rel', 'report_id', 'account_id', @@ -75,7 +79,8 @@ class BankBookWizard(models.TransientModel): [('type', '=', 'bank')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) + accounts.append( + journal.company_id.account_journal_payment_credit_account_id.id) domain = {'account_ids': [('id', 'in', accounts)]} return {'domain': domain} diff --git a/base_accounting_kit/wizard/account_bank_book_wizard_view.xml b/base_accounting_kit/wizard/account_bank_book_wizard_view.xml index 8f0f62f14..74a39a030 100644 --- a/base_accounting_kit/wizard/account_bank_book_wizard_view.xml +++ b/base_accounting_kit/wizard/account_bank_book_wizard_view.xml @@ -1,43 +1,43 @@ - - - account.bank.book.form.view - account.bank.book.report - -
- - - - - - - - - - - - - - -
-
- -
-
- - - Bank Book Report - ir.actions.act_window - account.bank.book.report - - form - new - - - -
+ + account.bank.book.form.view + account.bank.book.report + +
+ + + + + + + + + + + + + + +
+
+ +
+
+ + Bank Book Report + ir.actions.act_window + account.bank.book.report + + form + new + +
\ No newline at end of file diff --git a/base_accounting_kit/wizard/account_cash_book_wizard.py b/base_accounting_kit/wizard/account_cash_book_wizard.py index 8ed274ad3..def8e7d0a 100644 --- a/base_accounting_kit/wizard/account_cash_book_wizard.py +++ b/base_accounting_kit/wizard/account_cash_book_wizard.py @@ -20,8 +20,7 @@ # ############################################################################# from datetime import date - -from odoo import models, fields, api, _ +from odoo import api, fields, models, _ from odoo.exceptions import UserError @@ -33,7 +32,8 @@ class CashBookWizard(models.TransientModel): readonly=True, default=lambda self: self.env.company) target_move = fields.Selection([('posted', 'All Posted Entries'), - ('all', 'All Entries')], string='Target Moves', required=True, + ('all', 'All Entries')], + string='Target Moves', required=True, default='posted') date_from = fields.Date(string='Start Date', default=date.today(), required=True) @@ -48,13 +48,19 @@ class CashBookWizard(models.TransientModel): string='Sort by', required=True, default='sort_date') initial_balance = fields.Boolean(string='Include Initial Balances', - help='If you selected date, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.') + help='If you selected date, this field ' + 'allow you to add a row to display' + ' the' + ' amount of debit/credit/balance' + ' that ' + 'precedes the filter you\'ve set.') def _get_default_account_ids(self): journals = self.env['account.journal'].search([('type', '=', 'cash')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) + accounts.append( + journal.company_id.account_journal_payment_credit_account_id.id) return accounts account_ids = fields.Many2many('account.account', @@ -76,7 +82,8 @@ class CashBookWizard(models.TransientModel): [('type', '=', 'cash')]) accounts = [] for journal in journals: - accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) + accounts.append( + journal.company_id.account_journal_payment_credit_account_id.id) domain = {'account_ids': [('id', 'in', accounts)]} return {'domain': domain} @@ -107,5 +114,6 @@ class CashBookWizard(models.TransientModel): lang=self.env.context.get( 'lang') or 'en_US') return self.env.ref( - 'base_accounting_kit.action_report_cash_book').report_action(self, - data=data) + 'base_accounting_kit.action_report_cash_book').report_action( + self, + data=data) diff --git a/base_accounting_kit/wizard/account_cash_book_wizard_view.xml b/base_accounting_kit/wizard/account_cash_book_wizard_view.xml index d2ae177fd..7252f261a 100644 --- a/base_accounting_kit/wizard/account_cash_book_wizard_view.xml +++ b/base_accounting_kit/wizard/account_cash_book_wizard_view.xml @@ -1,43 +1,43 @@ - - - account.cash.book.form.view - account.cash.book.report - -
- - - - - - - - - - - - - - -
-
- -
-
- - - Cash Book Report - ir.actions.act_window - account.cash.book.report - - form - new - - - -
-
\ No newline at end of file + + account.cash.book.form.view + account.cash.book.report + +
+ + + + + + + + + + + + + + +
+
+ +
+
+ + Cash Book Report + ir.actions.act_window + account.cash.book.report + + form + new + + + diff --git a/base_accounting_kit/wizard/account_day_book_wizard.py b/base_accounting_kit/wizard/account_day_book_wizard.py index 05336b67a..f8f385b52 100644 --- a/base_accounting_kit/wizard/account_day_book_wizard.py +++ b/base_accounting_kit/wizard/account_day_book_wizard.py @@ -20,8 +20,7 @@ # ############################################################################# from datetime import date - -from odoo import models, fields +from odoo import fields, models class DayBookWizard(models.TransientModel): @@ -36,14 +35,13 @@ class DayBookWizard(models.TransientModel): default=lambda self: self.env[ 'account.journal'].search([])) target_move = fields.Selection([('posted', 'All Posted Entries'), - ('all', 'All Entries')], string='Target Moves', required=True, + ('all', 'All Entries')], + string='Target Moves', required=True, default='posted') - account_ids = fields.Many2many('account.account', 'account_report_daybook_account_rel', 'report_id', 'account_id', 'Accounts') - date_from = fields.Date(string='Start Date', default=date.today(), required=True) date_to = fields.Date(string='End Date', default=date.today(), diff --git a/base_accounting_kit/wizard/account_day_book_wizard_view.xml b/base_accounting_kit/wizard/account_day_book_wizard_view.xml index cdb74b2b2..07d5ee88e 100644 --- a/base_accounting_kit/wizard/account_day_book_wizard_view.xml +++ b/base_accounting_kit/wizard/account_day_book_wizard_view.xml @@ -1,40 +1,40 @@ - - - account.day.book.form.view - account.day.book.report - -
- - - - - - - - - - - -
-
- -
-
- - - Day Book Report - ir.actions.act_window - account.day.book.report - - form - new - - - -
+ + account.day.book.form.view + account.day.book.report + +
+ + + + + + + + + + + +
+
+ +
+
+ + Day Book Report + ir.actions.act_window + account.day.book.report + + form + new + +
\ No newline at end of file diff --git a/base_accounting_kit/wizard/account_lock_date.py b/base_accounting_kit/wizard/account_lock_date.py index b266c5bee..0545ca03e 100644 --- a/base_accounting_kit/wizard/account_lock_date.py +++ b/base_accounting_kit/wizard/account_lock_date.py @@ -30,12 +30,16 @@ class AccountUpdateLockDate(models.TransientModel): company_id = fields.Many2one(comodel_name='res.company', string="Company", required=True) period_lock_date = fields.Date(string="Lock Date for Non-Advisers", - help="Only users with the 'Adviser' role can edit accounts prior to " - "and inclusive of this date. Use it for period locking inside an " + help="Only users with the 'Adviser' role " + "can edit accounts prior to " + "and inclusive of this date. Use it for" + " period locking inside an " "open fiscal year, for example.") fiscalyear_lock_date = fields.Date(string="Lock Date", - help="No users, including Advisers, can edit accounts prior to and " - "inclusive of this date. Use it for fiscal year locking for " + help="No users, including Advisers, can " + "edit accounts prior to and " + "inclusive of this date. Use it for " + "fiscal year locking for " "example.") @api.model diff --git a/base_accounting_kit/wizard/account_lock_date.xml b/base_accounting_kit/wizard/account_lock_date.xml index 25d374307..51e6380c7 100644 --- a/base_accounting_kit/wizard/account_lock_date.xml +++ b/base_accounting_kit/wizard/account_lock_date.xml @@ -1,6 +1,5 @@ - account.lock.date.form account.lock.date @@ -12,25 +11,24 @@
-
- - - + Lock your Fiscal Period account.lock.date form new - -
diff --git a/base_accounting_kit/wizard/account_report_common_partner.py b/base_accounting_kit/wizard/account_report_common_partner.py index b1852feb6..0904a0eed 100644 --- a/base_accounting_kit/wizard/account_report_common_partner.py +++ b/base_accounting_kit/wizard/account_report_common_partner.py @@ -19,7 +19,6 @@ # If not, see . # ############################################################################# - from odoo import fields, models from odoo.tools.misc import get_lang @@ -39,21 +38,23 @@ class AccountingCommonPartnerReport(models.TransientModel): relation="account_common_parnter_report_section_rel", column1="main_report_id", column2="sub_report_id") - company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, + company_id = fields.Many2one('res.company', string='Company', + required=True, readonly=True, default=lambda self: self.env.company) journal_ids = fields.Many2many( comodel_name='account.journal', string='Journals', required=True, - default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]), + default=lambda self: self.env['account.journal'].search( + [('company_id', '=', self.company_id.id)]), domain="[('company_id', '=', company_id)]", ) date_from = fields.Date(string='Start Date') date_to = fields.Date(string='End Date') target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries'), - ], string='Target Moves', required=True, default='posted') - + ], string='Target Moves', required=True, + default='posted') result_selection = fields.Selection([('customer', 'Receivable Accounts'), ('supplier', 'Payable Accounts'), ('customer_supplier', @@ -77,9 +78,12 @@ class AccountingCommonPartnerReport(models.TransientModel): data = {} data['ids'] = self.env.context.get('active_ids', []) data['model'] = self.env.context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0] + data['form'] = self.read( + ['date_from', 'date_to', 'journal_ids', 'target_move', + 'company_id'])[0] used_context = self._build_contexts(data) - data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code) + data['form']['used_context'] = dict(used_context, + lang=get_lang(self.env).code) return self.with_context(discard_logo_check=True)._print_report(data) def _print_report(self, data): @@ -88,9 +92,8 @@ class AccountingCommonPartnerReport(models.TransientModel): 'account_report_id', 'enable_filter', 'label_filter', 'target_move'])[0]) return self.env.ref( - 'base_accounting_kit.action_report_cash_flow').report_action(self, - data=data, - config=False) + 'base_accounting_kit.action_report_cash_flow').report_action( + self, data=data, config=False) def pre_print_report(self, data): data['form'].update(self.read(['result_selection'])[0]) diff --git a/base_accounting_kit/wizard/aged_partner.py b/base_accounting_kit/wizard/aged_partner.py index 6b751f46b..b92cba37e 100644 --- a/base_accounting_kit/wizard/aged_partner.py +++ b/base_accounting_kit/wizard/aged_partner.py @@ -19,11 +19,8 @@ # If not, see . # ############################################################################# - import time - from dateutil.relativedelta import relativedelta - from odoo import fields, models, _ from odoo.exceptions import UserError @@ -43,9 +40,11 @@ class AccountAgedTrialBalance(models.TransientModel): relation="account_aged_trail_report_section_rel", column1="main_report_id", column2="sub_report_id") - name = fields.Char(string="Account Aged Trial balance Report", default="Account Aged Trial balance Report", required=True, translate=True) - - journal_ids = fields.Many2many('account.journal', string='Journals', + name = fields.Char(string="Account Aged Trial balance Report", + default="Account Aged Trial balance Report", + required=True, translate=True) + journal_ids = fields.Many2many('account.journal', + string='Journals', required=True) period_length = fields.Integer(string='Period Length (days)', required=True, default=30) @@ -60,9 +59,7 @@ class AccountAgedTrialBalance(models.TransientModel): raise UserError(_('You must set a period length greater than 0.')) if not data['form']['date_from']: raise UserError(_('You must set a start date.')) - start = data['form']['date_from'] - for i in range(5)[::-1]: stop = start - relativedelta(days=period_length - 1) res[str(i)] = { diff --git a/base_accounting_kit/wizard/aged_partner.xml b/base_accounting_kit/wizard/aged_partner.xml index 05d0a02a5..09cf697b6 100644 --- a/base_accounting_kit/wizard/aged_partner.xml +++ b/base_accounting_kit/wizard/aged_partner.xml @@ -1,6 +1,5 @@ - Aged Partner Balance account.aged.trial.balance @@ -13,15 +12,15 @@ -
-
- Aged Partner Balance account.aged.trial.balance @@ -31,11 +30,9 @@ {} new - -
diff --git a/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py b/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py index d0f4181aa..cb0f05912 100644 --- a/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py +++ b/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py @@ -19,26 +19,33 @@ # If not, see . # ############################################################################# - -from odoo import api, fields, models, _ +from odoo import fields, models, _ class AssetDepreciationConfirmationWizard(models.TransientModel): _name = "asset.depreciation.confirmation.wizard" _description = "asset.depreciation.confirmation.wizard" - date = fields.Date('Account Date', required=True, help="Choose the period for which you want to automatically post the depreciation lines of running assets", default=fields.Date.context_today) + date = fields.Date('Account Date', required=True, + help="Choose the period for which you want to " + "automatically post the depreciation lines of " + "running assets", default=fields.Date.context_today) def asset_compute(self): self.ensure_one() context = self._context - created_move_ids = self.env['account.asset.asset'].compute_generated_entries(self.date, asset_type=context.get('asset_type')) - + created_move_ids = (self.env['account.asset.asset']. + compute_generated_entries(self.date, + asset_type=context.get( + 'asset_type'))) return { - 'name': _('Created Asset Moves') if context.get('asset_type') == 'purchase' else _('Created Revenue Moves'), + 'name': _('Created Asset Moves') if context.get('asset_type') == + 'purchase' else _( + 'Created Revenue Moves'), 'view_mode': 'tree,form', 'res_model': 'account.move', 'view_id': False, - 'domain': "[('id','in',[" + ','.join(str(id) for id in created_move_ids) + "])]", + 'domain': "[('id','in',[" + ','.join( + str(id) for id in created_move_ids) + "])]", 'type': 'ir.actions.act_window', } diff --git a/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml b/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml index a4b5fff9a..5217a32c1 100644 --- a/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml +++ b/base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml @@ -7,32 +7,39 @@

- This wizard will post installment/depreciation lines for the selected month.
- This will generate journal entries for all related installment lines on this period of asset/revenue recognition as well. -

+ This wizard will post installment/depreciation lines for + the selected month. +
+ This will generate journal entries for all related + installment lines on this period of asset/revenue + recognition as well. +

-
- + - - + Post Depreciation Lines asset.depreciation.confirmation.wizard tree,form - + new {'asset_type': 'purchase'} - - - + diff --git a/base_accounting_kit/wizard/asset_modify.py b/base_accounting_kit/wizard/asset_modify.py index 7fdf6b1b5..1d728c1d6 100644 --- a/base_accounting_kit/wizard/asset_modify.py +++ b/base_accounting_kit/wizard/asset_modify.py @@ -19,20 +19,8 @@ # If not, see . # ############################################################################# - from lxml import etree - from odoo import api, fields, models, _ -# from odoo.addons.base.models.ir_ui_view import (transfer_field_to_modifiers, transfer_node_to_modifiers, transfer_modifiers_to_node) - - -# def setup_modifiers(node, field=None, context=None, in_tree_view=False): -# modifiers = {} -# if field is not None: -# transfer_field_to_modifiers(field, modifiers) -# transfer_node_to_modifiers( -# node, modifiers, context=context) -# transfer_modifiers_to_node(modifiers, node) class AssetModify(models.TransientModel): @@ -40,29 +28,37 @@ class AssetModify(models.TransientModel): _description = 'Modify Asset' name = fields.Text(string='Reason', required=True) - method_number = fields.Integer(string='Number of Depreciations', required=True) + method_number = fields.Integer(string='Number of Depreciations', + required=True) method_period = fields.Integer(string='Period Length') method_end = fields.Date(string='Ending date') - asset_method_time = fields.Char(compute='_get_asset_method_time', string='Asset Method Time', readonly=True) + asset_method_time = fields.Char(compute='_get_asset_method_time', + string='Asset Method Time', readonly=True) def _get_asset_method_time(self): if self.env.context.get('active_id'): - asset = self.env['account.asset.asset'].browse(self.env.context.get('active_id')) + asset = self.env['account.asset.asset'].browse( + self.env.context.get('active_id')) self.asset_method_time = asset.method_time @api.model - def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): - result = super(AssetModify, self).fields_view_get(view_id, view_type, toolbar=toolbar, submenu=submenu) + def fields_view_get(self, view_id=None, view_type='form', toolbar=False, + submenu=False): + result = super(AssetModify, self).fields_view_get(view_id, view_type, + toolbar=toolbar, + submenu=submenu) asset_id = self.env.context.get('active_id') active_model = self.env.context.get('active_model') if active_model == 'account.asset.asset' and asset_id: asset = self.env['account.asset.asset'].browse(asset_id) doc = etree.XML(result['arch']) - if asset.method_time == 'number' and doc.xpath("//field[@name='method_end']"): + if asset.method_time == 'number' and doc.xpath( + "//field[@name='method_end']"): node = doc.xpath("//field[@name='method_end']")[0] node.set('invisible', '1') # setup_modifiers(node, result['fields']['method_end']) - elif asset.method_time == 'end' and doc.xpath("//field[@name='method_number']"): + elif asset.method_time == 'end' and doc.xpath( + "//field[@name='method_number']"): node = doc.xpath("//field[@name='method_number']")[0] node.set('invisible', '1') # setup_modifiers(node, result['fields']['method_number']) @@ -83,7 +79,8 @@ class AssetModify(models.TransientModel): if 'method_end' in fields and asset.method_time == 'end': res.update({'method_end': asset.method_end}) if self.env.context.get('active_id'): - active_asset = self.env['account.asset.asset'].browse(self.env.context.get('active_id')) + active_asset = self.env['account.asset.asset'].browse( + self.env.context.get('active_id')) res['asset_method_time'] = active_asset.method_time return res @@ -105,8 +102,12 @@ class AssetModify(models.TransientModel): } asset.write(asset_vals) asset.compute_depreciation_board() - tracked_fields = self.env['account.asset.asset'].fields_get(['method_number', 'method_period', 'method_end']) - changes, tracking_value_ids = asset._mail_track(tracked_fields, old_values) + tracked_fields = self.env['account.asset.asset'].fields_get( + ['method_number', 'method_period', 'method_end']) + changes, tracking_value_ids = asset._mail_track(tracked_fields, + old_values) if changes: - asset.message_post(subject=_('Depreciation board modified'), body=self.name, tracking_value_ids=tracking_value_ids) + asset.message_post(subject=_('Depreciation board modified'), + body=self.name, + tracking_value_ids=tracking_value_ids) return {'type': 'ir.actions.act_window_close'} diff --git a/base_accounting_kit/wizard/asset_modify_views.xml b/base_accounting_kit/wizard/asset_modify_views.xml index 4531853ba..fe53c92b2 100644 --- a/base_accounting_kit/wizard/asset_modify_views.xml +++ b/base_accounting_kit/wizard/asset_modify_views.xml @@ -1,6 +1,5 @@ - wizard.asset.modify.form asset.modify @@ -9,32 +8,35 @@ - - + + - +
-
- - Modify Asset - asset.modify - ir.actions.act_window - tree,form - - new - - + Modify Asset + asset.modify + ir.actions.act_window + tree,form + + new + diff --git a/base_accounting_kit/wizard/cash_flow_report.py b/base_accounting_kit/wizard/cash_flow_report.py index bfeb5811e..16932e5d8 100644 --- a/base_accounting_kit/wizard/cash_flow_report.py +++ b/base_accounting_kit/wizard/cash_flow_report.py @@ -37,18 +37,23 @@ class AccountingReport(models.TransientModel): relation="account_cash_flow_report_section_rel", column1="main_report_id", column2="sub_report_id") - name = fields.Char(string="Cash Flow Report", default="Cash Flow Report", required=True, translate=True) + name = fields.Char(string="Cash Flow Report", default="Cash Flow Report", + required=True, translate=True) date_from = fields.Date(string='Start Date') date_to = fields.Date(string='End Date') - company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company) + company_id = fields.Many2one('res.company', string='Company', required=True, + readonly=True, + default=lambda self: self.env.company) target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries'), - ], string='Target Moves', required=True, default='posted') + ], string='Target Moves', required=True, + default='posted') journal_ids = fields.Many2many( comodel_name='account.journal', string='Journals', required=True, - default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]), + default=lambda self: self.env['account.journal'].search( + [('company_id', '=', self.company_id.id)]), domain="[('company_id', '=', company_id)]", ) @@ -68,7 +73,8 @@ class AccountingReport(models.TransientModel): required=True, default=_get_account_report) label_filter = fields.Char(string='Column Label', - help="This label will be displayed on report to show the balance" + help="This label will be displayed on report " + "to show the balance" " computed for the given comparison filter.") filter_cmp = fields.Selection( [('filter_no', 'No Filters'), ('filter_date', 'Date')], @@ -76,7 +82,11 @@ class AccountingReport(models.TransientModel): date_from_cmp = fields.Date(string='Date Start') date_to_cmp = fields.Date(string='Date End') debit_credit = fields.Boolean(string='Display Debit/Credit Columns', - help="This option allows you to get more details about the way your balances are computed. Because it is space consuming, we do not allow to use it while doing a comparison.") + help="This option allows you to get more " + "details about the way your balances are" + " computed. Because it is space " + "consuming, we do not allow to use it " + "while doing a comparison.") def _build_comparison_context(self, data): result = {} @@ -92,8 +102,10 @@ class AccountingReport(models.TransientModel): def _build_contexts(self, data): result = {} - result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False - result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' + result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][ + 'journal_ids'] or False + result['state'] = 'target_move' in data['form'] and data['form'][ + 'target_move'] or '' result['date_from'] = data['form']['date_from'] or False result['date_to'] = data['form']['date_to'] or False result['strict_range'] = True if result['date_from'] else False @@ -123,6 +135,6 @@ class AccountingReport(models.TransientModel): 'account_report_id', 'enable_filter', 'label_filter', 'target_move'])[0]) return self.env.ref( - 'base_accounting_kit.action_report_cash_flow').report_action(self, - data=data, - config=False) + 'base_accounting_kit.action_report_cash_flow').report_action( + self, data=data, + config=False) diff --git a/base_accounting_kit/wizard/cash_flow_report.xml b/base_accounting_kit/wizard/cash_flow_report.xml index f9a17165c..9a395d482 100644 --- a/base_accounting_kit/wizard/cash_flow_report.xml +++ b/base_accounting_kit/wizard/cash_flow_report.xml @@ -3,11 +3,13 @@ Cash Flow Statement cash.flow.report - + - + @@ -20,12 +22,16 @@ - + - - - + + + @@ -33,7 +39,6 @@ - Cash Flow Statement cash.flow.report @@ -49,5 +54,4 @@ sequence="5" action="action_cash_flow_report" parent="base_accounting_kit.account_reports_generic_statements"/> - diff --git a/base_accounting_kit/wizard/financial_report.py b/base_accounting_kit/wizard/financial_report.py index 331b7cfc3..5261bec55 100644 --- a/base_accounting_kit/wizard/financial_report.py +++ b/base_accounting_kit/wizard/financial_report.py @@ -20,7 +20,6 @@ # ############################################################################# import re - from odoo import api, models, fields @@ -39,11 +38,12 @@ class FinancialReport(models.TransientModel): relation="account_financial_report_section_rel", column1="main_report_id", column2="sub_report_id") - name = fields.Char(string="Financial Report", default="Financial Report", required=True, translate=True) - + name = fields.Char(string="Financial Report", default="Financial Report", + required=True, translate=True) target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries'), - ], string='Target Moves', required=True, default='posted') + ], string='Target Moves', required=True, + default='posted') view_format = fields.Selection([ ('vertical', 'Vertical'), @@ -51,7 +51,6 @@ class FinancialReport(models.TransientModel): default='vertical', string="Format") - def _build_contexts(self, data): result = {} result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][ @@ -80,7 +79,6 @@ class FinancialReport(models.TransientModel): 'account.financial.report', string='Account Reports', required=True) - date_from = fields.Date(string='Start Date') date_to = fields.Date(string='End Date') debit_credit = fields.Boolean( @@ -114,7 +112,6 @@ class FinancialReport(models.TransientModel): data['form']['used_context'] = dict( used_context, lang=self.env.context.get('lang') or 'en_US') - report_lines = self.get_account_lines(data['form']) # find the journal items of these accounts journal_items = self.find_journal_items(report_lines, data['form']) @@ -136,10 +133,6 @@ class FinancialReport(models.TransientModel): item['balance'] = round(item['balance'], 2) if not item['parent']: item['level'] = 1 - parent = item - report_name = item['name'] - id = item['id'] - report_id = item['r_id'] else: item['level'] = set_report_level(item) currency = self._get_currency() @@ -162,7 +155,6 @@ class FinancialReport(models.TransientModel): 'debit': "COALESCE(SUM(debit), 0) as debit", 'credit': "COALESCE(SUM(credit), 0) as credit", } - res = {} for account in accounts: res[account.id] = dict((fn, 0.0) @@ -221,20 +213,25 @@ class FinancialReport(models.TransientModel): ]) if report.name == "Expenses": accounts = self.env['account.account'].search([ - ('account_type', 'in', ["expense","expense_depreciation","expense_direct_cost"]) + ('account_type', 'in', ["expense", + "expense_depreciation", + "expense_direct_cost"]) ]) if report.name == "Liability": accounts = self.env['account.account'].search([ - ('account_type', 'in', ["liability_payable","equity","liability_current","liability_non_current"]) + ('account_type', 'in', + ["liability_payable", "equity", "liability_current", + "liability_non_current"]) ]) if report.name == "Assets": accounts = self.env['account.account'].search([ - ('account_type', 'in', ["asset_receivable","asset_cash","asset_current","asset_non_current","asset_prepayments","asset_fixed"]) + ('account_type', 'in', + ["asset_receivable", "asset_cash", "asset_current", + "asset_non_current", "asset_prepayments", + "asset_fixed"]) ]) - res[report.id]['account'] = self._compute_account_balance( accounts) - for value in res[report.id]['account'].values(): for field in fields: res[report.id][field] += value.get(field) @@ -269,17 +266,13 @@ class FinancialReport(models.TransientModel): for account_id, val in \ comparison_res[report_id].get('account').items(): report_acc[account_id]['comp_bal'] = val['balance'] - for report in child_reports: r_name = str(report.name) - # r_name = r_name.replace(" ", "-") + "-" r_name = re.sub('[^0-9a-zA-Z]+', '', r_name) if report.parent_id: p_name = str(report.parent_id.name) p_name = re.sub('[^0-9a-zA-Z]+', '', p_name) + str( report.parent_id.id) - # p_name = p_name.replace(" ", "-") + - # "-" + str(report.parent_id.id) else: p_name = False vals = { @@ -310,7 +303,6 @@ class FinancialReport(models.TransientModel): # used to display the details of the # financial report, so it's not needed here. continue - if res[report.id].get('account'): sub_lines = [] for account_id, value \ @@ -327,7 +319,8 @@ class FinancialReport(models.TransientModel): # new_r_name = new_r_name.replace(" ", "-") + "-" vals = { 'account': account.id, - 'a_id': account.code + re.sub('[^0-9a-zA-Z]+', 'acnt', + 'a_id': account.code + re.sub('[^0-9a-zA-Z]+', + 'acnt', account.name) + str( account.id), 'name': account.code + '-' + account.name, @@ -335,7 +328,8 @@ class FinancialReport(models.TransientModel): 'type': 'account', 'parent': r_name + str(report.id), 'level': ( - report.display_detail == 'detail_with_hierarchy' and + report.display_detail == + 'detail_with_hierarchy' and 4), 'account_type': account.account_type, } @@ -369,19 +363,24 @@ class FinancialReport(models.TransientModel): if i['type'] == 'account': account = i['account'] if form['target_move'] == 'posted': - search_query = "select aml.id, am.id as j_id, aml.account_id, aml.date," \ - " aml.name as label, am.name, " \ - + "(aml.debit-aml.credit) as balance, aml.debit, aml.credit, aml.partner_id " \ - + " from account_move_line aml join account_move am " \ - "on (aml.move_id=am.id and am.state=%s) " \ - + " where aml.account_id=%s" + search_query = ("select aml.id, am.id as j_id, " + "aml.account_id, aml.date, aml.name as " + "label, am.name, (aml.debit-aml.credit) as " + "balance, aml.debit, aml.credit, " + "aml.partner_id from " + "account_move_line aml " + "join account_move am on (aml.move_id=am.id" + " and am.state=%s) where aml.account_id=%s") vals = [form['target_move']] else: - search_query = "select aml.id, am.id as j_id, aml.account_id, aml.date, " \ - "aml.name as label, am.name, " \ - + "(aml.debit-aml.credit) as balance, aml.debit, aml.credit, aml.partner_id " \ - + " from account_move_line aml join account_move am on (aml.move_id=am.id) " \ - + " where aml.account_id=%s" + search_query = ("select aml.id, am.id as j_id, " + "aml.account_id, aml.date, aml.name as " + "label, am.name, (aml.debit-aml.credit) as " + "balance, aml.debit, aml.credit, " + "aml.partner_id from account_move_line aml" + " join account_move am on " + "(aml.move_id=am.id) where " + "aml.account_id=%s") vals = [] if form['date_from'] and form['date_to']: search_query += " and aml.date>=%s and aml.date<=%s" @@ -396,10 +395,10 @@ class FinancialReport(models.TransientModel): vals += [account] cr.execute(search_query, tuple(vals)) items = cr.dictfetchall() - for j in items: temp = j['id'] - j['id'] = re.sub('[^0-9a-zA-Z]+', '', i['name']) + str( + j['id'] = re.sub('[^0-9a-zA-Z]+', '', + i['name']) + str( temp) j['p_id'] = str(i['a_id']) j['type'] = 'journal_item' @@ -417,7 +416,6 @@ class FinancialReport(models.TransientModel): class ProfitLossPdf(models.AbstractModel): """ Abstract model for generating PDF report value and send to template """ - _name = 'report.base_accounting_kit.report_financial' _description = 'Financial Report' diff --git a/base_accounting_kit/wizard/financial_report.xml b/base_accounting_kit/wizard/financial_report.xml index 6353059f0..ec545d8f8 100644 --- a/base_accounting_kit/wizard/financial_report.xml +++ b/base_accounting_kit/wizard/financial_report.xml @@ -1,65 +1,62 @@ - - - - financial.report.extended.wiz - financial.report - -
+ + + financial.report.extended.wiz + financial.report + + + + + + + - - - - - - - - - - - + + + + + + -
-
- -
-
- - - Profit and Loss - financial.report - ir.actions.act_window - form - - new - - - - - - Balance Sheet - financial.report - ir.actions.act_window - form - - new - - - - - - -
+
+
+ +
+ + + + Profit and Loss + financial.report + ir.actions.act_window + form + + new + + + + + Balance Sheet + financial.report + ir.actions.act_window + form + + new + + + + diff --git a/base_accounting_kit/wizard/general_ledger.py b/base_accounting_kit/wizard/general_ledger.py index a03ba364c..c1c5aa053 100644 --- a/base_accounting_kit/wizard/general_ledger.py +++ b/base_accounting_kit/wizard/general_ledger.py @@ -19,7 +19,6 @@ # If not, see . # ############################################################################# - from odoo import fields, models, _ from odoo.exceptions import UserError @@ -39,7 +38,8 @@ class AccountReportGeneralLedger(models.TransientModel): relation="account_report_general_section_rel", column1="main_report_id", column2="sub_report_id") - name = fields.Char(string="General Ledger", default="General Ledger", required=True, translate=True) + name = fields.Char(string="General Ledger", default="General Ledger", + required=True, translate=True) initial_balance = fields.Boolean(string='Include Initial Balances', help='If you selected date, this field ' 'allow you to add a row to display ' @@ -47,7 +47,8 @@ class AccountReportGeneralLedger(models.TransientModel): 'that precedes the filter you\'ve ' 'set.') sortby = fields.Selection( - [('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], + [('sort_date', 'Date'), ('sort_journal_partner', + 'Journal & Partner')], string='Sort by', required=True, default='sort_date') journal_ids = fields.Many2many('account.journal', 'account_report_general_ledger_journal_rel', diff --git a/base_accounting_kit/wizard/general_ledger.xml b/base_accounting_kit/wizard/general_ledger.xml index 066fa0d47..44632ab15 100644 --- a/base_accounting_kit/wizard/general_ledger.xml +++ b/base_accounting_kit/wizard/general_ledger.xml @@ -1,6 +1,5 @@ - - +Z General Ledger account.report.general.ledger @@ -16,7 +15,6 @@ - General Ledger ir.actions.act_window @@ -27,7 +25,6 @@ report - - diff --git a/base_accounting_kit/wizard/journal_audit.py b/base_accounting_kit/wizard/journal_audit.py index 9913085ec..364307246 100644 --- a/base_accounting_kit/wizard/journal_audit.py +++ b/base_accounting_kit/wizard/journal_audit.py @@ -19,7 +19,6 @@ # If not, see . # ############################################################################# - from odoo import fields, models @@ -38,7 +37,8 @@ class AccountPrintJournal(models.TransientModel): relation="account_common_print_report_section_rel", column1="main_report_id", column2="sub_report_id") - name = fields.Char(string="Journal Audit", default="Journal Audit", required=True, translate=True) + name = fields.Char(string="Journal Audit", default="Journal Audit", + required=True, translate=True) sort_selection = fields.Selection( [('date', 'Date'), ('move_name', 'Journal Entry Number')], 'Entries Sorted by', required=True, default='move_name') diff --git a/base_accounting_kit/wizard/journal_audit.xml b/base_accounting_kit/wizard/journal_audit.xml index 55b288481..22cd097bb 100644 --- a/base_accounting_kit/wizard/journal_audit.xml +++ b/base_accounting_kit/wizard/journal_audit.xml @@ -1,22 +1,23 @@ - Journals Audit account.print.journal - + - - - - - - - + + + + + + + - - + Journals Audit ir.actions.act_window account.print.journal @@ -24,12 +25,10 @@ new - - diff --git a/base_accounting_kit/wizard/partner_ledger.py b/base_accounting_kit/wizard/partner_ledger.py index fc0a20165..58511eef8 100644 --- a/base_accounting_kit/wizard/partner_ledger.py +++ b/base_accounting_kit/wizard/partner_ledger.py @@ -19,7 +19,6 @@ # If not, see . # ############################################################################# - from odoo import fields, models @@ -38,11 +37,15 @@ class AccountPartnerLedger(models.TransientModel): relation="account_report_partner_section_rel", column1="main_report_id", column2="sub_report_id") - name = fields.Char(string="Partner Ledger Report", default="Partner Ledger Report", required=True, translate=True) + name = fields.Char(string="Partner Ledger Report", + default="Partner Ledger Report", required=True, + translate=True) amount_currency = fields.Boolean("With Currency", - help="It adds the currency column on report if the " - "currency differs from the company currency.") - reconciled = fields.Boolean('Reconciled Entries') + help="It adds the currency column on" + " report if the " + "currency differs from the " + "company currency.") + reconciled = fields.Boolean(string='Reconciled Entries') def _print_report(self, data): data = self.pre_print_report(data) diff --git a/base_accounting_kit/wizard/partner_ledger.xml b/base_accounting_kit/wizard/partner_ledger.xml index 57dc02fb0..506ff04f6 100644 --- a/base_accounting_kit/wizard/partner_ledger.xml +++ b/base_accounting_kit/wizard/partner_ledger.xml @@ -3,12 +3,14 @@ Partner Ledger account.report.partner.ledger - + - + @@ -16,7 +18,6 @@ - Partner Ledger account.report.partner.ledger @@ -25,7 +26,6 @@ new - . # ############################################################################# -from odoo import models,fields +from odoo import fields, models from odoo.tools.misc import get_lang @@ -38,7 +38,10 @@ class AccountTaxReport(models.TransientModel): relation="account_tax_report_section_rel", column1="main_report_id", column2="sub_report_id") - company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company) + company_id = fields.Many2one('res.company', string='Company', + required=True, + readonly=True, + default=lambda self: self.env.company) name = fields.Char(string="Tax Report", default="Tax Report", required=True, translate=True) date_from = fields.Date(string='Start Date') @@ -47,17 +50,21 @@ class AccountTaxReport(models.TransientModel): comodel_name='account.journal', string='Journals', required=True, - default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]), + default=lambda self: self.env['account.journal'].search( + [('company_id', '=', self.company_id.id)]), domain="[('company_id', '=', company_id)]", ) target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries'), - ], string='Target Moves', required=True, default='posted') + ], string='Target Moves', required=True, + default='posted') def _build_contexts(self, data): result = {} - result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False - result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' + result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][ + 'journal_ids'] or False + result['state'] = 'target_move' in data['form'] and data['form'][ + 'target_move'] or '' result['date_from'] = data['form']['date_from'] or False result['date_to'] = data['form']['date_to'] or False result['strict_range'] = True if result['date_from'] else False @@ -69,9 +76,12 @@ class AccountTaxReport(models.TransientModel): data = {} data['ids'] = self.env.context.get('active_ids', []) data['model'] = self.env.context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0] + data['form'] = self.read( + ['date_from', 'date_to', 'journal_ids', 'target_move', + 'company_id'])[0] used_context = self._build_contexts(data) - data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code) + data['form']['used_context'] = dict(used_context, + lang=get_lang(self.env).code) return self.with_context(discard_logo_check=True)._print_report(data) def pre_print_report(self, data): diff --git a/base_accounting_kit/wizard/tax_report.xml b/base_accounting_kit/wizard/tax_report.xml index cb7cc7efc..37fa00461 100644 --- a/base_accounting_kit/wizard/tax_report.xml +++ b/base_accounting_kit/wizard/tax_report.xml @@ -1,10 +1,10 @@ - Tax Reports kit.account.tax.report - + @@ -17,7 +17,6 @@ - Tax Reports kit.account.tax.report @@ -27,12 +26,10 @@ {} new - - diff --git a/base_accounting_kit/wizard/trial_balance.py b/base_accounting_kit/wizard/trial_balance.py index 3626ac08f..0b1869764 100644 --- a/base_accounting_kit/wizard/trial_balance.py +++ b/base_accounting_kit/wizard/trial_balance.py @@ -19,8 +19,7 @@ # If not, see . # ############################################################################# - -from odoo import fields, models, api ,_ +from odoo import api, fields, models, _ class AccountBalanceReport(models.TransientModel): @@ -38,7 +37,8 @@ class AccountBalanceReport(models.TransientModel): relation="account_balance_report_section_rel", column1="sub_report_id", column2="main_report_id") - name = fields.Char(string="Trial Balance", default="Trial Balance", required=True, translate=True) + name = fields.Char(string="Trial Balance", default="Trial Balance", + required=True, translate=True) journal_ids = fields.Many2many('account.journal', 'account_balance_report_journal_rel', 'account_id', 'journal_id', @@ -48,7 +48,8 @@ class AccountBalanceReport(models.TransientModel): @api.model def _get_report_name(self): period_id = self._get_selected_period_id() - return self.env['consolidation.period'].browse(period_id)['display_name'] or _("Trial Balance") + return self.env['consolidation.period'].browse(period_id)[ + 'display_name'] or _("Trial Balance") def _print_report(self, data): data = self.pre_print_report(data) diff --git a/base_accounting_kit/wizard/trial_balance.xml b/base_accounting_kit/wizard/trial_balance.xml index aafad3647..20178ba65 100644 --- a/base_accounting_kit/wizard/trial_balance.xml +++ b/base_accounting_kit/wizard/trial_balance.xml @@ -1,10 +1,10 @@ - Trial Balance account.balance.report - + @@ -15,7 +15,6 @@ - Trial Balance account.balance.report @@ -25,11 +24,9 @@ new - -
Code Account Debit
- + - + - + - + - +