From 6dcbe85a0e8dfc1de2ebab2781e4b42da4964a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?= Date: Fri, 12 Aug 2011 14:53:16 +0200 Subject: [PATCH 01/46] [ADD] Commit of the modules used by C2C to move in our new public branch (lp:c2c-addons/6.1 rev 2) --- project_billing_utils/__init__.py | 28 +++++++ project_billing_utils/__openerp__.py | 54 +++++++++++++ project_billing_utils/analytic_account.py | 43 ++++++++++ project_billing_utils/invoice_view.xml | 12 +++ project_billing_utils/project_view.xml | 12 +++ project_billing_utils/wizard/__init__.py | 28 +++++++ project_billing_utils/wizard/associate_aal.py | 65 ++++++++++++++++ .../wizard/associate_aal_view.xml | 30 +++++++ .../wizard/dissociate_aal.py | 56 +++++++++++++ .../wizard/dissociate_aal_view.xml | 29 +++++++ project_billing_utils/wizard/open_invoices.py | 78 +++++++++++++++++++ .../wizard/open_invoices_view.xml | 40 ++++++++++ 12 files changed, 475 insertions(+) create mode 100755 project_billing_utils/__init__.py create mode 100755 project_billing_utils/__openerp__.py create mode 100644 project_billing_utils/analytic_account.py create mode 100644 project_billing_utils/invoice_view.xml create mode 100644 project_billing_utils/project_view.xml create mode 100755 project_billing_utils/wizard/__init__.py create mode 100644 project_billing_utils/wizard/associate_aal.py create mode 100644 project_billing_utils/wizard/associate_aal_view.xml create mode 100644 project_billing_utils/wizard/dissociate_aal.py create mode 100644 project_billing_utils/wizard/dissociate_aal_view.xml create mode 100644 project_billing_utils/wizard/open_invoices.py create mode 100644 project_billing_utils/wizard/open_invoices_view.xml diff --git a/project_billing_utils/__init__.py b/project_billing_utils/__init__.py new file mode 100755 index 0000000..8c435d8 --- /dev/null +++ b/project_billing_utils/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +############################################################################## +# @author Joel Grand-Guillaume +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import analytic_account +import wizard diff --git a/project_billing_utils/__openerp__.py b/project_billing_utils/__openerp__.py new file mode 100755 index 0000000..cf57122 --- /dev/null +++ b/project_billing_utils/__openerp__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# @author J Grand-Guillaume +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +{ + "name" : "Analytic and project wizard for services companies", + "description" : """ +Improve the view of analytic and timesheet lines for the project manager +Add wizard to manage project and invoicing : + - Associate Analytic Lines to invoice (from an invoice or from analytic line directly) + - Dissociate Analytic Lines from an invoice + - Get all invoice from Project (with recurssion in child account) + - Get Analytic Lines from project (with recurssion in child account) + - Get Analytic Lines from an invoice for controlling + + """, + "version" : "1.4", + "author" : "Camptocamp", + "category" : "Generic Modules/Projects & Services", + "website": "http://www.camptocamp.com", + "depends" : ["project", "hr_timesheet_invoice"], + "init_xml" : [], + "update_xml" : [ + "invoice_view.xml", + "project_view.xml", + "wizard/associate_aal_view.xml", + "wizard/dissociate_aal_view.xml", + "wizard/open_invoices_view.xml", + ], + "active": False, + "installable": True +} diff --git a/project_billing_utils/analytic_account.py b/project_billing_utils/analytic_account.py new file mode 100644 index 0000000..46c6da5 --- /dev/null +++ b/project_billing_utils/analytic_account.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) +# All Right Reserved +# +# Author : Joel Grand-guillaume (Camptocamp) +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +from osv import osv, fields + + +class account_analytic_account(osv.osv): + + _inherit = 'account.analytic.account' + _description = 'Analytic Account' + + _columns = { + 'project_ids': fields.one2many('project.project', 'analytic_account_id', 'Projects'), + } + +account_analytic_account() diff --git a/project_billing_utils/invoice_view.xml b/project_billing_utils/invoice_view.xml new file mode 100644 index 0000000..25f1ad0 --- /dev/null +++ b/project_billing_utils/invoice_view.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/project_billing_utils/project_view.xml b/project_billing_utils/project_view.xml new file mode 100644 index 0000000..27f0997 --- /dev/null +++ b/project_billing_utils/project_view.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/project_billing_utils/wizard/__init__.py b/project_billing_utils/wizard/__init__.py new file mode 100755 index 0000000..677b1fe --- /dev/null +++ b/project_billing_utils/wizard/__init__.py @@ -0,0 +1,28 @@ +############################################################################## +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import associate_aal +import dissociate_aal +import open_invoices + diff --git a/project_billing_utils/wizard/associate_aal.py b/project_billing_utils/wizard/associate_aal.py new file mode 100644 index 0000000..a029c95 --- /dev/null +++ b/project_billing_utils/wizard/associate_aal.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author Joel Grand-Guillaume. Copyright Camptocamp SA +# +############################################################################## +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + + +from osv import fields, osv +from tools.translate import _ + + +class AssociateInvoice(osv.osv_memory): + _name = 'associate.aal.to.invoice' + _description = 'Associate Analytic Lines' + + _columns = { + 'invoice_id': fields.many2one('account.invoice','Invoice', required=True), + } + + def associate_aal(self, cr, uid, ids, context): + aal_obj = self.pool.get('account.analytic.line') + aal_ids = context.get('active_ids', False) + if isinstance(ids, list): + req_id = ids[0] + else: + req_id = ids + current = self.browse(cr, uid, req_id, context) + aal_obj.write(cr,uid,aal_ids,{"invoice_id":current.invoice_id.id},context) + + # view_id = self.pool.get('ir.ui.view').search(cursor, uid, [('name', '=', )]) + return { + 'domain': "[('id','in', [%s])]" % (current.invoice_id.id,), + 'name': 'Associated invoice', + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'account.invoice', + 'view_id': False, + 'context': context, + 'type': 'ir.actions.act_window', + } + +AssociateInvoice() \ No newline at end of file diff --git a/project_billing_utils/wizard/associate_aal_view.xml b/project_billing_utils/wizard/associate_aal_view.xml new file mode 100644 index 0000000..00da6d2 --- /dev/null +++ b/project_billing_utils/wizard/associate_aal_view.xml @@ -0,0 +1,30 @@ + + + + + + Associate To Invoice + associate.aal.to.invoice + form + +
+ + +