Merge lp:~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin into lp:~account-core-editors/account-invoicing/7.0

Proposed by David Cormier
Status: Work in progress
Proposed branch: lp:~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 140 lines (+120/-0)
4 files modified
account_invoice_purchase_origin/__init__.py (+22/-0)
account_invoice_purchase_origin/__openerp__.py (+42/-0)
account_invoice_purchase_origin/account_invoice_view.xml (+14/-0)
account_invoice_purchase_origin/purchase.py (+42/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Approve
Review via email: mp+198321@code.launchpad.net

Description of the change

Adds a module to display origin document in all supplier invoice lines and populate the invoice line origin document when purchases are confirmed

To post a comment you must log in.
25. By David Cormier

[FIX] After account_analytic_id rather than replace

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, David, thanks for the contribution. Could you please follow community conventions for the code (http://pad.openerp.com/p/community-review):

- orm.Model instead of osv.osv.
- from . import xxx on __init__.py.
- 'from openerp.osv import orm, fields' instead of 'from osv import osv, fields'
- etc

Regards.

review: Needs Fixing (code review)
26. By David Cormier

[FIX] Apply community conventions

Revision history for this message
David Cormier (david-cormier-j) wrote :

Thanks for the input Pedro. I have read the convention and made the following changes:

* Changed from osv import osv to from openerp.osv import orm
* Relative inputs in __init__.py
* Fixed pep8 error in purchase.py

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, David,

Seeing the code, I think you can follow better coding conventions to allow minimal changes on future versions:

- On _prepare_inv_line method, you should call super method, and extend returned dictionary instead of overriding full method.
- On the view definition, it's better to use <field name="xxx" position="yyy"> instead of xpath expression.

Regards.

review: Needs Fixing
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I set this MP as Work in progress as it is in "Needs Fixing" since weeks. Please set it back to "Need Review" once you think you are done.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/account-invoicing. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

26. By David Cormier

[FIX] Apply community conventions

25. By David Cormier

[FIX] After account_analytic_id rather than replace

24. By David Cormier

[NEW] Add account_invoice_purchase_origin module

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_purchase_origin'
2=== added file 'account_invoice_purchase_origin/__init__.py'
3--- account_invoice_purchase_origin/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_invoice_purchase_origin/__init__.py 2013-12-12 22:36:17 +0000
5@@ -0,0 +1,22 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+
27+import purchase
28
29=== added file 'account_invoice_purchase_origin/__openerp__.py'
30--- account_invoice_purchase_origin/__openerp__.py 1970-01-01 00:00:00 +0000
31+++ account_invoice_purchase_origin/__openerp__.py 2013-12-12 22:36:17 +0000
32@@ -0,0 +1,42 @@
33+# -*- coding: utf-8 -*-
34+##############################################################################
35+#
36+# OpenERP, Open Source Management Solution
37+# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU Affero General Public License as
41+# published by the Free Software Foundation, either version 3 of the
42+# License, or (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU Affero General Public License for more details.
48+#
49+# You should have received a copy of the GNU Affero General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+##############################################################################
53+
54+{
55+ 'name': 'Account Invoice Purchase Origin',
56+ 'version': '1.1',
57+ 'category': 'Finance',
58+ 'description': """
59+ This module displays the origin field of account invoice lines and populate
60+ them when an invoice is created from a purchase order
61+ """,
62+ 'author': 'Savoir-faire Linux',
63+ 'website': 'http://www.savoirfairelinux.com/',
64+ 'depends': ['account', 'purchase'],
65+ 'data': [
66+ 'account_invoice_view.xml',
67+ ],
68+ 'test': [
69+ ],
70+ 'demo': [],
71+ 'installable': True,
72+ 'active': False,
73+ 'certificate': False,
74+}
75
76=== added file 'account_invoice_purchase_origin/account_invoice_view.xml'
77--- account_invoice_purchase_origin/account_invoice_view.xml 1970-01-01 00:00:00 +0000
78+++ account_invoice_purchase_origin/account_invoice_view.xml 2013-12-12 22:36:17 +0000
79@@ -0,0 +1,14 @@
80+<?xml version="1.0" encoding="utf-8"?>
81+<openerp>
82+ <data>
83+ <record id="view_invoice_line_tree" model="ir.ui.view">
84+ <field name="model">account.invoice</field>
85+ <field name="inherit_id" ref="account.invoice_supplier_form" />
86+ <field name="arch" type="xml">
87+ <xpath expr="//tree//field[@name='account_analytic_id']" position="after">
88+ <field name="origin" readonly="1" />
89+ </xpath>
90+ </field>
91+ </record>
92+ </data>
93+</openerp>
94
95=== added file 'account_invoice_purchase_origin/purchase.py'
96--- account_invoice_purchase_origin/purchase.py 1970-01-01 00:00:00 +0000
97+++ account_invoice_purchase_origin/purchase.py 2013-12-12 22:36:17 +0000
98@@ -0,0 +1,42 @@
99+# -*- coding: utf-8 -*-
100+##############################################################################
101+#
102+# OpenERP, Open Source Management Solution
103+# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
104+#
105+# This program is free software: you can redistribute it and/or modify
106+# it under the terms of the GNU Affero General Public License as
107+# published by the Free Software Foundation, either version 3 of the
108+# License, or (at your option) any later version.
109+#
110+# This program is distributed in the hope that it will be useful,
111+# but WITHOUT ANY WARRANTY; without even the implied warranty of
112+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113+# GNU Affero General Public License for more details.
114+#
115+# You should have received a copy of the GNU Affero General Public License
116+# along with this program. If not, see <http://www.gnu.org/licenses/>.
117+#
118+##############################################################################
119+
120+from openerp.osv import orm
121+
122+
123+class purchase_order(orm.Model):
124+
125+ _inherit = 'purchase.order'
126+
127+ def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
128+
129+ return {
130+ 'name': order_line.name,
131+ 'account_id': account_id,
132+ 'price_unit': order_line.price_unit or 0.0,
133+ 'origin': order_line.order_id.name,
134+ 'quantity': order_line.product_qty,
135+ 'product_id': order_line.product_id.id or False,
136+ 'uos_id': order_line.product_uom.id or False,
137+ 'invoice_line_tax_id': [(6, 0, [x.id\
138+ for x in order_line.taxes_id])],
139+ 'account_analytic_id': order_line.account_analytic_id.id or False,
140+ }

Subscribers

People subscribed via source and target branches