Merge lp:~camptocamp/department-mgmt/7.0-port-invoice_department into lp:~department-core-editors/department-mgmt/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 12
Proposed branch: lp:~camptocamp/department-mgmt/7.0-port-invoice_department
Merge into: lp:~department-core-editors/department-mgmt/7.0
Diff against target: 345 lines (+136/-163)
4 files modified
invoice_department/__init__.py (+17/-25)
invoice_department/__openerp__.py (+33/-44)
invoice_department/invoice.py (+31/-35)
invoice_department/invoice_view.xml (+55/-59)
To merge this branch: bzr merge lp:~camptocamp/department-mgmt/7.0-port-invoice_department
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no test Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+162132@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'invoice_department/__init__.py'
--- invoice_department/__init__.py 2011-08-12 13:27:15 +0000
+++ invoice_department/__init__.py 2013-05-02 15:54:00 +0000
@@ -1,31 +1,23 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com) 4# Author: Joël Grand-guillaume (Camptocamp)
5# All Right Reserved5# Copyright 2010 Camptocamp SA
6#6#
7# Author : Joel Grand-guillaume (Camptocamp)7# This program is free software: you can redistribute it and/or modify
8#8# it under the terms of the GNU Affero General Public License as
9# WARNING: This program as such is intended to be used by professional9# published by the Free Software Foundation, either version 3 of the
10# programmers who take the whole responsability of assessing all potential10# License, or (at your option) any later version.
11# consequences resulting from its eventual inadequacies and bugs11#
12# End users who are looking for a ready-to-use solution with commercial12# This program is distributed in the hope that it will be useful,
13# garantees and support are strongly adviced to contract a Free Software13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# Service Company14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15#15# GNU Affero General Public License for more details.
16# This program is Free Software; you can redistribute it and/or16#
17# modify it under the terms of the GNU General Public License17# You should have received a copy of the GNU Affero General Public License
18# as published by the Free Software Foundation; either version 218# along with this program. If not, see <http://www.gnu.org/licenses/>.
19# of the License, or (at your option) any later version.
20#
21# This program is distributed in the hope that it will be useful,
22# but WITHOUT ANY WARRANTY; without even the implied warranty of
23# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24# GNU General Public License for more details.
25#
26# You should have received a copy of the GNU General Public License
27# along with this program; if not, write to the Free Software
28# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29#19#
30##############################################################################20##############################################################################
31import invoice21import invoice
22
23# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3224
=== modified file 'invoice_department/__openerp__.py'
--- invoice_department/__openerp__.py 2013-01-04 10:32:58 +0000
+++ invoice_department/__openerp__.py 2013-05-02 15:54:00 +0000
@@ -1,53 +1,42 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com) 4# Author: Joël Grand-guillaume (Camptocamp)
5# All Right Reserved5# Copyright 2010 Camptocamp SA
6#6#
7# Author : Joel Grand-guillaume (Camptocamp)7# This program is free software: you can redistribute it and/or modify
8#8# it under the terms of the GNU Affero General Public License as
9# WARNING: This program as such is intended to be used by professional9# published by the Free Software Foundation, either version 3 of the
10# programmers who take the whole responsability of assessing all potential10# License, or (at your option) any later version.
11# consequences resulting from its eventual inadequacies and bugs11#
12# End users who are looking for a ready-to-use solution with commercial12# This program is distributed in the hope that it will be useful,
13# garantees and support are strongly adviced to contract a Free Software13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# Service Company14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15#15# GNU Affero General Public License for more details.
16# This program is Free Software; you can redistribute it and/or16#
17# modify it under the terms of the GNU General Public License17# You should have received a copy of the GNU Affero General Public License
18# as published by the Free Software Foundation; either version 218# along with this program. If not, see <http://www.gnu.org/licenses/>.
19# of the License, or (at your option) any later version.
20#
21# This program is distributed in the hope that it will be useful,
22# but WITHOUT ANY WARRANTY; without even the implied warranty of
23# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24# GNU General Public License for more details.
25#
26# You should have received a copy of the GNU General Public License
27# along with this program; if not, write to the Free Software
28# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29#19#
30##############################################################################20##############################################################################
3121
32{22{
33 "name" : "Invoices with Department Categorization",23 'name' : 'Invoices with Department Categorization',
34 "version" : "1.0",24 'version' : '1.0',
35 "author" : "Camptocamp",25 'category' : 'Generic Modules/Sales & Purchases',
36 "category" : "Generic Modules/Sales & Purchases",26 'description':
37 "description":27'''
38"""Add the department on Invoices.28 Add the department on Invoices as well as the related filter and button in the search form.
3929
40The views are adapted to use the information in the search form.""",30''',
41 "website": "http://camptocamp.com",31 'author' : 'Camptocamp',
42 "depends" : [32 'website': 'http://camptocamp.com',
43 "account",33 'depends' : ['account', 'hr'],
44 "hr"34 'data' : ['invoice_view.xml',],
45 ],35 'demo' : [],
46 "init_xml" : [],36 'test': [],
47 "demo_xml" : [],37 'installable': True,
48 "update_xml" : [38 'auto_install': False,
49 "invoice_view.xml",39 'application': False
50 ],
51 "active": False,
52 'installable': False
53}40}
41
42# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
5443
=== modified file 'invoice_department/invoice.py'
--- invoice_department/invoice.py 2011-08-12 13:27:15 +0000
+++ invoice_department/invoice.py 2013-05-02 15:54:00 +0000
@@ -1,45 +1,41 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) 4# Author: Joël Grand-guillaume (Camptocamp)
5# All Right Reserved5# Copyright 2010 Camptocamp SA
6#6#
7# Author : Joel Grand-guillaume (Camptocamp)7# This program is free software: you can redistribute it and/or modify
8#8# it under the terms of the GNU Affero General Public License as
9# WARNING: This program as such is intended to be used by professional9# published by the Free Software Foundation, either version 3 of the
10# programmers who take the whole responsability of assessing all potential10# License, or (at your option) any later version.
11# consequences resulting from its eventual inadequacies and bugs11#
12# End users who are looking for a ready-to-use solution with commercial12# This program is distributed in the hope that it will be useful,
13# garantees and support are strongly adviced to contract a Free Software13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# Service Company14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15#15# GNU Affero General Public License for more details.
16# This program is Free Software; you can redistribute it and/or16#
17# modify it under the terms of the GNU General Public License17# You should have received a copy of the GNU Affero General Public License
18# as published by the Free Software Foundation; either version 218# along with this program. If not, see <http://www.gnu.org/licenses/>.
19# of the License, or (at your option) any later version.
20#
21# This program is distributed in the hope that it will be useful,
22# but WITHOUT ANY WARRANTY; without even the implied warranty of
23# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24# GNU General Public License for more details.
25#
26# You should have received a copy of the GNU General Public License
27# along with this program; if not, write to the Free Software
28# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29#19#
30##############################################################################20##############################################################################
3121from openerp.osv import orm, fields
32from osv import osv22
33from osv import fields23class AccountInvoice(orm.Model):
34
35class account_invoice(osv.osv):
36 _inherit = "account.invoice"24 _inherit = "account.invoice"
37
38 _columns = {25 _columns = {
39 'department_id': fields.many2one('hr.department', 'Department'),26 'department_id': fields.many2one('hr.department', 'Department'),
40 }27 }
28
29 def _get_department(self, cr, uid, ids, context=None):
30 employee_obj = self.pool.get('hr.employee')
31 department_id = False
32 employee_ids = employee_obj.search(cr, uid, [('user_id','=', uid)])
33 if employee_ids:
34 department_id = employee_obj.browse(cr, uid, employee_ids[0], context=context).department_id.id
35 return department_id
36
41 _defaults = {37 _defaults = {
42 'department_id': lambda s,cr,uid,c: s.pool.get('res.users').browse(cr,uid,uid).context_department_id.id,38 'department_id': _get_department,
43 }39 }
4440
45account_invoice()41# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4642
=== modified file 'invoice_department/invoice_view.xml'
--- invoice_department/invoice_view.xml 2011-08-12 13:27:15 +0000
+++ invoice_department/invoice_view.xml 2013-05-02 15:54:00 +0000
@@ -1,60 +1,56 @@
1<?xml version="1.0" encoding="utf-8"?>
1<openerp>2<openerp>
2 <data>
3 <record id="invoice_tree" model="ir.ui.view">
4 <field name="name">account.invoice.tree</field>
5 <field name="model">account.invoice</field>
6 <field name="inherit_id" ref="account.invoice_tree" />
7 <field name="type">tree</field>
8 <field name="arch" type="xml">
9 <xpath expr="/tree/field[@name='company_id']" position="before">
10 <field name="department_id" />
11 </xpath>
12 </field>
13 </record>
14
15 <record id="invoice_form" model="ir.ui.view">
16 <field name="name">account.invoice.form</field>
17 <field name="model">account.invoice</field>
18 <field name="inherit_id" ref="account.invoice_form" />
19 <field name="type">form</field>
20 <field name="arch" type="xml">
21 <xpath expr="/form/notebook/page[@string='Other Info']/field[@name='company_id']" position="before">
22 <field name="department_id" widget="selection"/>
23 </xpath>
24 </field>
25 </record>
26
27 <record id="view_account_invoice_filter" model="ir.ui.view">
28 <field name="name">account.invoice.select</field>
29 <field name="model">account.invoice</field>
30 <field name="inherit_id" ref="account.view_account_invoice_filter" />
31 <field name="type">search</field>
32 <field name="arch" type="xml">
33 <xpath expr="/search/group[2]" position="replace">
34 <group col="10" colspan="4">
35 <field name="journal_id" widget="selection" select='1'/>
36 <field name="department_id" select="1" widget="selection"/>
37 <field name="period_id" select='1' string="Period"/>
38 </group>
39 </xpath>
40 <xpath expr="/search/group/filter[@string='Partner']" position="after">
41 <filter string="Department" icon="terp-folder-orange" domain="[]" context="{'group_by':'department_id'}"/>
42 </xpath>
43 </field>
44 </record>
45
46 <record id="invoice_supplier_form" model="ir.ui.view">
47 <field name="name">account.invoice.supplier.form</field>
48 <field name="model">account.invoice</field>
49 <field name="inherit_id" ref="account.invoice_supplier_form" />
50 <field name="type">form</field>
51 <field name="priority">2</field>
52 <field name="arch" type="xml">
53 <xpath expr="/form/notebook/page[@string='Other Info']/field[@name='company_id']" position="before">
54 <field name="department_id" widget="selection"/>
55 </xpath>
56 </field>
57 </record>
58
59 </data>
60</openerp>
61\ No newline at end of file3\ No newline at end of file
4 <data>
5
6 <record id="invoice_tree" model="ir.ui.view">
7 <field name="name">account.invoice.tree</field>
8 <field name="model">account.invoice</field>
9 <field name="inherit_id" ref="account.invoice_tree" />
10 <field name="arch" type="xml">
11 <field name="company_id" position="before">
12 <field name="department_id" />
13 </field>
14 </field>
15 </record>
16
17 <record id="invoice_form" model="ir.ui.view">
18 <field name="name">account.invoice.form</field>
19 <field name="model">account.invoice</field>
20 <field name="inherit_id" ref="account.invoice_form" />
21 <field name="arch" type="xml">
22 <field name="company_id" position="before">
23 <field name="department_id" widget="selection"/>
24 </field>
25 </field>
26 </record>
27
28 <record id="view_account_invoice_filter" model="ir.ui.view">
29 <field name="name">account.invoice.select</field>
30 <field name="model">account.invoice</field>
31 <field name="inherit_id" ref="account.view_account_invoice_filter" />
32 <field name="arch" type="xml">
33 <field name="period_id" position="replace">
34 <field name="journal_id" widget="selection"/>
35 <field name="department_id" widget="selection"/>
36 <field name="period_id" string="Period"/>
37 </field>
38 <filter string="Partner" position="after">
39 <filter string="Department" icon="terp-folder-orange" domain="[]" context="{'group_by':'department_id'}"/>
40 </filter>
41 </field>
42 </record>
43
44 <record id="invoice_supplier_form" model="ir.ui.view">
45 <field name="name">account.invoice.supplier.form</field>
46 <field name="model">account.invoice</field>
47 <field name="inherit_id" ref="account.invoice_supplier_form" />
48 <field name="priority">2</field>
49 <field name="arch" type="xml">
50 <field name="company_id" position="before">
51 <field name="department_id" widget="selection"/>
52 </field>
53 </field>
54 </record>
55
56 </data>
57</openerp>

Subscribers

People subscribed via source and target branches