Fix bug #5 fix dependency for account_invoice_picking_label

Also clean-up the code of that module
This commit is contained in:
Alexis de Lattre
2017-10-13 16:52:28 +02:00
parent 3888495071
commit 8c0717db2f
2 changed files with 4 additions and 10 deletions

View File

@@ -34,9 +34,6 @@ Account Invoice Picking Label
Adds a function field named *picking_ids_label* on invoices. This field contains the list of pickings related to the invoice as a string. This field is designed to be displayed in the invoice report.""", Adds a function field named *picking_ids_label* on invoices. This field contains the list of pickings related to the invoice as a string. This field is designed to be displayed in the invoice report.""",
'author': 'Akretion', 'author': 'Akretion',
'website': 'http://www.akretion.com/', 'website': 'http://www.akretion.com/',
'depends': ['stock_account'], 'depends': ['stock_picking_invoice_link'],
'data': [],
'installable': True, 'installable': True,
'active': False,
} }

View File

@@ -36,13 +36,10 @@ class account_invoice(orm.Model):
pickings = self.pool['stock.picking'].read( pickings = self.pool['stock.picking'].read(
cr, uid, invoice['picking_ids'], ['name'], cr, uid, invoice['picking_ids'], ['name'],
context=context) context=context)
first = True pick_names = []
for picking in pickings: for picking in pickings:
if first: pick_names.append(picking['name'])
label += picking['name'] label = ','.join(pick_names)
first = False
else:
label += ', %s' % picking['name']
res[invoice['id']] = label res[invoice['id']] = label
return res return res