Skip to content

Commit

Permalink
Merge pull request OCA#27 from fmdl/full_sql
Browse files Browse the repository at this point in the history
Full sql
  • Loading branch information
fmdl committed Jun 29, 2017
2 parents 8956342 + 4063e43 commit a2e02f1
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 209 deletions.
2 changes: 1 addition & 1 deletion __manifest__.py
Expand Up @@ -2,7 +2,7 @@

{
'name': 'Standard Accounting Report',
'version': '1.0',
'version': '1.1',
'category': 'Accounting & Finance',
'author': 'Florent de Labarre',
'description': """Standard Accounting Report""",
Expand Down
2 changes: 1 addition & 1 deletion data/report_paperformat.xml
Expand Up @@ -8,7 +8,7 @@
<field name="page_width">210</field>
<field name="orientation">Landscape</field>
<field name="margin_top">12</field>
<field name="margin_bottom">23</field>
<field name="margin_bottom">15</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False"/>
Expand Down
15 changes: 15 additions & 0 deletions migrations/10.0.1.1/post-00-regenrate-shorted.py
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-

import logging
from odoo import SUPERUSER_ID
logger = logging.getLogger('MIG compacted')
from odoo import api


def migrate(cr, v):
with api.Environment.manage():
uid = SUPERUSER_ID
ctx = api.Environment(cr, uid, {})['res.users'].context_get()
env = api.Environment(cr, uid, ctx)

cr.execute("""UPDATE account_account SET compacted = FALSE WHERE compacted IS NULL;""")
1 change: 0 additions & 1 deletion report/__init__.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-

# import report_account_standard_report
import report_account_standard_excel
55 changes: 25 additions & 30 deletions report/report_account_standard_excel.py
Expand Up @@ -25,6 +25,12 @@ def generate_xlsx_report(self, workbook, data, wizard):

report = wizard.report_id

def _get_data_float(data):
if data == None or data == False:
return 0.0
else:
return wizard.company_currency_id.round(data) + 0.0

def get_date_format(date):
if date:
date = datetime.strptime(date, DEFAULT_SERVER_DATE_FORMAT)
Expand Down Expand Up @@ -92,13 +98,13 @@ def _header_sheet(sheet):
i += row
sheet.write(i, 0, line.get('code', ''))
sheet.write(i, 1, line.get('name', ''))
sheet.write(i, 2, round(line.get('current', 0.0), rounding), currency_format)
sheet.write(i, 3, round(line.get('age_30_days', 0.0), rounding), currency_format)
sheet.write(i, 4, round(line.get('age_60_days', 0.0), rounding), currency_format)
sheet.write(i, 5, round(line.get('age_90_days', 0.0), rounding), currency_format)
sheet.write(i, 6, round(line.get('age_120_days', 0.0), rounding), currency_format)
sheet.write(i, 7, round(line.get('older', 0.0), rounding), currency_format)
sheet.write(i, 8, round(line.get('balance', 0.0), rounding), currency_format)
sheet.write(i, 2, _get_data_float(line.get('current')), currency_format)
sheet.write(i, 3, _get_data_float(line.get('age_30_days')), currency_format)
sheet.write(i, 4, _get_data_float(line.get('age_60_days')), currency_format)
sheet.write(i, 5, _get_data_float(line.get('age_90_days')), currency_format)
sheet.write(i, 6, _get_data_float(line.get('age_120_days')), currency_format)
sheet.write(i, 7, _get_data_float(line.get('older')), currency_format)
sheet.write(i, 8, _get_data_float(line.get('balance')), currency_format)
row = i

for j, h in enumerate(head):
Expand Down Expand Up @@ -174,12 +180,6 @@ def _header_sheet(sheet):
col.update(h['col'])
table.append(col)

def _get_data_float(data):
if data == None:
return 0.0
else:
return data

def _set_line(line):
sheet.write(i, 0, get_date_format(line.get('date', '')))
sheet.write(i, 1, line.get('j_code', ''))
Expand All @@ -189,13 +189,13 @@ def _set_line(line):
sheet.write(i, 5, line.get('displayed_name', ''))
sheet.write(i, 6, line.get('partner_name', ''))
sheet.write(i, 7, get_date_format(line.get('date_maturity', '')))
sheet.write(i, 8, round(_get_data_float(line.get('current', 0.0)), rounding), currency_format)
sheet.write(i, 9, round(_get_data_float(line.get('age_30_days', 0.0)), rounding), currency_format)
sheet.write(i, 10, round(_get_data_float(line.get('age_60_days', 0.0)), rounding), currency_format)
sheet.write(i, 11, round(_get_data_float(line.get('age_90_days', 0.0)), rounding), currency_format)
sheet.write(i, 12, round(_get_data_float(line.get('age_120_days', 0.0)), rounding), currency_format)
sheet.write(i, 13, round(_get_data_float(line.get('older', 0.0)), rounding), currency_format)
sheet.write(i, 14, round(_get_data_float(line.get('balance', 0.0)), rounding), currency_format)
sheet.write(i, 8, _get_data_float(line.get('current')), currency_format)
sheet.write(i, 9, _get_data_float(line.get('age_30_days')), currency_format)
sheet.write(i, 10, _get_data_float(line.get('age_60_days')), currency_format)
sheet.write(i, 11, _get_data_float(line.get('age_90_days')), currency_format)
sheet.write(i, 12, _get_data_float(line.get('age_120_days')), currency_format)
sheet.write(i, 13, _get_data_float(line.get('older')), currency_format)
sheet.write(i, 14, _get_data_float(line.get('balance')), currency_format)
sheet.write(i, 15, line.get('matching_number', ''))

def _set_table(start_row, row):
Expand Down Expand Up @@ -380,17 +380,17 @@ def _set_table(start_row, row):
table.append(col)

def _set_line(line):
sheet.write(i, 0, get_date_format(line.get('date', '')))
sheet.write(i, 0, get_date_format(line.get('date', '')) if line.get('type_view') != 'init' else 'INIT')
sheet.write(i, 1, line.get('j_code', ''))
sheet.write(i, 2, line.get('a_code', ''))
sheet.write(i, 3, line.get('a_name', ''))
sheet.write(i, 4, line.get('move_name', ''))
sheet.write(i, 5, line.get('displayed_name', ''))
sheet.write(i, 6, line.get('partner_name', ''))
sheet.write(i, 7, get_date_format(line.get('date_maturity', '')))
sheet.write(i, 8, round(line.get('debit', ''), rounding), currency_format)
sheet.write(i, 9, round(line.get('credit', ''), rounding), currency_format)
sheet.write(i, 10, round(line.get('cumul_balance', ''), rounding), currency_format)
sheet.write(i, 8, _get_data_float(line.get('debit', '')), currency_format)
sheet.write(i, 9, _get_data_float(line.get('credit', '')), currency_format)
sheet.write(i, 10, _get_data_float(line.get('cumul_balance', '')), currency_format)
sheet.write(i, 11, line.get('matching_number', ''))

def _set_table(start_row, row):
Expand All @@ -406,13 +406,8 @@ def _set_table(start_row, row):
_header_sheet(sheet)

row = 6
# for group_by in data['group_by_data']['ids']:
# all_lines = []
# for line in data['lines_group_by'][group_by]['new_lines']:
# if line['type_line'] != 'total':
# all_lines.append(line)

all_lines = wizard.sql_get_line_for_report(type_l=('1_init_line', '2_line'))
all_lines = wizard.sql_get_line_for_report(type_l=('0_init', '1_init_line', '2_line'))
for obj in report.report_object_ids:
lines_obj = []
obj_id = obj.id
Expand Down
33 changes: 0 additions & 33 deletions report/report_account_standard_report.py

This file was deleted.

0 comments on commit a2e02f1

Please sign in to comment.