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
=== added directory 'account_invoice_purchase_origin'
=== added file 'account_invoice_purchase_origin/__init__.py'
--- account_invoice_purchase_origin/__init__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_purchase_origin/__init__.py 2013-12-12 22:36:17 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import purchase
023
=== added file 'account_invoice_purchase_origin/__openerp__.py'
--- account_invoice_purchase_origin/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_purchase_origin/__openerp__.py 2013-12-12 22:36:17 +0000
@@ -0,0 +1,42 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{
23 'name': 'Account Invoice Purchase Origin',
24 'version': '1.1',
25 'category': 'Finance',
26 'description': """
27 This module displays the origin field of account invoice lines and populate
28 them when an invoice is created from a purchase order
29 """,
30 'author': 'Savoir-faire Linux',
31 'website': 'http://www.savoirfairelinux.com/',
32 'depends': ['account', 'purchase'],
33 'data': [
34 'account_invoice_view.xml',
35 ],
36 'test': [
37 ],
38 'demo': [],
39 'installable': True,
40 'active': False,
41 'certificate': False,
42}
043
=== added file 'account_invoice_purchase_origin/account_invoice_view.xml'
--- account_invoice_purchase_origin/account_invoice_view.xml 1970-01-01 00:00:00 +0000
+++ account_invoice_purchase_origin/account_invoice_view.xml 2013-12-12 22:36:17 +0000
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="view_invoice_line_tree" model="ir.ui.view">
5 <field name="model">account.invoice</field>
6 <field name="inherit_id" ref="account.invoice_supplier_form" />
7 <field name="arch" type="xml">
8 <xpath expr="//tree//field[@name='account_analytic_id']" position="after">
9 <field name="origin" readonly="1" />
10 </xpath>
11 </field>
12 </record>
13 </data>
14</openerp>
015
=== added file 'account_invoice_purchase_origin/purchase.py'
--- account_invoice_purchase_origin/purchase.py 1970-01-01 00:00:00 +0000
+++ account_invoice_purchase_origin/purchase.py 2013-12-12 22:36:17 +0000
@@ -0,0 +1,42 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import orm
23
24
25class purchase_order(orm.Model):
26
27 _inherit = 'purchase.order'
28
29 def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
30
31 return {
32 'name': order_line.name,
33 'account_id': account_id,
34 'price_unit': order_line.price_unit or 0.0,
35 'origin': order_line.order_id.name,
36 'quantity': order_line.product_qty,
37 'product_id': order_line.product_id.id or False,
38 'uos_id': order_line.product_uom.id or False,
39 'invoice_line_tax_id': [(6, 0, [x.id\
40 for x in order_line.taxes_id])],
41 'account_analytic_id': order_line.account_analytic_id.id or False,
42 }

Subscribers

People subscribed via source and target branches