diff --git a/addons/account_cash_flow/report/report_account_cash_flow.py b/addons/account_cash_flow/report/report_account_cash_flow.py index 79677353..b790ff93 100644 --- a/addons/account_cash_flow/report/report_account_cash_flow.py +++ b/addons/account_cash_flow/report/report_account_cash_flow.py @@ -30,7 +30,8 @@ class ReportAccountCashFlow(models.AbstractModel): return date_dict return year_list - def get_move_lines(self, date_from, date_to, key, dummy_list): + def get_move_lines(self, date_from, date_to, key, dummy_list, + company_id, branch_id): self._cr.execute("select CASE WHEN acc_type.activity_type is null THEN acc.name ELSE acc_type.activity_type END AS activity_type, " "aml.account_id, " "(sum(aml.debit) - sum(aml.credit)) * -1 as " @@ -41,7 +42,9 @@ class ReportAccountCashFlow(models.AbstractModel): "where acc.id = aml.account_id and " "aml.date >= '%s'" % date_from + "and " "aml.date <= '%s'" % date_to + "and " - "acc.user_type_id = acc_type.id " + "acc.user_type_id = acc_type.id and " + "aml.company_id = %s " % company_id + "and " + "aml.branch_id = %s " % branch_id + "group by aml.account_id, " "acc_type.activity_type, acc.name") balance_data = self._cr.dictfetchall() @@ -58,7 +61,10 @@ class ReportAccountCashFlow(models.AbstractModel): dummy_list = list(date_dict.keys()) dummy_list.remove(key) balance_data += self.get_move_lines(date_dict[key][0], - date_dict[key][1], key, dummy_list) + date_dict[key][1], key, + dummy_list, data['form'][ + 'company_id'][0], + data['form']['branch_id'][0]) for data in balance_data: if data['activity_type'] not in final_dict: final_dict[data['activity_type']] = {'account': {}} @@ -98,6 +104,7 @@ class ReportAccountCashFlow(models.AbstractModel): docargs = { 'doc_model': 'account.move.line', 'docs': docs, + 'branch_name': data['form']['branch_id'][1], 'get_data': self.get_data(data), 'get_years': self.get_years(data, is_getdata=False), 'get_acc_details': self.get_acc_details, diff --git a/addons/account_cash_flow/report/report_account_cash_flow.xml b/addons/account_cash_flow/report/report_account_cash_flow.xml index 2faa6c82..162c412a 100644 --- a/addons/account_cash_flow/report/report_account_cash_flow.xml +++ b/addons/account_cash_flow/report/report_account_cash_flow.xml @@ -6,6 +6,7 @@
Branch:
upto
diff --git a/addons/account_cash_flow/wizard/account_cash_flow.py b/addons/account_cash_flow/wizard/account_cash_flow.py
index 943e6dd4..a94f87f4 100644
--- a/addons/account_cash_flow/wizard/account_cash_flow.py
+++ b/addons/account_cash_flow/wizard/account_cash_flow.py
@@ -5,6 +5,7 @@ from flectra import models, fields
class AccountCashFlow(models.TransientModel):
"""Credit Notes"""
+ # TODO: Add date filters
_inherit = "account.common.report"
_name = "account.cash.flow"
@@ -13,7 +14,8 @@ class AccountCashFlow(models.TransientModel):
no_of_year = fields.Integer(string='Previous Period', default=0)
def _print_report(self, data):
- data['form'].update(self.read(['no_of_year', 'company_id'])[0])
+ data['form'].update(self.read(['no_of_year', 'company_id',
+ 'branch_id'])[0])
landscape = False
if self.no_of_year > 2:
landscape = True
diff --git a/addons/account_cash_flow/wizard/account_cash_flow.xml b/addons/account_cash_flow/wizard/account_cash_flow.xml
index d2404e4a..db1b05db 100644
--- a/addons/account_cash_flow/wizard/account_cash_flow.xml
+++ b/addons/account_cash_flow/wizard/account_cash_flow.xml
@@ -5,30 +5,30 @@