Browse Source

Jun 19: [FIX] Bug Fixed 'dynamic_accounts_report'

pull/331/head
RisvanaCybro 1 year ago
parent
commit
1232656ad0
  1. 6
      dynamic_accounts_report/controllers/controllers.py
  2. 4
      dynamic_accounts_report/models/account_general_ledger.py
  3. 4
      dynamic_accounts_report/models/account_partner_ledger.py
  4. 4
      dynamic_accounts_report/models/account_trial_balance.py
  5. 4
      dynamic_accounts_report/models/aged_payable_report.py
  6. 4
      dynamic_accounts_report/models/aged_receivable_report.py
  7. 4
      dynamic_accounts_report/models/bank_book_report.py
  8. 4
      dynamic_accounts_report/models/cash_book_report.py
  9. 4
      dynamic_accounts_report/models/dynamic_balance_sheet_report.py
  10. 2
      dynamic_accounts_report/models/tax_report.py
  11. 1
      dynamic_accounts_report/static/src/js/aged_payable_report.js
  12. 1
      dynamic_accounts_report/static/src/js/aged_receivable_report.js
  13. 1
      dynamic_accounts_report/static/src/js/balance_sheet.js
  14. 1
      dynamic_accounts_report/static/src/js/bank_flow.js
  15. 1
      dynamic_accounts_report/static/src/js/cash_flow.js
  16. 1
      dynamic_accounts_report/static/src/js/general_ledger.js
  17. 2
      dynamic_accounts_report/static/src/js/partner_ledger.js
  18. 1
      dynamic_accounts_report/static/src/js/profit_and_loss.js
  19. 1
      dynamic_accounts_report/static/src/js/tax_report.js
  20. 1
      dynamic_accounts_report/static/src/js/trial_balance.js

6
dynamic_accounts_report/controllers/controllers.py

@ -28,7 +28,8 @@ from odoo.tools import html_escape
class XLSXReportController(http.Controller):
@http.route('/xlsx_report', type='http', auth='user', methods=['POST'],
csrf=False)
def get_report_xlsx(self, model, data, output_format, report_name):
def get_report_xlsx(self, model, data, output_format, report_name,
report_action):
"""Generate an XLSX report based on the provided data and return it as
a response.
Args:
@ -56,7 +57,8 @@ class XLSXReportController(http.Controller):
content_disposition(report_name + '.xlsx'))
]
)
report_obj.get_xlsx_report(data, response, report_name)
report_obj.get_xlsx_report(data, response, report_name,
report_action)
response.set_cookie('fileToken', token)
return response
except Exception as e:

4
dynamic_accounts_report/models/account_general_ledger.py

@ -198,7 +198,7 @@ class AccountGeneralLedger(models.TransientModel):
return account_dict
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an XLSX report based on the provided data and write it to the
response stream.
@ -267,7 +267,7 @@ class AccountGeneralLedger(models.TransientModel):
option_keys_str = ', '.join(option_keys)
sheet.merge_range('C6:G6', option_keys_str, filter_body)
if data:
if report_name == 'General Ledger':
if report_action == 'dynamic_accounts_report.action_general_ledger':
sheet.write(8, col, ' ', sub_heading)
sheet.write(8, col + 1, 'Date', sub_heading)
sheet.merge_range('C9:E9', 'Communication', sub_heading)

4
dynamic_accounts_report/models/account_partner_ledger.py

@ -237,7 +237,7 @@ class AccountPartnerLedger(models.TransientModel):
return partner_dict
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an Excel report based on the provided data.
@ -306,7 +306,7 @@ class AccountPartnerLedger(models.TransientModel):
option_keys_str = ', '.join(option_keys)
sheet.merge_range('C6:G6', option_keys_str, filter_body)
if data:
if report_name == 'Partner Ledger':
if report_action == 'dynamic_accounts_report.action_partner_ledger':
sheet.write(8, col, ' ', sub_heading)
sheet.write(8, col + 1, 'JNRL', sub_heading)
sheet.write(8, col + 2, 'Account', sub_heading)

4
dynamic_accounts_report/models/account_trial_balance.py

@ -325,7 +325,7 @@ class AccountTrialBalance(models.TransientModel):
return month_names[date.month]
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an XLSX report based on provided data and response stream.
Generates an Excel workbook with specified report format, including
@ -416,7 +416,7 @@ class AccountTrialBalance(models.TransientModel):
sheet.write(10, col + i, 'Debit', sub_heading)
sheet.write(10, col + (i + 1), 'Credit', sub_heading)
if data:
if report_name == 'Trial Balance':
if report_action == 'dynamic_accounts_report.action_trial_balance':
row = 11
for move_line in data['data']:
sheet.write(row, col, move_line['account'],

4
dynamic_accounts_report/models/aged_payable_report.py

@ -153,7 +153,7 @@ class AgePayableReport(models.TransientModel):
return move_line_list
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an Excel report based on the provided data.
:param data: The data used to generate the report.
@ -205,7 +205,7 @@ class AgePayableReport(models.TransientModel):
display_names_str = ', '.join(display_names)
sheet.merge_range('C4:G4', display_names_str, filter_body)
if data:
if report_name == 'Aged Payable':
if report_action == 'dynamic_accounts_report.action_aged_payable':
sheet.write(6, col, ' ', sub_heading)
sheet.write(6, col + 1, 'Invoice Date', sub_heading)
sheet.write(6, col + 2, 'Amount Currency', sub_heading)

4
dynamic_accounts_report/models/aged_receivable_report.py

@ -163,7 +163,7 @@ class AgeReceivableReport(models.TransientModel):
return move_line_list
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an Excel report based on the provided data.
@ -219,7 +219,7 @@ class AgeReceivableReport(models.TransientModel):
display_names_str = ', '.join(display_names)
sheet.merge_range('C4:G4', display_names_str, filter_body)
if data:
if report_name == 'Aged Receivable':
if report_action == 'dynamic_accounts_report.action_aged_receivable':
sheet.write(6, col, ' ', sub_heading)
sheet.write(6, col + 1, 'Invoice Date', sub_heading)
sheet.write(6, col + 2, 'Amount Currency', sub_heading)

4
dynamic_accounts_report/models/bank_book_report.py

@ -179,7 +179,7 @@ class BankBookReport(models.TransientModel):
return data
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an Excel report based on the provided data.
:param data: The data used to generate the report.
@ -243,7 +243,7 @@ class BankBookReport(models.TransientModel):
option_keys_str = ', '.join(option_keys)
sheet.merge_range('C6:G6', option_keys_str, filter_body)
if data:
if report_name == 'Bank Book':
if report_action == 'dynamic_accounts_report.action_bank_book':
sheet.write(8, col, ' ', sub_heading)
sheet.merge_range('B9:C9', 'Journal', sub_heading)
sheet.merge_range('D9:E9', 'Partner', sub_heading)

4
dynamic_accounts_report/models/cash_book_report.py

@ -203,7 +203,7 @@ class CashBookReport(models.TransientModel):
return data
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an Excel report based on the provided data.
:param data: The data used to generate the report.
@ -267,7 +267,7 @@ class CashBookReport(models.TransientModel):
option_keys_str = ', '.join(option_keys)
sheet.merge_range('C6:G6', option_keys_str, filter_body)
if data:
if report_name == 'Cash Book':
if report_action == 'dynamic_accounts_report.action_cash_book':
sheet.write(8, col, ' ', sub_heading)
sheet.merge_range('B9:C9', 'Journal', sub_heading)
sheet.merge_range('D9:E9', 'Partner', sub_heading)

4
dynamic_accounts_report/models/dynamic_balance_sheet_report.py

@ -448,7 +448,7 @@ class ProfitLossReport(models.TransientModel):
return last_year_date_list
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""Generate and return an XLSX report based on the provided data.
:param data: The report data in JSON format.
:param report_name: Name of the report.
@ -484,7 +484,7 @@ class ProfitLossReport(models.TransientModel):
col += 1
col = 0
if data:
if report_name == 'Profit and Loss':
if report_action == 'dynamic_accounts_report.action_dynamic_profit_and_loss':
sheet.write(6, col, 'Net Profit', sub_heading)
for datas in data['datas']:
sheet.write(6, col + 1, datas['total'], side_heading_sub)

2
dynamic_accounts_report/models/tax_report.py

@ -609,7 +609,7 @@ class TaxReport(models.TransientModel):
return month_names[date.month]
@api.model
def get_xlsx_report(self, data, response, report_name):
def get_xlsx_report(self, data, response, report_name, report_action):
"""
Generate an XLSX report based on provided data and response stream.

