bzr revid: fp@tinyerp.com-20081106090817-347wg10mvn90ct7c
This commit is contained in:
Fabien Pinckaers
2008-11-06 10:08:17 +01:00
7 changed files with 103 additions and 48 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -282,7 +282,9 @@ class account_account(osv.osv):
required=True),
'check_history': fields.boolean('Display History',
help="Check this box if you want to print all entries when printing the General Ledger, "\
"otherwise it will only print its balance.")
"otherwise it will only print its balance."),
'merge_invoice': fields.boolean('Merge Invoice Entries',help="Check this box if you want that all lines of "\
"a customer or supplier invoice using this account are created in one line only"),
}
def _default_company(self, cr, uid, context={}):
+3 -3
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -176,7 +176,7 @@ class account_move_line(osv.osv):
if s>0:
acc = acc1
v = self.pool.get('res.currency').compute(cr, uid,
account.company_id.currency_id.id,
account.company_id.currency_id.id,
data['currency_id'],
s, account=acc, account_invert=True)
data['amount_currency'] = v
@@ -277,7 +277,7 @@ class account_move_line(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True),
'quantity': fields.float('Quantity', digits=(16,2), help="The optionnal quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."),
'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."),
'debit': fields.float('Debit', digits=(16,2)),
'credit': fields.float('Credit', digits=(16,2)),
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
+8 -7
View File
@@ -130,6 +130,7 @@
<field name="reconcile"/>
<field name="active" select="2"/>
<field name="check_history"/>
<field name="merge_invoice" select="2"/>
<newline/>
<newline/>
<field colspan="4" name="tax_ids" domain="[('parent_id','=',False)]"/>
@@ -988,17 +989,17 @@
<act_window
domain="[('account_id', '=', active_id)]"
id="act_account_acount_move_line_open"
name=""
id="act_account_acount_move_line_open"
name=""
context="{'account_id': active_id}"
res_model="account.move.line"
res_model="account.move.line"
src_model="account.account"/>
<act_window
domain="[('account_id', '=', active_id),('reconcile_id','=',False)]"
id="act_account_acount_move_line_open_unreconciled"
name="Unreconciled entries"
res_model="account.move.line"
domain="[('account_id', '=', active_id),('reconcile_id','=',False)]"
id="act_account_acount_move_line_open_unreconciled"
name="Unreconciled entries"
res_model="account.move.line"
context="{'account_id': active_id}"
src_model="account.account"/>
+39 -2
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -414,6 +414,7 @@ class account_invoice(osv.osv):
def action_move_create(self, cr, uid, ids, *args):
ait_obj = self.pool.get('account.invoice.tax')
cur_obj = self.pool.get('res.currency')
acc_obj = self.pool.get('account.account')
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
@@ -460,7 +461,11 @@ class account_invoice(osv.osv):
# create one move line for the total and possibly adjust the other lines amount
total = 0
total_currency = 0
key_line=[]
for i in iml:
if i.has_key('account_id') and i.has_key('taxes'):
if not (i['account_id'],i['taxes']) in key_line:
key_line.append((i['account_id'],i['taxes']))
if inv.currency_id.id != company_currency:
i['currency_id'] = inv.currency_id.id
i['amount_currency'] = i['price']
@@ -481,6 +486,36 @@ class account_invoice(osv.osv):
acc_id = inv.account_id.id
name = inv['name'] or '/'
iml_temp=[]
move_list=[]
for item in key_line:
move_temp={}
if acc_obj.browse(cr,uid,item[0]).merge_invoice:
repeat=False
for move_line in iml:
if (move_line.has_key('account_id') and move_line['account_id']==item[0]) and (move_line.has_key('taxes') and move_line['taxes']==item[1]):
move_list.append(move_line)
if repeat:
for key in move_line:
if key in ['name','amount_currency','price_unit','price','quantity']:
if key=='name':
move_temp[key]=move_temp[key] + "," +move_line[key]
else:
move_temp[key] +=move_line[key]
else:
for key in move_line:
move_temp[key]=move_line[key]
repeat=True
if move_temp:
iml_temp.append(move_temp)
if len(iml_temp)<len(move_list):
for old_elem in move_list:
iml.remove(old_elem)
for new_elem in iml_temp:
iml.append(new_elem)
totlines = False
if inv.payment_term:
totlines = self.pool.get('account.payment.term').compute(cr,
@@ -570,7 +605,8 @@ class account_invoice(osv.osv):
'currency_id':x.get('currency_id', False),
'tax_code_id': x.get('tax_code_id', False),
'tax_amount': x.get('tax_amount', False),
'ref':x.get('ref',False)
'ref':x.get('ref',False),
'quantity':x.get('quantity',1.00),
}
def action_number(self, cr, uid, ids, *args):
@@ -934,6 +970,7 @@ class account_invoice_line(osv.osv):
'product_id':line.product_id.id,
'uos_id':line.uos_id.id,
'account_analytic_id':line.account_analytic_id.id,
'taxes':line.invoice_line_tax_id,
}
#
# Set the tax field according to the account and the partner
+15
View File
@@ -98,6 +98,12 @@
<paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<blockTableStyle id="TrLevel8">
<blockLeftPadding length="100" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel7">
<blockLeftPadding length="80" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel6">
<blockLeftPadding length="60" start="1,0" stop="1,0"/>
</blockTableStyle>
@@ -125,6 +131,15 @@
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<paraStyle
name="Level8"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level7"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level6"
fontName="Helvetica"
+33 -33
View File
@@ -198,19 +198,19 @@ class third_party_ledger(rml_parse.rml_parse):
"AND account.company_id = %d " \
"AND account.active " ,
(self.date_lst[0],self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
else:
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
"FROM account_move_line AS line, account_account AS account " \
"WHERE line.partner_id IS NOT NULL " \
"AND line.account_id = account.id " \
"AND line.date IN (" + self.date_lst_string + ") " \
"AND line.account_id IN (" + self.account_ids + ") " \
" " + PARTNER_REQUEST + " " \
"AND account.company_id = %d " \
"AND account.active " ,
(data['form']['company_id']))
# else:
#
# self.cr.execute(
# "SELECT DISTINCT line.partner_id " \
# "FROM account_move_line AS line, account_account AS account " \
# "WHERE line.partner_id IS NOT NULL " \
# "AND line.account_id = account.id " \
# "AND line.date IN (" + self.date_lst_string + ") " \
# "AND line.account_id IN (" + self.account_ids + ") " \
# " " + PARTNER_REQUEST + " " \
# "AND account.company_id = %d " \
# "AND account.active " ,
# (data['form']['company_id']))
res = self.cr.dictfetchall()
@@ -229,26 +229,26 @@ class third_party_ledger(rml_parse.rml_parse):
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
if data['form']['soldeinit'] :
self.cr.execute(
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
"FROM account_move_line l " \
"LEFT JOIN account_journal j " \
"ON (l.journal_id = j.id) " \
"WHERE l.partner_id = %d " \
"AND l.account_id IN (" + self.account_ids + ") " \
"AND l.date <= %s " \
"AND l.reconcile_id IS NULL "
"ORDER BY l.id",
(partner.id, self.date_lst[0]))
res = self.cr.dictfetchall()
sum = 0.0
for r in res:
sum = r['debit'] - r['credit']
r['progress'] = sum
full_account.append(r)
# if data['form']['soldeinit'] :
#
# self.cr.execute(
# "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
# "FROM account_move_line l " \
# "LEFT JOIN account_journal j " \
# "ON (l.journal_id = j.id) " \
# "WHERE l.partner_id = %d " \
# "AND l.account_id IN (" + self.account_ids + ") " \
# "AND l.date <= %s " \
# "AND l.reconcile_id IS NULL "
# "ORDER BY l.id",
# (partner.id, self.date_lst[0]))
# res = self.cr.dictfetchall()
# print"----res----",res
# sum = 0.0
# for r in res:
# sum = r['debit'] - r['credit']
# r['progress'] = sum
# full_account.append(r)
self.cr.execute(
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
@@ -119,7 +119,7 @@ class wizard_report(wizard.interface):
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all' or data['form']['state'] == 'none':
data['form']['fiscalyear'] = False
else :
data['form']['fiscalyear'] = True