Add module account_invoice_picking_label.
This commit is contained in:
23
account_invoice_picking_label/__init__.py
Normal file
23
account_invoice_picking_label/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Invoice Picking Label module for OpenERP
|
||||
# Copyright (C) 2013-2014 Akretion
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import account_invoice
|
||||
42
account_invoice_picking_label/__openerp__.py
Normal file
42
account_invoice_picking_label/__openerp__.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Invoice Picking Label module for OpenERP
|
||||
# Copyright (C) 2014 Akretion
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Account Invoice Picking Label',
|
||||
'version': '0.1',
|
||||
'category': 'Accounting & Finance',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Adds field picking_ids_label on account.invoice',
|
||||
'description': """
|
||||
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.""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com/',
|
||||
'depends': ['stock_account'],
|
||||
'data': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
|
||||
52
account_invoice_picking_label/account_invoice.py
Normal file
52
account_invoice_picking_label/account_invoice.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Invoice Picking Label module for OpenERP
|
||||
# Copyright (C) 2013-2014 Akretion
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class account_invoice(orm.Model):
|
||||
_inherit = "account.invoice"
|
||||
|
||||
def _compute_picking_ids_label(
|
||||
self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for invoice in self.read(
|
||||
cr, uid, ids, ['picking_ids'], context=context):
|
||||
label = ''
|
||||
if invoice['picking_ids']:
|
||||
pickings = self.pool['stock.picking'].read(
|
||||
cr, uid, invoice['picking_ids'], ['name'],
|
||||
context=context)
|
||||
first = True
|
||||
for picking in pickings:
|
||||
if first:
|
||||
label += picking['name']
|
||||
first = False
|
||||
else:
|
||||
label += ', %s' % picking['name']
|
||||
res[invoice['id']] = label
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'picking_ids_label': fields.function(
|
||||
_compute_picking_ids_label, type='char', string='Pickings'),
|
||||
}
|
||||
Reference in New Issue
Block a user