Browse Source

[UPDT] Updated cash,bank,tax,asset issues

pull/164/head
Ajmal Cybro 4 years ago
parent
commit
ce86aba18b
  1. 2
      base_accounting_kit/__manifest__.py
  2. 7
      base_accounting_kit/doc/changelog.md
  3. 5
      base_accounting_kit/models/account_asset.py
  4. 7
      base_accounting_kit/report/account_bank_book.py
  5. 12
      base_accounting_kit/report/account_cash_book.py
  6. 7
      base_accounting_kit/report/report_tax.py
  7. 2
      base_accounting_kit/wizard/asset_modify.py

2
base_accounting_kit/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': 'Odoo 14 Full Accounting Kit', 'name': 'Odoo 14 Full Accounting Kit',
'version': '14.0.2.5.4', 'version': '14.0.2.5.5',
'category': 'Accounting', 'category': 'Accounting',
'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs',
'summary': """ Asset and Budget Management, 'summary': """ Asset and Budget Management,

7
base_accounting_kit/doc/changelog.md

@ -35,4 +35,11 @@
#### UPDT #### UPDT
- Translation Added - 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

5
base_accounting_kit/models/account_asset.py

@ -312,7 +312,6 @@ class AccountAssetAsset(models.Model):
def compute_depreciation_board(self): def compute_depreciation_board(self):
self.ensure_one() self.ensure_one()
posted_depreciation_line_ids = self.depreciation_line_ids.filtered( posted_depreciation_line_ids = self.depreciation_line_ids.filtered(
lambda x: x.move_check).sorted(key=lambda l: l.depreciation_date) lambda x: x.move_check).sorted(key=lambda l: l.depreciation_date)
unposted_depreciation_line_ids = self.depreciation_line_ids.filtered( 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 we already have some previous validated entries, starting date isn't 1st January but last entry + method period
if posted_depreciation_line_ids and \ if posted_depreciation_line_ids and \
posted_depreciation_line_ids[-1].depreciation_date: posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime( last_depreciation_date = datetime.strptime(str(
posted_depreciation_line_ids[-1].depreciation_date, posted_depreciation_line_ids[-1].depreciation_date),
DF).date() DF).date()
depreciation_date = last_depreciation_date + relativedelta( depreciation_date = last_depreciation_date + relativedelta(
months=+self.method_period) months=+self.method_period)

7
base_accounting_kit/report/account_bank_book.py

@ -153,6 +153,13 @@ class ReportBankBook(models.AbstractModel):
account_ids = data['form']['account_ids'] account_ids = data['form']['account_ids']
accounts = self.env['account.account'].search( accounts = self.env['account.account'].search(
[('id', 'in', account_ids)]) [('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_res = self.with_context(data['form'].get('used_context', {}))._get_account_move_entry(
accounts, accounts,
init_balance, init_balance,

12
base_accounting_kit/report/account_cash_book.py

@ -75,6 +75,12 @@ class ReportCashBook(models.AbstractModel):
filters = " AND ".join(wheres) 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') '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 # 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,\ 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'] account_ids = data['form']['account_ids']
accounts = self.env['account.account'].search( accounts = self.env['account.account'].search(
[('id', 'in', account_ids)]) [('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( accounts_res = self.with_context(
data['form'].get('used_context', {}))._get_account_move_entry( data['form'].get('used_context', {}))._get_account_move_entry(
accounts, accounts,

7
base_accounting_kit/report/report_tax.py

@ -57,7 +57,8 @@ class ReportTax(models.AbstractModel):
def _compute_from_amls(self, options, taxes): def _compute_from_amls(self, options, taxes):
# compute the tax amount # compute the tax amount
sql = self._sql_from_amls_one() 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) query = sql % (tables, where_clause)
self.env.cr.execute(query, where_params) self.env.cr.execute(query, where_params)
results = self.env.cr.fetchall() results = self.env.cr.fetchall()
@ -88,11 +89,11 @@ class ReportTax(models.AbstractModel):
else: else:
taxes[tax.id] = {'tax': 0, 'net': 0, 'name': tax.name, taxes[tax.id] = {'tax': 0, 'net': 0, 'name': tax.name,
'type': tax.type_tax_use} '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'], self.with_context(date_from=options['date_from'],
strict_range=True)._compute_from_amls(options, strict_range=True)._compute_from_amls(options,
taxes) taxes)
elif options['date_to']: elif options['date_to'] and not options['date_from']:
self.with_context(date_to=options['date_to'], self.with_context(date_to=options['date_to'],
strict_range=True)._compute_from_amls(options, strict_range=True)._compute_from_amls(options,
taxes) taxes)

2
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: if field is not None:
transfer_field_to_modifiers(field, modifiers) transfer_field_to_modifiers(field, modifiers)
transfer_node_to_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) transfer_modifiers_to_node(modifiers, node)

Loading…
Cancel
Save