Skip to content

Commit

Permalink
[PEP]8
Browse files Browse the repository at this point in the history
  • Loading branch information
fmdl committed May 12, 2017
1 parent 6906f02 commit 9cafb63
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion report/report_account_standard_excel.py
Expand Up @@ -25,7 +25,7 @@ def generate_xlsx_report(self, workbook, data, report):
sheet.write(2, 4, _('Target Moves:'), bold)
sheet.write(3, 4, _('All Entries') if data['target_move'] == 'all' else _('All Posted Entries'))

sheet.write(2, 6, _('Only UnReconciled Entries') if data['reconciled'] == False else _('With Reconciled Entries'), bold)
sheet.write(2, 6, _('Only UnReconciled Entries') if data['reconciled'] is False else _('With Reconciled Entries'), bold)
sheet.write(3, 6, _('With entries matched with other entries dated after End Date.') if data['rem_futur_reconciled'] else '')

if report.summary:
Expand Down
5 changes: 1 addition & 4 deletions report/report_account_standard_report.py
@@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-

from datetime import datetime, timedelta
import time
from odoo import api, models, fields, _
from odoo.tools import float_is_zero, float_compare
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
from odoo import api, models


class AccountStandardReport(models.AbstractModel):
Expand Down
23 changes: 9 additions & 14 deletions wizard/account_standard_report.py
Expand Up @@ -2,25 +2,25 @@

from datetime import datetime, timedelta
from odoo import api, models, fields, _
from odoo.tools import float_is_zero, float_compare
from odoo.tools import float_is_zero
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT

D_LEDGER = {'general': {'name': 'General Ledger',
D_LEDGER = {'general': {'name': _('General Ledger'),
'group_by': 'account_id',
'model': 'account.account',
'short': 'code',
},
'partner': {'name': 'Partner Ledger',
'partner': {'name': _('Partner Ledger'),
'group_by': 'partner_id',
'model': 'res.partner',
'short': 'name',
},
'journal': {'name': 'Journal Ledger',
'journal': {'name': _('Journal Ledger'),
'group_by': 'journal_id',
'model': 'account.journal',
'short': 'code',
},
'open': {'name': 'Open Ledger',
'open': {'name': _('Open Ledger'),
'group_by': 'account_id',
'model': 'account.account',
'short': 'code',
Expand Down Expand Up @@ -132,7 +132,7 @@ def on_change_periode_date(self):

@api.onchange('date_to')
def onchange_date_to(self):
if self.date_to == False:
if self.date_to is False:
self.rem_futur_reconciled = False
else:
self.rem_futur_reconciled = True
Expand All @@ -146,12 +146,12 @@ def print_excel_report(self):
return self.env['report'].get_action(self, 'account_standard_report.report_account_standard_excel')

def pre_compute_form(self):
if self.date_from == False:
if self.date_from is False:
self.with_init_balance = False
if self.type_ledger != 'partner':
self.reconciled = True
self.with_init_balance = True
if self.date_from == False:
if self.date_from is False:
self.with_init_balance = False
self.partner_ids = False

Expand Down Expand Up @@ -196,15 +196,12 @@ def _generate_data(self, data, date_format):
rounding = self.env.user.company_id.currency_id.rounding or 0.01
with_init_balance = self.with_init_balance
init_balance_history = self.init_balance_history
summary = self.summary
date_from = self.date_from
date_to = self.date_to
type_ledger = self.type_ledger
detail_unreconcillied_in_init = self.detail_unreconcillied_in_init
date_from_dt = datetime.strptime(date_from, DEFAULT_SERVER_DATE_FORMAT) if date_from else False
date_to_dt = datetime.strptime(date_to, DEFAULT_SERVER_DATE_FORMAT) if date_to else False
date_init_dt = self._generate_date_init(date_from_dt)
date_init = date_init_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) if date_init_dt else False
accounts = self._search_account()

reconcile_clause, matching_in_futur, list_match_after_init = self._compute_reconcile_clause(date_init_dt)
Expand Down Expand Up @@ -349,7 +346,7 @@ def _generate_data(self, data, date_format):

# remove unused account
for key, value in line_account.items():
if value['active'] == False:
if value['active'] is False:
del line_account[key]

open_balance = open_debit - open_credit
Expand Down Expand Up @@ -392,7 +389,6 @@ def _generate_sql(self, data, accounts, reconcile_clause, date_to, date_from):
context = {'journal_ids': self.journal_ids.ids,
'state': self.target_move, }
query_get_data = self.env['account.move.line'].with_context(context)._query_get()
move_state = ['posted'] if self.target_move == 'posted' else ['draft', 'posted']
params = [tuple(['posted']), tuple(accounts.ids)] + query_get_data[2]

partner_clause = ''
Expand Down Expand Up @@ -568,7 +564,6 @@ def _compute_reconcile_clause(self, date_init):
# the entrie is considered like unreconciled.
if self.rem_futur_reconciled and self.date_to:
date_to = datetime.strptime(self.date_to, DEFAULT_SERVER_DATE_FORMAT)
acc_ful_obj = self.env['account.full.reconcile']

def sql_query(params):
query = """
Expand Down

0 comments on commit 9cafb63

Please sign in to comment.