diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..63d810d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,29 @@
+# See https://help.github.com/ignore-files/ for more about ignoring files.
+
+# dependencies
+/build
+/dist
+*egg-info
+
+
+/node_modules
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+
+.DS_Store
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+package-lock*
+
+/__pycache__
+/app/__pycache__
+/app/commons/__pycache__
diff --git a/__init__.py b/__init__.py
index 4985339..a0f083f 100644
--- a/__init__.py
+++ b/__init__.py
@@ -18,8 +18,10 @@ def register():
sale.ShopDailySummaryStart,
account.PrintBalanceSheetCOLGAAPStart,
account.PrintIncomeStatementCOLGAAPStart,
+ account.PrintTrialBalanceStart,
module='syncronize_companies', type_='model')
Pool.register(
+ account.TrialBalanceClassic,
sale.SaleDailyReport,
sale.SaleDetailedReport,
sale.PortfolioDetailedReport,
@@ -30,6 +32,7 @@ def register():
account.IncomeStatementCOLGAAP,
module='syncronize_companies', type_='report')
Pool.register(
+ account.PrintTrialBalance,
account.PrintBalanceSheetCOLGAAP,
account.PrintIncomeStatementCOLGAAP,
module='syncronize_companies', type_='wizard')
diff --git a/account.py b/account.py
index 6ed633e..690ffba 100644
--- a/account.py
+++ b/account.py
@@ -10,15 +10,65 @@ from trytond.transaction import Transaction
__all__ = [
'PrintBalanceSheetCOLGAAPStart', 'PrintBalanceSheetCOLGAAP',
'BalanceSheetCOLGAAP', 'PrintIncomeStatementCOLGAAPStart',
- 'PrintIncomeStatementCOLGAAP', 'IncomeStatementCOLGAAP'
+ 'PrintIncomeStatementCOLGAAP', 'IncomeStatementCOLGAAP',
+ 'PrintTrialBalanceStart', 'PrintTrialBalance', 'TrialBalanceClassic'
]
_ZERO = Decimal('0.00')
+class PrintTrialBalanceStart(metaclass=PoolMeta):
+ __name__ = 'account.print_trial_balance.start'
+ sincronize = fields.Boolean('Syncronize')
+
+
+class PrintTrialBalance(metaclass=PoolMeta):
+ __name__ = 'account.print_trial_balance'
+
+ def do_print_(self, action):
+ action, data = super(PrintTrialBalance, self).do_print_(action)
+ data['sincronize'] = self.start.sincronize
+ return action, data
+
+
+class TrialBalanceClassic(metaclass=PoolMeta):
+ __name__ = 'account.trial_balance_classic'
+
+ @classmethod
+ def get_context(cls, records, data):
+ report_context = super(TrialBalanceClassic, cls).get_context(records, data)
+ Company = Pool().get('company.company')
+ company = Company(Transaction().context.get('company'))
+ result = {}
+ sync = data['sincronize']
+ if sync:
+ data['sincronize'] = [False]
+ args = {
+ 'records': [],
+ 'data': data,
+ }
+ for sync in company.connection_companies:
+ api_ = 'http://' + sync.api_connection + '/' + sync.database
+ route = api_ + '/' + 'report_context'
+ data_ = json.dumps({
+ 'database': sync.database,
+ 'report_name': 'account_col.trial_balance_classic',
+ 'args': args,
+ })
+ res = requests.get(route, data=data_)
+ result = res.json()
+ # obj_ = dict(sorted(result['records'].items()))
+ print('-' * 190)
+ print(result['accounts'])
+ report_context['accounts'].extend(result['accounts'])
+
+ # report_context['records'].extend(obj_.values())
+ # report_context['global_result'] += Decimal(result['global_result'])
+ return report_context
+
+
class PrintIncomeStatementCOLGAAPStart(metaclass=PoolMeta):
__name__ = 'account_col.print_income_statement_colgaap.start'
-
sincronize = fields.Boolean('Syncronize')
@@ -69,7 +119,6 @@ class IncomeStatementCOLGAAP(metaclass=PoolMeta):
class PrintBalanceSheetCOLGAAPStart(metaclass=PoolMeta):
__name__ = 'account_col.print_balance_sheet_colgaap.start'
-
sincronize = fields.Boolean('Syncronize')
diff --git a/account.xml b/account.xml
index db3e33f..849b5d2 100644
--- a/account.xml
+++ b/account.xml
@@ -14,6 +14,12 @@
print_income_statement_colgaap_start_form
+
+ account.print_trial_balance.start
+
+ print_trial_balance_start_form
+
+
@@ -61,5 +67,6 @@
pyson="1"/>
+
diff --git a/tryton.cfg b/tryton.cfg
index ca028b7..11f4585 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,7 +1,9 @@
[tryton]
-version=5.0.0
+version=5.0.1
depends:
company
+ account
+ account_col
sale
sale_pos
invoice_report
diff --git a/view/print_trial_balance_start_form.xml b/view/print_trial_balance_start_form.xml
new file mode 100644
index 0000000..81c4a85
--- /dev/null
+++ b/view/print_trial_balance_start_form.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+