[IMP] rename pay_type field to advance_payment_method

bzr revid: tpa@tinyerp.com-20120514112614-xc6dk5irsbmvr9ml
This commit is contained in:
Turkesh Patel (Open ERP) 2012-05-14 16:56:14 +05:30
parent d760265c30
commit e92d187b4c
2 changed files with 8 additions and 8 deletions

View File

@ -39,20 +39,20 @@ class sale_advance_payment_inv(osv.osv_memory):
help="Select a product of type service which is called 'Advance Product'. You may have to create it and set it as a default value on this field."),
'amount': fields.float('Advance Amount', digits=(16, 2), required=True, help="The amount to be invoiced in advance."),
'qtty': fields.float('Quantity', digits=(16, 2), required=True),
'pay_type':fields.selection([('percentage','Percentage'), ('fixed','Fixed Price')], 'Pay Type', required=True),
'advance_payment_method':fields.selection([('percentage','Percentage'), ('fixed','Fixed Price')], 'Pay Type', required=True),
'advance': fields.boolean('Advance'),
}
_defaults = {
'qtty': 1.0,
'pay_type': 'fixed',
'advance_payment_method': 'fixed',
'product_id': _default_product_id,
}
def onchange_pay_type(self, cr, uid, ids, pay_type,product_id, context=None):
def onchange_advance_payment_method(self, cr, uid, ids, advance_payment_method,product_id, context=None):
if not product_id:
return {'value': {'amount': 0}}
if pay_type == 'percentage':
if advance_payment_method == 'percentage':
return {'value': {'amount':0,'product_id':False }}
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
return {'value': {'amount':product.list_price}}
@ -126,7 +126,7 @@ class sale_advance_payment_inv(osv.osv_memory):
raise osv.except_osv(_('Data Insufficient !'),
_('Please check the Advance Amount, it should not be 0 or less!'))
else:
if sale_adv_obj.pay_type == 'percentage':
if sale_adv_obj.advance_payment_method == 'percentage':
final_amount = sale.amount_total * sale_adv_obj.amount / 100
if not res.get('name'):
res['name'] = "Advance of %s"%(final_amount)
@ -182,7 +182,7 @@ class sale_advance_payment_inv(osv.osv_memory):
if sale.order_policy == 'picking':
vals = {
'order_id': sale.id,
'name': res.get('name') or ("%s %s %s "%(sale_adv_obj.amount,sale_adv_obj.pay_type,"Advance.")),
'name': res.get('name') or ("%s %s %s "%(sale_adv_obj.amount,sale_adv_obj.advance_payment_method,"Advance.")),
'price_unit': -final_amount,
'product_uom_qty': sale_adv_obj.qtty or 1.0,
'product_uos_qty': sale_adv_obj.qtty or 1.0,

View File

@ -8,13 +8,13 @@
<field name="arch" type="xml">
<form string="Advance Invoice">
<group colspan="2">
<field name="product_id" on_change="onchange_advance_product(product_id)" context="{'search_default_services':1}" attrs="{'invisible': [('pay_type','=','percentage')]}" />
<field name="product_id" on_change="onchange_advance_product(product_id)" context="{'search_default_services':1}" attrs="{'invisible': [('advance_payment_method','=','percentage')]}" />
</group>
<newline />
<group colspan="2" col="6">
<field name="qtty" invisible="1"/>
<field name="amount"/>
<field name="pay_type" nolabel="1" attrs="{'readonly':[('advance','=','True')]}" on_change="onchange_pay_type(pay_type,product_id)"/>
<field name="advance_payment_method" nolabel="1" attrs="{'readonly':[('advance','=','True')]}" on_change="onchange_advance_payment_method(advance_payment_method,product_id)"/>
<field name="advance" invisible="1"/>
</group>
<newline />