[REF] account_payment
bzr revid: psi@tinyerp.co.in-20101022120856-vjvo4mqx26gfftts
This commit is contained in:
parent
cc2725fee7
commit
0f29cca509
|
@ -20,6 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from osv import fields, osv
|
from osv import fields, osv
|
||||||
|
|
||||||
class Invoice(osv.osv):
|
class Invoice(osv.osv):
|
||||||
|
|
|
@ -41,10 +41,10 @@ class account_move_line(osv.osv):
|
||||||
INNER JOIN payment_order po
|
INNER JOIN payment_order po
|
||||||
ON (pl.order_id = po.id)
|
ON (pl.order_id = po.id)
|
||||||
WHERE move_line_id = ml.id
|
WHERE move_line_id = ml.id
|
||||||
AND po.state != 'cancel') as amount
|
AND po.state != 'cancel') AS amount
|
||||||
FROM account_move_line ml
|
FROM account_move_line ml
|
||||||
WHERE id IN %s""", (tuple(ids),))
|
WHERE id IN %s""", (tuple(ids),))
|
||||||
r=dict(cr.fetchall())
|
r = dict(cr.fetchall())
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def _to_pay_search(self, cr, uid, obj, name, args, context):
|
def _to_pay_search(self, cr, uid, obj, name, args, context):
|
||||||
|
@ -75,8 +75,8 @@ class account_move_line(osv.osv):
|
||||||
|
|
||||||
res = cr.fetchall()
|
res = cr.fetchall()
|
||||||
if not res:
|
if not res:
|
||||||
return [('id','=','0')]
|
return [('id', '=', '0')]
|
||||||
return [('id','in',map(lambda x:x[0], res))]
|
return [('id', 'in', map(lambda x:x[0], res))]
|
||||||
|
|
||||||
def line2bank(self, cr, uid, ids, payment_type=None, context=None):
|
def line2bank(self, cr, uid, ids, payment_type=None, context=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,7 +27,7 @@ import netsvc
|
||||||
class payment_mode(osv.osv):
|
class payment_mode(osv.osv):
|
||||||
_name= 'payment.mode'
|
_name= 'payment.mode'
|
||||||
_description= 'Payment Mode'
|
_description= 'Payment Mode'
|
||||||
_columns= {
|
_columns = {
|
||||||
'name': fields.char('Name', size=64, required=True, help='Mode of Payment'),
|
'name': fields.char('Name', size=64, required=True, help='Mode of Payment'),
|
||||||
'bank_id': fields.many2one('res.partner.bank', "Bank account",
|
'bank_id': fields.many2one('res.partner.bank', "Bank account",
|
||||||
required=True,help='Bank Account for the Payment Mode'),
|
required=True,help='Bank Account for the Payment Mode'),
|
||||||
|
@ -44,10 +44,10 @@ class payment_mode(osv.osv):
|
||||||
for the given payment type code"""
|
for the given payment type code"""
|
||||||
if not payment_code:
|
if not payment_code:
|
||||||
return []
|
return []
|
||||||
cr.execute(""" select pb.state
|
cr.execute(""" SELECT pb.state
|
||||||
from res_partner_bank pb
|
FROM res_partner_bank pb
|
||||||
join payment_mode pm on (pm.bank_id = pb.id)
|
JOIN payment_mode pm ON (pm.bank_id = pb.id)
|
||||||
where pm.id = %s """, [payment_code])
|
WHERE pm.id = %s """, [payment_code])
|
||||||
return [x[0] for x in cr.fetchall()]
|
return [x[0] for x in cr.fetchall()]
|
||||||
|
|
||||||
payment_mode()
|
payment_mode()
|
||||||
|
@ -75,38 +75,37 @@ class payment_order(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'date_scheduled': fields.date('Scheduled date if fixed', states={'done':[('readonly',True)]}, help='Select a date if you have chosen Preferred Date to be fixed.'),
|
'date_scheduled': fields.date('Scheduled date if fixed', states={'done':[('readonly', True)]}, help='Select a date if you have chosen Preferred Date to be fixed.'),
|
||||||
'reference': fields.char('Reference', size=128, required=1, states={'done':[('readonly',True)]}),
|
'reference': fields.char('Reference', size=128, required=1, states={'done': [('readonly', True)]}),
|
||||||
'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1, states={'done':[('readonly',True)]}, help='Select the Payment Mode to be applied.'),
|
'mode': fields.many2one('payment.mode', 'Payment mode', select=True, required=1, states={'done': [('readonly', True)]}, help='Select the Payment Mode to be applied.'),
|
||||||
'state': fields.selection([
|
'state': fields.selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
('open','Confirmed'),
|
('open', 'Confirmed'),
|
||||||
('cancel','Cancelled'),
|
('cancel', 'Cancelled'),
|
||||||
('done','Done')], 'State', select=True,
|
('done', 'Done')], 'State', select=True,
|
||||||
help='When an order is placed the state is \'Draft\'.\n Once the bank is confirmed the state is set to \'Confirmed\'.\n Then the order is paid the state is \'Done\'.'),
|
help='When an order is placed the state is \'Draft\'.\n Once the bank is confirmed the state is set to \'Confirmed\'.\n Then the order is paid the state is \'Done\'.'),
|
||||||
'line_ids': fields.one2many('payment.line', 'order_id', 'Payment lines', states={'done':[('readonly',True)]}),
|
'line_ids': fields.one2many('payment.line', 'order_id', 'Payment lines', states={'done': [('readonly', True)]}),
|
||||||
'total': fields.function(_total, string="Total", method=True,
|
'total': fields.function(_total, string="Total", method=True, type='float'),
|
||||||
type='float'),
|
'user_id': fields.many2one('res.users', 'User', required=True, states={'done': [('readonly', True)]}),
|
||||||
'user_id': fields.many2one('res.users', 'User', required=True, states={'done':[('readonly',True)]}),
|
|
||||||
'date_prefered': fields.selection([
|
'date_prefered': fields.selection([
|
||||||
('now', 'Directly'),
|
('now', 'Directly'),
|
||||||
('due', 'Due date'),
|
('due', 'Due date'),
|
||||||
('fixed', 'Fixed date')
|
('fixed', 'Fixed date')
|
||||||
], "Preferred date", change_default=True, required=True, states={'done':[('readonly', True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
|
], "Preferred date", change_default=True, required=True, states={'done': [('readonly', True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
|
||||||
'date_created': fields.date('Creation date', readonly=True),
|
'date_created': fields.date('Creation date', readonly=True),
|
||||||
'date_done': fields.date('Execution date', readonly=True),
|
'date_done': fields.date('Execution date', readonly=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'user_id': lambda self,cr,uid,context: uid,
|
'user_id': lambda self,cr,uid,context: uid,
|
||||||
'state': lambda *a: 'draft',
|
'state': 'draft',
|
||||||
'date_prefered': lambda *a: 'due',
|
'date_prefered': 'due',
|
||||||
'date_created': lambda *a: time.strftime('%Y-%m-%d'),
|
'date_created': time.strftime('%Y-%m-%d'),
|
||||||
'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'),
|
'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def set_to_draft(self, cr, uid, ids, *args):
|
def set_to_draft(self, cr, uid, ids, *args):
|
||||||
self.write(cr, uid, ids, {'state':'draft'})
|
self.write(cr, uid, ids, {'state': 'draft'})
|
||||||
wf_service = netsvc.LocalService("workflow")
|
wf_service = netsvc.LocalService("workflow")
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_create(uid, 'payment.order', id, cr)
|
wf_service.trg_create(uid, 'payment.order', id, cr)
|
||||||
|
@ -118,7 +117,7 @@ class payment_order(osv.osv):
|
||||||
for order in self.read(cr, uid, ids, ['reference']):
|
for order in self.read(cr, uid, ids, ['reference']):
|
||||||
if not order['reference']:
|
if not order['reference']:
|
||||||
reference = ir_seq_obj.get(cr, uid, 'payment.order')
|
reference = ir_seq_obj.get(cr, uid, 'payment.order')
|
||||||
self.write(cr, uid, order['id'],{'reference':reference})
|
self.write(cr, uid, order['id'], {'reference':reference})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_done(self, cr, uid, ids, *args):
|
def set_done(self, cr, uid, ids, *args):
|
||||||
|
@ -129,7 +128,7 @@ class payment_order(osv.osv):
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default={}, context=None):
|
def copy(self, cr, uid, id, default={}, context=None):
|
||||||
default.update({
|
default.update({
|
||||||
'state':'draft',
|
'state': 'draft',
|
||||||
'line_ids': [],
|
'line_ids': [],
|
||||||
'reference': self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
|
'reference': self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
|
||||||
})
|
})
|
||||||
|
@ -145,14 +144,14 @@ class payment_order(osv.osv):
|
||||||
for order in self.browse(cr, uid, ids, context=context):
|
for order in self.browse(cr, uid, ids, context=context):
|
||||||
for line in order.line_ids:
|
for line in order.line_ids:
|
||||||
payment_line_ids.append(line.id)
|
payment_line_ids.append(line.id)
|
||||||
payment_line_obj.write(cr, uid, payment_line_ids, {'date':vals.get('date_scheduled', False)}, context=context)
|
payment_line_obj.write(cr, uid, payment_line_ids, {'date': vals.get('date_scheduled', False)}, context=context)
|
||||||
elif vals.get('date_prefered', False) == 'due':
|
elif vals.get('date_prefered', False) == 'due':
|
||||||
vals.update({'date_scheduled':False})
|
vals.update({'date_scheduled': False})
|
||||||
for order in self.browse(cr, uid, ids, context=context):
|
for order in self.browse(cr, uid, ids, context=context):
|
||||||
for line in order.line_ids:
|
for line in order.line_ids:
|
||||||
payment_line_obj.write(cr, uid, [line.id], {'date':line.ml_maturity_date}, context=context)
|
payment_line_obj.write(cr, uid, [line.id], {'date': line.ml_maturity_date}, context=context)
|
||||||
elif vals.get('date_prefered', False) == 'now':
|
elif vals.get('date_prefered', False) == 'now':
|
||||||
vals.update({'date_scheduled':False})
|
vals.update({'date_scheduled': False})
|
||||||
for order in self.browse(cr, uid, ids, context=context):
|
for order in self.browse(cr, uid, ids, context=context):
|
||||||
for line in order.line_ids:
|
for line in order.line_ids:
|
||||||
payment_line_ids.append(line.id)
|
payment_line_ids.append(line.id)
|
||||||
|
@ -177,22 +176,22 @@ class payment_line(osv.osv):
|
||||||
result = {}
|
result = {}
|
||||||
info=''
|
info=''
|
||||||
for line in self.browse(cr, uid, ids, context=context):
|
for line in self.browse(cr, uid, ids, context=context):
|
||||||
owner=line.order_id.mode.bank_id.partner_id
|
owner = line.order_id.mode.bank_id.partner_id
|
||||||
result[line.id]=False
|
result[line.id] = False
|
||||||
if owner.address:
|
if owner.address:
|
||||||
for ads in owner.address:
|
for ads in owner.address:
|
||||||
if ads.type=='default':
|
if ads.type == 'default':
|
||||||
st=ads.street and ads.street or ''
|
st = ads.street and ads.street or ''
|
||||||
st1=ads.street2 and ads.street2 or ''
|
st1 = ads.street2 and ads.street2 or ''
|
||||||
if 'zip_id' in ads:
|
if 'zip_id' in ads:
|
||||||
zip_city= ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
zip_city = ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
||||||
else:
|
else:
|
||||||
zip=ads.zip and ads.zip or ''
|
zip = ads.zip and ads.zip or ''
|
||||||
city= ads.city and ads.city or ''
|
city = ads.city and ads.city or ''
|
||||||
zip_city= zip + ' ' + city
|
zip_city = zip + ' ' + city
|
||||||
cntry= ads.country_id and ads.country_id.name or ''
|
cntry = ads.country_id and ads.country_id.name or ''
|
||||||
info=owner.name + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
|
info = owner.name + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
|
||||||
result[line.id]=info
|
result[line.id] = info
|
||||||
break
|
break
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -200,27 +199,27 @@ class payment_line(osv.osv):
|
||||||
if not ids: return {}
|
if not ids: return {}
|
||||||
partner_zip_obj = self.pool.get('res.partner.zip')
|
partner_zip_obj = self.pool.get('res.partner.zip')
|
||||||
result = {}
|
result = {}
|
||||||
info=''
|
info = ''
|
||||||
|
|
||||||
for line in self.browse(cr, uid, ids, context=context):
|
for line in self.browse(cr, uid, ids, context=context):
|
||||||
result[line.id]=False
|
result[line.id] = False
|
||||||
if not line.partner_id:
|
if not line.partner_id:
|
||||||
break
|
break
|
||||||
partner = line.partner_id.name or ''
|
partner = line.partner_id.name or ''
|
||||||
if line.partner_id.address:
|
if line.partner_id.address:
|
||||||
for ads in line.partner_id.address:
|
for ads in line.partner_id.address:
|
||||||
if ads.type=='default':
|
if ads.type == 'default':
|
||||||
st=ads.street and ads.street or ''
|
st = ads.street and ads.street or ''
|
||||||
st1=ads.street2 and ads.street2 or ''
|
st1 = ads.street2 and ads.street2 or ''
|
||||||
if 'zip_id' in ads:
|
if 'zip_id' in ads:
|
||||||
zip_city= ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
zip_city = ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
||||||
else:
|
else:
|
||||||
zip=ads.zip and ads.zip or ''
|
zip = ads.zip and ads.zip or ''
|
||||||
city= ads.city and ads.city or ''
|
city = ads.city and ads.city or ''
|
||||||
zip_city= zip + ' ' + city
|
zip_city = zip + ' ' + city
|
||||||
cntry= ads.country_id and ads.country_id.name or ''
|
cntry = ads.country_id and ads.country_id.name or ''
|
||||||
info=partner + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
|
info = partner + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
|
||||||
result[line.id]=info
|
result[line.id] = info
|
||||||
break
|
break
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -229,10 +228,10 @@ class payment_line(osv.osv):
|
||||||
partner_obj = self.pool.get('res.partner')
|
partner_obj = self.pool.get('res.partner')
|
||||||
|
|
||||||
cr.execute("""SELECT pl.id, ml.%s
|
cr.execute("""SELECT pl.id, ml.%s
|
||||||
from account_move_line ml
|
FROM account_move_line ml
|
||||||
inner join payment_line pl
|
INNER JOIN payment_line pl
|
||||||
on (ml.id = pl.move_line_id)
|
ON (ml.id = pl.move_line_id)
|
||||||
where pl.id IN %%s"""% self.translate(name),
|
WHERE pl.id IN %%s"""% self.translate(name),
|
||||||
(tuple(ids),))
|
(tuple(ids),))
|
||||||
res = dict(cr.fetchall())
|
res = dict(cr.fetchall())
|
||||||
|
|
||||||
|
@ -276,7 +275,7 @@ class payment_line(osv.osv):
|
||||||
if user.company_id:
|
if user.company_id:
|
||||||
return user.company_id.currency_id.id
|
return user.company_id.currency_id.id
|
||||||
else:
|
else:
|
||||||
return currency_obj.search(cr, uid, [('rate','=',1.0)])[0]
|
return currency_obj.search(cr, uid, [('rate', '=', 1.0)])[0]
|
||||||
|
|
||||||
def _get_date(self, cr, uid, context=None):
|
def _get_date(self, cr, uid, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
|
@ -293,7 +292,7 @@ class payment_line(osv.osv):
|
||||||
return date
|
return date
|
||||||
|
|
||||||
def _get_ml_inv_ref(self, cr, uid, ids, *a):
|
def _get_ml_inv_ref(self, cr, uid, ids, *a):
|
||||||
res={}
|
res = {}
|
||||||
for id in self.browse(cr, uid, ids):
|
for id in self.browse(cr, uid, ids):
|
||||||
res[id.id] = False
|
res[id.id] = False
|
||||||
if id.move_line_id:
|
if id.move_line_id:
|
||||||
|
@ -302,7 +301,7 @@ class payment_line(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_ml_maturity_date(self, cr, uid, ids, *a):
|
def _get_ml_maturity_date(self, cr, uid, ids, *a):
|
||||||
res={}
|
res = {}
|
||||||
for id in self.browse(cr, uid, ids):
|
for id in self.browse(cr, uid, ids):
|
||||||
if id.move_line_id:
|
if id.move_line_id:
|
||||||
res[id.id] = id.move_line_id.date_maturity
|
res[id.id] = id.move_line_id.date_maturity
|
||||||
|
@ -311,7 +310,7 @@ class payment_line(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_ml_created_date(self, cr, uid, ids, *a):
|
def _get_ml_created_date(self, cr, uid, ids, *a):
|
||||||
res={}
|
res = {}
|
||||||
for id in self.browse(cr, uid, ids):
|
for id in self.browse(cr, uid, ids):
|
||||||
if id.move_line_id:
|
if id.move_line_id:
|
||||||
res[id.id] = id.move_line_id.date_created
|
res[id.id] = id.move_line_id.date_created
|
||||||
|
@ -323,8 +322,8 @@ class payment_line(osv.osv):
|
||||||
'name': fields.char('Your Reference', size=64, required=True),
|
'name': fields.char('Your Reference', size=64, required=True),
|
||||||
'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
|
'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
|
||||||
'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),
|
'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),
|
||||||
'move_line_id': fields.many2one('account.move.line', 'Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')], help='This Entry Line will be referred for the information of the ordering customer.'),
|
'move_line_id': fields.many2one('account.move.line', 'Entry line', domain=[('reconcile_id', '=', False), ('account_id.type', '=', 'payable')], help='This Entry Line will be referred for the information of the ordering customer.'),
|
||||||
'amount_currency': fields.float('Amount in Partner Currency', digits=(16,2),
|
'amount_currency': fields.float('Amount in Partner Currency', digits=(16, 2),
|
||||||
required=True, help='Payment amount in the partner currency'),
|
required=True, help='Payment amount in the partner currency'),
|
||||||
'currency': fields.many2one('res.currency','Partner Currency', required=True),
|
'currency': fields.many2one('res.currency','Partner Currency', required=True),
|
||||||
'company_currency': fields.many2one('res.currency', 'Company Currency', readonly=True),
|
'company_currency': fields.many2one('res.currency', 'Company Currency', readonly=True),
|
||||||
|
@ -359,10 +358,10 @@ class payment_line(osv.osv):
|
||||||
]
|
]
|
||||||
|
|
||||||
def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency=False, company_currency=False, context=None):
|
def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency=False, company_currency=False, context=None):
|
||||||
data={}
|
data = {}
|
||||||
move_line_obj = self.pool.get('account.move.line')
|
move_line_obj = self.pool.get('account.move.line')
|
||||||
|
|
||||||
data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
|
data['amount_currency'] = data['communication'] = data['partner_id'] = data['reference'] = data['date_created'] = data['bank_id'] = data['amount'] = False
|
||||||
|
|
||||||
if move_line_id:
|
if move_line_id:
|
||||||
line = move_line_obj.browse(cr, uid, move_line_id)
|
line = move_line_obj.browse(cr, uid, move_line_id)
|
||||||
|
@ -372,7 +371,7 @@ class payment_line(osv.osv):
|
||||||
company_currency, context)
|
company_currency, context)
|
||||||
if res:
|
if res:
|
||||||
data['amount'] = res['value']['amount']
|
data['amount'] = res['value']['amount']
|
||||||
data['partner_id']=line.partner_id.id
|
data['partner_id'] = line.partner_id.id
|
||||||
temp = line.currency_id and line.currency_id.id or False
|
temp = line.currency_id and line.currency_id.id or False
|
||||||
if not temp:
|
if not temp:
|
||||||
if line.invoice:
|
if line.invoice:
|
||||||
|
@ -381,12 +380,12 @@ class payment_line(osv.osv):
|
||||||
data['currency'] = temp
|
data['currency'] = temp
|
||||||
|
|
||||||
# calling onchange of partner and updating data dictionary
|
# calling onchange of partner and updating data dictionary
|
||||||
temp_dict=self.onchange_partner(cr, uid, ids, line.partner_id.id, payment_type)
|
temp_dict = self.onchange_partner(cr, uid, ids, line.partner_id.id, payment_type)
|
||||||
data.update(temp_dict['value'])
|
data.update(temp_dict['value'])
|
||||||
|
|
||||||
data['reference']=line.ref
|
data['reference'] = line.ref
|
||||||
data['date_created'] = line.date_created
|
data['date_created'] = line.date_created
|
||||||
data['communication']=line.ref
|
data['communication'] = line.ref
|
||||||
|
|
||||||
if date_prefered == 'now':
|
if date_prefered == 'now':
|
||||||
#no payment date => immediate payment
|
#no payment date => immediate payment
|
||||||
|
@ -399,7 +398,7 @@ class payment_line(osv.osv):
|
||||||
|
|
||||||
def onchange_amount(self, cr, uid, ids, amount, currency, cmpny_currency, context=None):
|
def onchange_amount(self, cr, uid, ids, amount, currency, cmpny_currency, context=None):
|
||||||
if (not amount) or (not cmpny_currency):
|
if (not amount) or (not cmpny_currency):
|
||||||
return {'value': {'amount':False}}
|
return {'value': {'amount': False}}
|
||||||
res = {}
|
res = {}
|
||||||
currency_obj = self.pool.get('res.currency')
|
currency_obj = self.pool.get('res.currency')
|
||||||
company_amount = currency_obj.compute(cr, uid, currency, cmpny_currency, amount)
|
company_amount = currency_obj.compute(cr, uid, currency, cmpny_currency, amount)
|
||||||
|
@ -407,33 +406,33 @@ class payment_line(osv.osv):
|
||||||
return {'value': res}
|
return {'value': res}
|
||||||
|
|
||||||
def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
|
def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
|
||||||
data={}
|
data = {}
|
||||||
partner_zip_obj = self.pool.get('res.partner.zip')
|
partner_zip_obj = self.pool.get('res.partner.zip')
|
||||||
partner_obj = self.pool.get('res.partner')
|
partner_obj = self.pool.get('res.partner')
|
||||||
payment_mode_obj = self.pool.get('payment.mode')
|
payment_mode_obj = self.pool.get('payment.mode')
|
||||||
data['info_partner']=data['bank_id']=False
|
data['info_partner'] = data['bank_id'] = False
|
||||||
|
|
||||||
if partner_id:
|
if partner_id:
|
||||||
part_obj=partner_obj.browse(cr, uid, partner_id)
|
part_obj = partner_obj.browse(cr, uid, partner_id)
|
||||||
partner=part_obj.name or ''
|
partner = part_obj.name or ''
|
||||||
|
|
||||||
if part_obj.address:
|
if part_obj.address:
|
||||||
for ads in part_obj.address:
|
for ads in part_obj.address:
|
||||||
if ads.type=='default':
|
if ads.type == 'default':
|
||||||
st=ads.street and ads.street or ''
|
st = ads.street and ads.street or ''
|
||||||
st1=ads.street2 and ads.street2 or ''
|
st1 = ads.street2 and ads.street2 or ''
|
||||||
|
|
||||||
if 'zip_id' in ads:
|
if 'zip_id' in ads:
|
||||||
zip_city= ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
zip_city = ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
||||||
else:
|
else:
|
||||||
zip=ads.zip and ads.zip or ''
|
zip = ads.zip and ads.zip or ''
|
||||||
city= ads.city and ads.city or ''
|
city = ads.city and ads.city or ''
|
||||||
zip_city= zip + ' ' + city
|
zip_city = zip + ' ' + city
|
||||||
|
|
||||||
cntry= ads.country_id and ads.country_id.name or ''
|
cntry = ads.country_id and ads.country_id.name or ''
|
||||||
info=partner + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
|
info = partner + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
|
||||||
|
|
||||||
data['info_partner']=info
|
data['info_partner'] = info
|
||||||
|
|
||||||
if part_obj.bank_ids and payment_type:
|
if part_obj.bank_ids and payment_type:
|
||||||
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type, context=context)
|
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type, context=context)
|
||||||
|
@ -449,7 +448,6 @@ class payment_line(osv.osv):
|
||||||
res['communication2'].setdefault('states', {})
|
res['communication2'].setdefault('states', {})
|
||||||
res['communication2']['states']['structured'] = [('readonly', True)]
|
res['communication2']['states']['structured'] = [('readonly', True)]
|
||||||
res['communication2']['states']['normal'] = [('readonly', False)]
|
res['communication2']['states']['normal'] = [('readonly', False)]
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
payment_line()
|
payment_line()
|
||||||
|
|
|
@ -36,7 +36,6 @@ class payment_order(report_sxw.rml_parse):
|
||||||
'get_amount_total_in_currency': self._get_amount_total_in_currency,
|
'get_amount_total_in_currency': self._get_amount_total_in_currency,
|
||||||
'get_amount_total': self._get_amount_total,
|
'get_amount_total': self._get_amount_total,
|
||||||
'get_account_name': self._get_account_name,
|
'get_account_name': self._get_account_name,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
def _get_invoice_name(self, invoice_id):
|
def _get_invoice_name(self, invoice_id):
|
||||||
|
|
Loading…
Reference in New Issue