← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin into lp:account-invoicing

 

David Cormier (Savoir-faire Linux) has proposed merging lp:~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin into lp:account-invoicing.

Requested reviews:
  Account Core Editors (account-core-editors)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin/+merge/198321

Adds a module to display origin document in all supplier invoice lines and populate the invoice line origin document when purchases are confirmed
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin/+merge/198321
Your team Account Core Editors is requested to review the proposed merge of lp:~savoirfairelinux-openerp/account-invoicing/account_invoice_purchase_origin into lp:account-invoicing.
=== 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-09 22:49:33 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
+#
+#    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/>.
+#
+##############################################################################
+
+import purchase

=== 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-09 22:49:33 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
+#
+#    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 Purchase Origin',
+    'version': '1.0',
+    'category': 'Finance',
+    'description': """
+    This module displays the origin field of account invoice lines and populate
+    them when an invoice is created from a purchase order
+    """,
+    'author': 'Savoir-faire Linux',
+    'website': 'http://www.savoirfairelinux.com/',
+    'depends': ['account', 'purchase'],
+    'data': [
+        'account_invoice_view.xml',
+    ],
+    'test': [
+    ],
+    'demo': [],
+    'installable': True,
+    'active': False,
+    'certificate': False,
+}

=== 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-09 22:49:33 +0000
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <record id="view_invoice_line_tree" model="ir.ui.view">
+      <field name="model">account.invoice</field>
+      <field name="inherit_id" ref="account.invoice_supplier_form" />
+      <field name="arch" type="xml">
+        <xpath expr="//tree//field[@name='account_analytic_id']" position="replace">
+          <field name="origin" readonly="1" />
+        </xpath>
+      </field>
+    </record>
+  </data>
+</openerp>

=== 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-09 22:49:33 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
+#
+#    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 osv import osv
+
+
+class purchase_order(osv.osv):
+
+    _inherit = 'purchase.order'
+
+    def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
+
+        return {
+            'name': order_line.name,
+            'account_id': account_id,
+            'price_unit': order_line.price_unit or 0.0,
+            'origin': order_line.order_id.name,
+            'quantity': order_line.product_qty,
+            'product_id': order_line.product_id.id or False,
+            'uos_id': order_line.product_uom.id or False,
+            'invoice_line_tax_id': [(6, 0, [x.id for x in order_line.taxes_id])],
+            'account_analytic_id': order_line.account_analytic_id.id or False,
+        }
+


Follow ups