@ -366,55 +366,54 @@ class GeneralView(models.TransientModel):
WHERE="WHERE l.account_id IN %s"
WHERE="WHERE l.account_id IN %s"
# Get move lines base on sql query and Calculate the total balance of move lines
# Get move lines base on sql query and Calculate the total balance of move lines
sql=('''SELECT l.account_id AS account_id, a.code AS code,a.id AS id, a.name AS name, ROUND(COALESCE(SUM(l.debit),0),2) AS debit, ROUND(COALESCE(SUM(l.credit),0),2) AS credit, ROUND(COALESCE(SUM(l.balance),0),2) AS balance
sql=('''SELECT l.id AS lid,m.id AS move_id, l.account_id AS account_id,
# if display_account == 'movement' and res.get('move_lines'):
# account_res.append(res)
# if display_account == 'not_zero' and not currency.is_zero(
# res['balance']):
# account_res.append(res)
#
# return account_res
@api.model
@api.model
def_get_currency(self):
def_get_currency(self):
@ -501,16 +500,16 @@ class GeneralView(models.TransientModel):
# WHERE += ' AND anltag.account_analytic_tag_id IN %s' % str(
# WHERE += ' AND anltag.account_analytic_tag_id IN %s' % str(
# tuple(self.analytic_tags.ids) + tuple([0]))
# tuple(self.analytic_tags.ids) + tuple([0]))
sql=("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\
sql=("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,
@ -558,16 +557,18 @@ class GeneralView(models.TransientModel):
# tuple(self.analytic_tags.ids) + tuple([0]))
# tuple(self.analytic_tags.ids) + tuple([0]))
# Get move lines base on sql query and Calculate the total balance of move lines
# Get move lines base on sql query and Calculate the total balance of move lines
sql=('''SELECT l.id AS lid,m.id AS move_id, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(SUM(l.debit),0) AS debit, COALESCE(SUM(l.credit),0) AS credit, COALESCE(SUM(l.balance),0) AS balance,\
sql=('''SELECT l.id AS lid,m.id AS move_id, l.account_id AS account_id,
+WHERE+new_final_filter+''' GROUP BY l.id, m.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, c.position, p.name ORDER BY l.date''')
+WHERE+new_final_filter+''' GROUP BY l.id, m.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, c.position, p.name''')
params=tuple(where_params)
params=tuple(where_params)
@ -674,19 +675,19 @@ class GeneralView(models.TransientModel):
sheet.write(row+1,col+7,rec_data['debit'],txt)
sheet.write(row+1,col+7,rec_data['debit'],txt)
sheet.write(row+1,col+8,rec_data['credit'],txt)
sheet.write(row+1,col+8,rec_data['credit'],txt)
sheet.write(row+1,col+9,rec_data['balance'],txt)
sheet.write(row+1,col+9,rec_data['balance'],txt)
# for line_data in rec_data['move_lines']:
forline_datainrec_data['move_lines']:
# row += 1
row+=1
# sheet.write(row + 1, col, '', txt)
sheet.write(row+1,col,'',txt)
# sheet.write(row + 1, col + 1, '', txt)
sheet.write(row+1,col+1,'',txt)
# sheet.write(row + 1, col + 2, line_data.get('ldate'), txt)