merged two similar features to centralize the invoice lines if possible. Kept the one on account_journal, removed on account_account
bzr revid: qdp@tinyerp.com-20090115125037-o39g57ixptr4y7bd
This commit is contained in:
parent
0a163de317
commit
57717ac6e9
|
@ -289,8 +289,6 @@ class account_account(osv.osv):
|
|||
'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."),
|
||||
'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={}):
|
||||
|
|
|
@ -130,7 +130,6 @@
|
|||
<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)]"/>
|
||||
|
|
|
@ -431,7 +431,6 @@ 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')
|
||||
self.button_compute(cr, uid, ids, context={}, set_total=False)
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
if inv.move_id:
|
||||
|
@ -479,11 +478,7 @@ 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 'account_id' in i and 'taxes' in i:
|
||||
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']
|
||||
|
@ -504,36 +499,6 @@ 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 ('taxes' in move_line 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,
|
||||
|
|
Loading…
Reference in New Issue