diff --git a/base_accounting_kit/__manifest__.py b/base_accounting_kit/__manifest__.py index 855d6a21b..d96f89944 100644 --- a/base_accounting_kit/__manifest__.py +++ b/base_accounting_kit/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Odoo 14 Full Accounting Kit', - 'version': '14.0.2.5.4', + 'version': '14.0.2.5.5', 'category': 'Accounting', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'summary': """ Asset and Budget Management, diff --git a/base_accounting_kit/doc/changelog.md b/base_accounting_kit/doc/changelog.md index cf3e3915e..f0ff83acf 100644 --- a/base_accounting_kit/doc/changelog.md +++ b/base_accounting_kit/doc/changelog.md @@ -35,4 +35,11 @@ #### UPDT - Translation Added +#### 25.02.2021 +#### Version 14.0.2.5.5 +#### UPDT +- Bank Book, Cash Book Issue updated +- Tax report Issue updated +- Asset Issue updated + diff --git a/base_accounting_kit/models/account_asset.py b/base_accounting_kit/models/account_asset.py index 387b89f09..1afdbfd1f 100644 --- a/base_accounting_kit/models/account_asset.py +++ b/base_accounting_kit/models/account_asset.py @@ -312,7 +312,6 @@ class AccountAssetAsset(models.Model): def compute_depreciation_board(self): self.ensure_one() - posted_depreciation_line_ids = self.depreciation_line_ids.filtered( lambda x: x.move_check).sorted(key=lambda l: l.depreciation_date) unposted_depreciation_line_ids = self.depreciation_line_ids.filtered( @@ -359,8 +358,8 @@ class AccountAssetAsset(models.Model): # 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( - posted_depreciation_line_ids[-1].depreciation_date, + last_depreciation_date = datetime.strptime(str( + posted_depreciation_line_ids[-1].depreciation_date), DF).date() depreciation_date = last_depreciation_date + relativedelta( months=+self.method_period) diff --git a/base_accounting_kit/report/account_bank_book.py b/base_accounting_kit/report/account_bank_book.py index 8d67dbccd..7c050c742 100644 --- a/base_accounting_kit/report/account_bank_book.py +++ b/base_accounting_kit/report/account_bank_book.py @@ -153,6 +153,13 @@ class ReportBankBook(models.AbstractModel): account_ids = data['form']['account_ids'] accounts = self.env['account.account'].search( [('id', 'in', account_ids)]) + if not accounts: + journals = self.env['account.journal'].search([('type', '=', 'bank')]) + accounts = [] + for journal in journals: + accounts.append(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, diff --git a/base_accounting_kit/report/account_cash_book.py b/base_accounting_kit/report/account_cash_book.py index c4394289e..2c89c5290 100644 --- a/base_accounting_kit/report/account_cash_book.py +++ b/base_accounting_kit/report/account_cash_book.py @@ -75,6 +75,12 @@ class ReportCashBook(models.AbstractModel): filters = " AND ".join(wheres) 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')]) + accounts = [] + for journal in journals: + accounts.append(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,\ @@ -138,6 +144,12 @@ class ReportCashBook(models.AbstractModel): account_ids = data['form']['account_ids'] accounts = self.env['account.account'].search( [('id', 'in', account_ids)]) + if not accounts: + journals = self.env['account.journal'].search([('type', '=', 'cash')]) + accounts = [] + for journal in journals: + accounts.append(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/report_tax.py b/base_accounting_kit/report/report_tax.py index 9dc7a6623..61445ef6a 100644 --- a/base_accounting_kit/report/report_tax.py +++ b/base_accounting_kit/report/report_tax.py @@ -57,7 +57,8 @@ class ReportTax(models.AbstractModel): def _compute_from_amls(self, options, taxes): # compute the tax amount sql = self._sql_from_amls_one() - tables, where_clause, where_params = self.env['account.move.line']._query_get() + 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() @@ -88,11 +89,11 @@ class ReportTax(models.AbstractModel): else: taxes[tax.id] = {'tax': 0, 'net': 0, 'name': tax.name, 'type': tax.type_tax_use} - if options['date_from']: + if options['date_from'] and not options['date_to']: self.with_context(date_from=options['date_from'], strict_range=True)._compute_from_amls(options, taxes) - elif options['date_to']: + elif options['date_to'] and not options['date_from']: self.with_context(date_to=options['date_to'], strict_range=True)._compute_from_amls(options, taxes) diff --git a/base_accounting_kit/wizard/asset_modify.py b/base_accounting_kit/wizard/asset_modify.py index 94661da6f..7fddb9943 100644 --- a/base_accounting_kit/wizard/asset_modify.py +++ b/base_accounting_kit/wizard/asset_modify.py @@ -33,7 +33,7 @@ def setup_modifiers(node, field=None, context=None, in_tree_view=False): if field is not None: transfer_field_to_modifiers(field, modifiers) transfer_node_to_modifiers( - node, modifiers, context=context, in_tree_view=in_tree_view) + node, modifiers, context=context) transfer_modifiers_to_node(modifiers, node)