From 975b6c4988cc83f294062eec0d8824f99fbd96a2 Mon Sep 17 00:00:00 2001
From: "nel@tinyerp.com" <>
Date: Wed, 7 Jul 2010 14:36:49 +0200
Subject: [PATCH 01/11] [IMP] holidays,timesheet: report views
bzr revid: nel@tinyerp.com-20100707123649-3iqzh8uzzsmrq22b
---
.../report/available_holidays_view.xml | 47 ++++++++-----------
.../report/hr_holidays_report_view.xml | 11 ++---
.../report/hr_timesheet_report_view.xml | 9 ++--
.../report/timesheet_report_view.xml | 14 +++---
4 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/addons/hr_holidays/report/available_holidays_view.xml b/addons/hr_holidays/report/available_holidays_view.xml
index 111d8d2f8a6..a172e7eb0ea 100644
--- a/addons/hr_holidays/report/available_holidays_view.xml
+++ b/addons/hr_holidays/report/available_holidays_view.xml
@@ -10,18 +10,17 @@
tree
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
@@ -48,11 +47,6 @@
-
-
-
@@ -61,27 +55,26 @@
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -91,7 +84,7 @@
available.holidays.report
form
tree,graph
- {'search_default_month':1,'search_default_User':1,'group_by':[], "search_default_user_id": uid}
+ {'search_default_month':1,'search_default_user':1,'group_by':[], "search_default_user_id": uid, 'group_by_no_leaf':1}
diff --git a/addons/hr_holidays/report/hr_holidays_report_view.xml b/addons/hr_holidays/report/hr_holidays_report_view.xml
index 0d515bcacff..be08ab63bae 100644
--- a/addons/hr_holidays/report/hr_holidays_report_view.xml
+++ b/addons/hr_holidays/report/hr_holidays_report_view.xml
@@ -9,8 +9,8 @@
-
-
+
+
@@ -52,14 +52,13 @@
-
+
-
@@ -77,7 +76,7 @@
-
+
diff --git a/addons/hr_timesheet/report/hr_timesheet_report_view.xml b/addons/hr_timesheet/report/hr_timesheet_report_view.xml
index 41fb3520bcc..648b8f30321 100644
--- a/addons/hr_timesheet/report/hr_timesheet_report_view.xml
+++ b/addons/hr_timesheet/report/hr_timesheet_report_view.xml
@@ -54,12 +54,11 @@
domain="[('date','=', time.strftime('%%Y-%%m-%%d'))]"
help="Timesheet dof the day"/>
-
-
-
+
+
-
+
@@ -79,6 +78,8 @@
+
+
diff --git a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
index a5d7d9b420f..0bc2b70d341 100644
--- a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
+++ b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
@@ -49,18 +49,18 @@
-
-
+
+
Date: Wed, 7 Jul 2010 18:33:47 +0530
Subject: [PATCH 02/11] [IMP]: improvement in payroll module
bzr revid: mga@tinyerp.com-20100707130347-r4zlz7ktthfet0ai
---
addons/hr_payroll/hr_payroll.py | 23 ++++++++++---------
addons/hr_payroll/hr_payroll_view.xml | 10 ++++----
.../hr_payroll_account/hr_payroll_account.py | 5 ++++
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index bfc84d6750d..753d3d6d017 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -522,7 +522,7 @@ class company_contribution(osv.osv):
'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Heads', required=False),
'name':fields.char('Name', size=256, required=True, readonly=False),
'code':fields.char('Code', size=64, required=True, readonly=False),
- 'include_in_salary':fields.boolean('Included in Salary ?', help='If company contribute on this deduction then should company contribution is also deducted from Employee Salary'),
+# 'include_in_salary':fields.boolean('Included in Salary ?', help='If company contribute on this deduction then should company contribution is also deducted from Employee Salary'),
'gratuity':fields.boolean('Use for Gratuity ?', required=False),
'line_ids':fields.one2many('company.contribution.line', 'contribution_id', 'Calculations', required=False),
'register_id':fields.property(
@@ -537,19 +537,20 @@ class company_contribution(osv.osv):
),
'amount_type':fields.selection([
('fix','Fixed Amount'),
+ ('per','Percentage'),
('func','Function Calculation'),
],'Amount Type', select=True),
'contribute_per':fields.float('Contribution', digits=(16, 4), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
- 'account_id':fields.property(
- 'account.account',
- type='many2one',
- relation='account.account',
- string="Account",
- method=True,
- view_load=True,
- help="Expanse account where company expanse will be encoded",
- required=False
- ),
+# 'account_id':fields.property(
+# 'account.account',
+# type='many2one',
+# relation='account.account',
+# string="Account",
+# method=True,
+# view_load=True,
+# help="Expanse account where company expanse will be encoded",
+# required=False
+# ),
'company_id':fields.many2one('res.company', 'Company', required=False),
'active':fields.boolean('Active', required=False),
'note': fields.text('Description'),
diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml
index 97b6ac70cee..a85fcc2462c 100644
--- a/addons/hr_payroll/hr_payroll_view.xml
+++ b/addons/hr_payroll/hr_payroll_view.xml
@@ -644,8 +644,6 @@
-
-
@@ -654,9 +652,11 @@
-
-
-
+
+
+
+
+
diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py
index 9c1ab7a5c30..063090cbe83 100644
--- a/addons/hr_payroll_account/hr_payroll_account.py
+++ b/addons/hr_payroll_account/hr_payroll_account.py
@@ -393,6 +393,11 @@ class hr_payslip(osv.osv):
line_ids += [movel_pool.create(cr, uid, rec)]
+ for contrub in line.category_id.contribute_ids:
+ print contrib.name, contrub.code, contrub.amount_type, contrib.contribute_per, line.total
+
+
+
# if line.company_contrib > 0:
# company_contrib = line.company_contrib
## if line.category_id.amount_type == 'per':
From 77f69c4fe868ca3e6b8fadc31d8d14423ee21d44 Mon Sep 17 00:00:00 2001
From: Mantavya Gajjar
Date: Wed, 7 Jul 2010 18:35:41 +0530
Subject: [PATCH 03/11] [IMP]: improvement to account voucher
bzr revid: mga@tinyerp.com-20100707130541-u4x9w4w2lr9i4v3g
---
addons/account_voucher/voucher.py | 361 ++++++------------
addons/account_voucher/voucher_view.xml | 31 +-
addons/account_voucher/voucher_workflow.xml | 2 +-
.../account_voucher_payment_view.xml | 2 +-
4 files changed, 142 insertions(+), 254 deletions(-)
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 90dbcca468f..3cb62011a4e 100644
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -20,14 +20,17 @@
##############################################################################
import time
-import netsvc
from osv import fields
from osv import osv
-import ir
-import pooler
-import mx.DateTime
-from mx.DateTime import RelativeDateTime
-from tools import config
+
+journal2type = {
+ 'cash':'rec_voucher',
+ 'bank':'bank_rec_voucher',
+ 'cash':'pay_voucher',
+ 'sale':'journal_sale_vou',
+ 'purchase':'journal_pur_voucher',
+ 'general':'journal_voucher'
+}
type2journal = {
'rec_voucher': 'cash',
@@ -68,8 +71,9 @@ class account_voucher(osv.osv):
return False
def _get_type(self, cr, uid, context={}):
- type = context.get('type', 'bank_rec_voucher')
- return type
+ vtype = context.get('type', 'bank')
+ voucher_type = journal2type.get(vtype)
+ return voucher_type
def _get_reference_type(self, cursor, user, context=None):
return [('none', 'Free Reference')]
@@ -91,15 +95,15 @@ class account_voucher(osv.osv):
return False
def _get_currency(self, cr, uid, context):
- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
+ user = self.pool.get('res.users').browse(cr, uid, uid)
if user.company_id:
return user.company_id.currency_id.id
else:
- return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
+ return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
_name = 'account.voucher'
_description = 'Accounting Voucher'
- _order = "number"
+ _order = "date desc"
_columns = {
'name':fields.char('Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}),
'type': fields.selection([
@@ -107,7 +111,7 @@ class account_voucher(osv.osv):
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
- ('cont_voucher','Contra'),
+# ('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
@@ -117,7 +121,7 @@ class account_voucher(osv.osv):
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, domain=[('type','<>','view')]),
'payment_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'posted':[('readonly',True)]}),
- 'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}, required=True),
+ 'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}, required=False),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state':fields.selection(
@@ -133,10 +137,10 @@ class account_voucher(osv.osv):
\n* The \'Posted\' state is used when user create voucher,a voucher number is generated and voucher entries are created in account \
\n* The \'Cancelled\' state is used when user cancel voucher.'),
'amount':fields.float('Amount', readonly=True),
- 'number':fields.char('Number', size=32, readonly=True),
'reference': fields.char('Voucher Reference', size=64),
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
required=True),
+ 'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
'move_id':fields.many2one('account.move', 'Account Entry'),
'move_ids':fields.many2many('account.move.line', 'voucher_id', 'account_id', 'rel_account_move', 'Real Entry'),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]})
@@ -147,24 +151,17 @@ class account_voucher(osv.osv):
'type': _get_type,
'journal_id':_get_journal,
'currency_id': _get_currency,
-
'state': lambda *a: 'draft',
'date' : lambda *a: time.strftime('%Y-%m-%d'),
'reference_type': lambda *a: "none",
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
}
-# def _get_analityc_lines(self, cr, uid, id):
-# inv = self.browse(cr, uid, [id])[0]
-# cur_obj = self.pool.get('res.currency')
-
def onchange_account(self, cr, uid, ids, account_id):
-
if not account_id:
return {
'value':{'amount':False}
}
-
account = self.pool.get('account.account').browse(cr, uid, account_id)
balance=account.balance
return {
@@ -176,7 +173,6 @@ class account_voucher(osv.osv):
return {
'value':{'account_id':False}
}
-
journal = self.pool.get('account.journal')
if journal_id and (type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher')):
@@ -196,25 +192,40 @@ class account_voucher(osv.osv):
}
def open_voucher(self, cr, uid, ids, context={}):
- obj = self.pool.get('account.voucher').browse(cr, uid, ids)
+ voucher = self.pool.get('account.voucher').browse(cr, uid, ids)[0]
total = 0
- for i in obj[0].payment_ids:
- total += i.amount
+ for line in voucher.payment_ids:
+ total += line.amount
+
if total != 0:
- self.write(cr, uid, ids, {'amount':total, 'state':'proforma'})
+ res = {
+ 'amount':total,
+ 'state':'proforma'
+ }
+ self.write(cr, uid, ids, res)
else:
raise osv.except_osv('Invalid action !', 'You cannot post to Pro-Forma a voucher with Total amount = 0 !')
return True
def proforma_voucher(self, cr, uid, ids, context={}):
- self.action_number(cr, uid, ids)
self.action_move_line_create(cr, uid, ids)
self.write(cr, uid, ids, {'state':'posted'})
return True
def cancel_voucher(self, cr, uid, ids, context={}):
- self.action_cancel(cr, uid, ids)
- self.write(cr, uid, ids, {'state':'cancel'})
+ move_pool = self.pool.get('account.move')
+
+ for voucher in self.browse(cr, uid, ids):
+ if voucher.move_id:
+ move_pool.button_cancel(cr, uid, [voucher.move_id.id])
+ move_pool.unlink(cr, uid, [voucher.move_id.id])
+
+ res = {
+ 'state':'cancel',
+ 'move_id':False,
+ 'move_ids':[(6, 0,[])]
+ }
+ self.write(cr, uid, ids, res)
return True
def action_cancel_draft(self, cr, uid, ids, *args):
@@ -231,237 +242,126 @@ class account_voucher(osv.osv):
raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !')
return super(account_voucher, self).unlink(cr, uid, unlink_ids, context=context)
- def _get_analytic_lines(self, cr, uid, id):
- inv = self.browse(cr, uid, [id])[0]
- cur_obj = self.pool.get('res.currency')
-
- company_currency = inv.company_id.currency_id.id
- if inv.type in ('rec_voucher'):
- sign = 1
- else:
- sign = -1
-
- iml = self.pool.get('account.voucher.line').move_line_get(cr, uid, inv.id)
-
- for il in iml:
- if il['account_analytic_id']:
- if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
- ref = inv.reference
- else:
- ref = self._convert_ref(cr, uid, inv.number)
-
- il['analytic_lines'] = [(0, 0, {
- 'name': il['name'],
- 'date': inv['date'],
- 'account_id': il['account_analytic_id'],
- 'amount': inv['amount'] * sign,
- 'general_account_id': il['account_id'] or False,
- 'journal_id': self.pool.get('account.voucher').browse(cr, uid, id).journal_id.analytic_journal_id.id or False,
- 'ref': ref,
- })]
- return iml
-
def action_move_line_create(self, cr, uid, ids, *args):
+ journal_pool = self.pool.get('account.journal')
+ sequence_pool = self.pool.get('ir.sequence')
+ move_pool = self.pool.get('account.move')
+ move_line_pool = self.pool.get('account.move.line')
+ analytic_pool = self.pool.get('account.analytic.line')
+ currency_pool = self.pool.get('res.currency')
+
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
-
+
company_currency = inv.company_id.currency_id.id
-
- line_ids = self.read(cr, uid, [inv.id], ['payment_ids'])[0]['payment_ids']
- ils = self.pool.get('account.voucher.line').read(cr, uid, line_ids)
-
- iml = self._get_analytic_lines(cr, uid, inv.id)
-
diff_currency_p = inv.currency_id.id <> company_currency
-
- total = 0
- if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
- ref = inv.reference
- else:
- ref = self._convert_ref(cr, uid, inv.number)
-
- acc_id = None
- date = inv.date
- total_currency = 0
- acc_id = None
- for i in iml:
- partner_id=i['partner_id']
- acc_id = i['account_id']
- if inv.currency_id.id != company_currency:
- i['currency_id'] = inv.currency_id.id
- i['amount_currency'] = i['amount']
- else:
- i['amount_currency'] = False
- i['currency_id'] = False
- if inv.type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher'):
- total += i['amount']
- total_currency += i['amount_currency'] or i['amount']
- i['amount'] = - i['amount']
- else:
- total -= i['amount']
- total_currency -= i['amount_currency'] or i['amount']
-
- name = inv['name'] or '/'
- totlines = False
-
- iml.append({
- 'type': 'dest',
- 'name': name,
- 'amount': total or False,
- 'account_id': acc_id,
- 'amount_currency': diff_currency_p \
- and total_currency or False,
- 'currency_id': diff_currency_p \
- and inv.currency_id.id or False,
- 'ref': ref,
- 'partner_id':partner_id or False,
- })
-
- date = inv.date
- inv.amount=total
-
- line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x,date, context={})) ,iml)
- an_journal_id=inv.journal_id.analytic_journal_id.id
- journal_id = inv.journal_id.id
-
- journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
+ ref = inv.reference
+
+ journal = journal_pool.browse(cr, uid, inv.journal_id.id)
if journal.sequence_id:
- name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
-
+ name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
+
move = {
'name' : name,
- 'journal_id': journal_id,
+ 'journal_id': journal.id,
'type' : inv.type,
- 'narration' : inv.narration,
+ 'narration' : inv.narration and inv.narration or inv.name,
'date':inv.date
}
+
if inv.period_id:
- move['period_id'] = inv.period_id.id
- for i in line:
- i[2]['period_id'] = inv.period_id.id
- move_id = self.pool.get('account.move').create(cr, uid, move)
- ref = move['name']
- amount=0.0
-
- #create the first line our self
+ move.update({
+ 'period_id': inv.period_id.id
+ })
+
+ move_id = move_pool.create(cr, uid, move)
+
+ #create the first line manually
move_line = {
'name': inv.name,
'debit': False,
'credit':False,
'account_id': inv.account_id.id or False,
- 'move_id':move_id ,
- 'journal_id':journal_id ,
- 'period_id':inv.period_id.id,
+ 'move_id': move_id ,
+ 'journal_id': inv.journal_id.id,
+ 'period_id': inv.period_id.id,
'partner_id': False,
'ref': ref,
'date': inv.date
}
+ if diff_currency_p:
+ amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
+ inv.amount = amount_currency
+ move_line.update({
+ 'amount_currency':amount_currency,
+ 'currency_id':inv.currency_id.id
+ })
+
if inv.type in ('rec_voucher', 'bank_rec_voucher', 'journal_pur_voucher', 'journal_voucher'):
move_line['debit'] = inv.amount
else:
- move_line['credit'] = inv.amount * (-1)
- self.pool.get('account.move.line').create(cr, uid, move_line)
-
+ move_line['credit'] = inv.amount
+
+ line_ids = []
+ line_ids += [move_line_pool.create(cr, uid, move_line)]
for line in inv.payment_ids:
-
+ amount=0.0
move_line = {
- 'name':line.name,
- 'debit':False,
- 'credit':False,
- 'account_id':line.account_id.id or False,
- 'move_id':move_id ,
- 'journal_id':journal_id ,
- 'period_id':inv.period_id.id,
- 'partner_id':line.partner_id.id or False,
- 'ref':ref,
- 'date':inv.date
- }
-
- if line.type == 'dr':
- move_line['debit'] = line.amount or False
- amount=line.amount
- elif line.type == 'cr':
- move_line['credit'] = line.amount or False
- amount=line.amount * (-1)
-
- move_line['analytic_account_id'] = line.account_analytic_id.id or False
- ml_id=self.pool.get('account.move.line').create(cr, uid, move_line)
-
- if inv.narration:
- line.name = inv.narration
- else:
- line.name = line.name
-
+ 'name': line.name,
+ 'debit': False,
+ 'credit': False,
+ 'account_id': line.account_id.id or False,
+ 'move_id': move_id ,
+ 'journal_id': inv.journal_id.id,
+ 'period_id': inv.period_id.id,
+ 'partner_id': line.partner_id.id or False,
+ 'ref': ref,
+ 'date': inv.date,
+ 'analytic_account_id': False
+ }
+
+ if diff_currency_p:
+ amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
+ line.amount = amount_currency
+ move_line.update({
+ 'amount_currency':amount_currency,
+ 'currency_id':inv.currency_id.id
+ })
+
if line.account_analytic_id:
- an_line = {
- 'name':line.name,
- 'date':inv.date,
- 'amount':amount,
- 'account_id':line.account_analytic_id.id or False,
- 'move_id':ml_id,
- 'journal_id':an_journal_id ,
- 'general_account_id':line.account_id.id,
- 'ref':ref
- }
- self.pool.get('account.analytic.line').create(cr, uid, an_line)
-
- self.write(cr, uid, [inv.id], {'move_id': move_id})
- obj=self.pool.get('account.move').browse(cr, uid, move_id)
-
- for line in obj.line_id :
- cr.execute('insert into voucher_id (account_id,rel_account_move) values (%d, %d)',(int(ids[0]),int(line.id)))
+ move_line.update({
+ 'analytic_account_id':line.account_analytic_id.id
+ })
+
+ if line.type == 'dr':
+ move_line.update({
+ 'debit': line.amount or False
+ })
+ amount = line.amount
+
+ elif line.type == 'cr':
+ move_line.update({
+ 'credit': line.amount or False
+ })
+ amount = line.amount * (-1)
+ move_line_id = move_line_pool.create(cr, uid, move_line)
+ line_ids += [move_line_id]
+
+ rec = {
+ 'move_id': move_id,
+ 'move_ids':[(6, 0,line_ids)]
+ }
+ self.write(cr, uid, [inv.id], rec)
+
return True
-
- def line_get_convert(self, cr, uid, x, date, context={}):
- return {
- 'date':date,
- 'date_maturity': x.get('date_maturity', False),
- 'partner_id':x.get('partner_id',False),
- 'name':x['name'][:64],
- 'debit':x['amount']>0 and x['amount'],
- 'credit':x['amount']<0 and -x['amount'],
- 'account_id':x['account_id'],
- 'analytic_lines':x.get('analytic_lines', []),
- 'amount_currency':x.get('amount_currency', False),
- '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)
- }
-
def _convert_ref(self, cr, uid, ref):
return (ref or '').replace('/','')
- def action_number(self, cr, uid, ids, *args):
- cr.execute('SELECT id, type, number, move_id, reference ' \
- 'FROM account_voucher ' \
- 'WHERE id IN %s',(tuple(ids),))
- for (id, invtype, number, move_id, reference) in cr.fetchall():
- if not number:
- number = self.pool.get('ir.sequence').get(cr, uid, invtype)
-
- if type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
- ref = reference
- else:
- ref = self._convert_ref(cr, uid, number)
-
- cr.execute('UPDATE account_voucher SET number=%s ' \
- 'WHERE id=%s', (number, id))
- cr.execute('UPDATE account_move_line SET ref=%s ' \
- 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
- (ref, move_id))
- cr.execute('UPDATE account_analytic_line SET ref=%s ' \
- 'FROM account_move_line ' \
- 'WHERE account_move_line.move_id = %s ' \
- 'AND account_analytic_line.move_id = account_move_line.id',
- (ref, move_id))
- return True
-
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
@@ -498,19 +398,6 @@ class account_voucher(osv.osv):
default['date'] = time.strftime('%Y-%m-%d')
return super(account_voucher, self).copy(cr, uid, id, default, context)
- def action_cancel(self, cr, uid, ids, *args):
- account_move_obj = self.pool.get('account.move')
- voucher = self.read(cr, uid, ids, ['move_id'])
- for i in voucher:
- if i['move_id']:
- account_move_obj.button_cancel(cr, uid, [i['move_id'][0]])
- # delete the move this invoice was pointing to
- # Note that the corresponding move_lines and move_reconciles
- # will be automatically deleted too
- account_move_obj.unlink(cr, uid, [i['move_id'][0]])
- self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
- return True
-
account_voucher()
class account_voucher_line(osv.osv):
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 91cbbf007db..296d7882b1a 100644
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -37,29 +37,25 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -136,7 +132,7 @@
-
+
Receivable Vouchers
account.voucher
@@ -144,6 +140,7 @@
tree,form
[('journal_id.type','=','sale')]
+ {'type':'sale'}