1
dynamic_accounts_report/static/src/js/aged_payable_report.js

@ -224,6 +224,7 @@ class AgedPayable extends owl.Component {
'model': 'age.payable.report',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

1
dynamic_accounts_report/static/src/js/aged_receivable_report.js

@ -223,6 +223,7 @@ class AgedReceivable extends owl.Component {
'model': 'age.receivable.report',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

1
dynamic_accounts_report/static/src/js/balance_sheet.js

@ -99,6 +99,7 @@ class BalanceSheet extends owl.Component {
'data': JSON.stringify(self.state),
'output_format': 'xlsx',
'report_name': self.props.action.display_name,
'report_action': self.props.action.xml_id,
},
};
BlockUI;

1
dynamic_accounts_report/static/src/js/bank_flow.js

@ -212,6 +212,7 @@ class BankBook extends owl.Component {
'model': 'bank.book.report',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

1
dynamic_accounts_report/static/src/js/cash_flow.js

@ -205,6 +205,7 @@ class CashBook extends owl.Component {
'model': 'cash.book.report',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

1
dynamic_accounts_report/static/src/js/general_ledger.js

@ -129,6 +129,7 @@ class GeneralLedger extends owl.Component {
'model': 'account.general.ledger',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

2
dynamic_accounts_report/static/src/js/partner_ledger.js

@ -171,6 +171,7 @@ class PartnerLedger extends owl.Component {
* Generates and downloads an XLSX report for the partner ledger.
*/
var self = this;
let partner_list = []
let partner_value = []
let partner_totals = ''
@ -193,6 +194,7 @@ class PartnerLedger extends owl.Component {
'model': 'account.partner.ledger',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

1
dynamic_accounts_report/static/src/js/profit_and_loss.js

@ -87,6 +87,7 @@ class ProfitAndLoss extends owl.Component {
'model': 'dynamic.balance.sheet.report',
'data': JSON.stringify(self.state),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': self.props.action.display_name,
},
};

1
dynamic_accounts_report/static/src/js/tax_report.js

@ -335,6 +335,7 @@ class TaxReport extends owl.Component {
'model': 'tax.report',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.id,
'report_name': action_title,
},
};

1
dynamic_accounts_report/static/src/js/trial_balance.js

@ -467,6 +467,7 @@ class TrialBalance extends owl.Component {
'model': 'account.trial.balance',
'data': JSON.stringify(datas),
'output_format': 'xlsx',
'report_action': self.props.action.xml_id,
'report_name': action_title,
},
};

Loading…
Cancel
Save