From ad5dafabd3db8cbcb29cd5e54cea4a5bfcdf1183 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Mon, 22 May 2023 16:25:36 +0530 Subject: [PATCH] May 22 : [UPDT] Bug Fixed 'base_accounting_ki' --- base_accounting_kit/__manifest__.py | 2 +- base_accounting_kit/models/account_asset.py | 22 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/base_accounting_kit/__manifest__.py b/base_accounting_kit/__manifest__.py index 01fbd697b..4d4f3baa3 100644 --- a/base_accounting_kit/__manifest__.py +++ b/base_accounting_kit/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Odoo 16 Full Accounting Kit', - 'version': '16.0.2.0.1', + 'version': '16.0.2.0.2', 'category': 'Accounting', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'summary': """ Asset and Budget Management, diff --git a/base_accounting_kit/models/account_asset.py b/base_accounting_kit/models/account_asset.py index c0d8f890f..938b960e0 100644 --- a/base_accounting_kit/models/account_asset.py +++ b/base_accounting_kit/models/account_asset.py @@ -706,17 +706,27 @@ class AccountAssetDepreciationLine(models.Model): '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, } - move_vals = { + 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, + }), (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, + })] + move = self.env['account.move'].create({ 'ref': line.asset_id.code, 'date': depreciation_date or False, 'journal_id': category_id.journal_id.id, - 'line_ids': [(0, 0, move_line_1), (0, 0, move_line_2)], - } - move = self.env['account.move'].create(move_vals) + 'line_ids': line_ids, + }) for move_line in move.line_ids: if move_line.account_id.id == move_line_1['account_id']: - move_line.debit = move_line_1['debit'] - move_line.credit = move_line_1['credit'] + move_line.write({'credit': move_line_1['credit'], + 'debit': move_line_1['debit']}) elif move_line.account_id.id == move_line_2['account_id']: move_line.write({'debit': move_line_2['debit'], 'credit': move_line_2['credit']}) if move.line_ids.filtered(lambda x:x.name == 'Automatic Balancing Line'):