[FIX]: Fix bug:1043181 : remove so line invoice after giving advance percentage payment
bzr revid: atp@tinyerp.com-20120911134717-vfdhltg2lno13nqf
This commit is contained in:
parent
39cbe2711e
commit
e488f9b568
|
@ -43,6 +43,26 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||
help="The amount to be invoiced in advance."),
|
||||
}
|
||||
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
|
||||
if context is None:context = {}
|
||||
user_obj = self.pool.get('res.users')
|
||||
res = super(sale_advance_payment_inv, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||
active_ids = context.get('active_ids', False)
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
model = context.get('active_model', '')
|
||||
model_obj = self.pool.get(model)
|
||||
if context.get('active_model', '') in ['sale.order'] and context.get('active_ids', []):
|
||||
order_data = model_obj.read(cr, uid, context.get('active_ids'), ['invoice_ids'])[0]
|
||||
for inv in invoice_obj.browse(cr, uid, order_data.get('invoice_ids')):
|
||||
for line in inv.invoice_line:
|
||||
# if percentage(Advance payment) is given then remove sale order lines option..
|
||||
if str(line.name).startswith("Advance of"):
|
||||
for field in res['fields']:
|
||||
if field == 'advance_payment_method':
|
||||
res['fields'][field]['selection'] = [('all', 'Invoice all the Sale Order'), ('percentage', 'Percentage'), ('fixed', 'Fixed Price'),]
|
||||
return res
|
||||
|
||||
def _get_advance_product(self, cr, uid, context=None):
|
||||
try:
|
||||
product = self.pool.get('ir.model.data').get_object(cr, uid, 'sale', 'advance_product_0')
|
||||
|
@ -93,7 +113,6 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||
'search_default_order_id': sale_ids and sale_ids[0] or False,
|
||||
}
|
||||
return res
|
||||
|
||||
assert wizard.advance_payment_method in ('fixed', 'percentage')
|
||||
|
||||
inv_ids = []
|
||||
|
|
|
@ -685,8 +685,6 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||
sale_line_obj = self.pool.get('sale.order.line')
|
||||
wizard = self.browse(cr, uid, ids[0], context)
|
||||
sale_ids = context.get('active_ids', [])
|
||||
|
||||
assert wizard.advance_payment_method in ('fixed', 'percentage')
|
||||
inv_ids = []
|
||||
for sale in sale_obj.browse(cr, uid, sale_ids, context=context):
|
||||
if sale.order_policy == 'postpaid':
|
||||
|
|
Loading…
Reference in New Issue