Merge lp:~openerp-dev/openobject-addons/7.0-analytic-sale-stock-mat into lp:openobject-addons/7.0

Proposed by Martin Trigaux (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-analytic-sale-stock-mat
Merge into: lp:openobject-addons/7.0
Diff against target: 109 lines (+94/-0)
3 files modified
sale_stock_analytics/__init__.py (+26/-0)
sale_stock_analytics/__openerp__.py (+36/-0)
sale_stock_analytics/sale_stock_analytics.py (+32/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-analytic-sale-stock-mat
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+196860@code.launchpad.net

Description of the change

Adding module sale_stock_analytics

To post a comment you must log in.

Unmerged revisions

9651. By Martin Trigaux (OpenERP)

[ADD] sale_stock_analytics

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'sale_stock_analytics'
2=== added file 'sale_stock_analytics/__init__.py'
3--- sale_stock_analytics/__init__.py 1970-01-01 00:00:00 +0000
4+++ sale_stock_analytics/__init__.py 2013-11-27 10:56:04 +0000
5@@ -0,0 +1,26 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2013-today OpenERP SA (<http://www.openerp.com>)
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+#----------------------------------------------------------
28+# Init Sales
29+#----------------------------------------------------------
30+
31+import sale_stock_analytics
32
33=== added file 'sale_stock_analytics/__openerp__.py'
34--- sale_stock_analytics/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ sale_stock_analytics/__openerp__.py 2013-11-27 10:56:04 +0000
36@@ -0,0 +1,36 @@
37+# -*- coding: utf-8 -*-
38+##############################################################################
39+#
40+# OpenERP, Open Source Management Solution
41+# Copyright (C) 2013-today OpenERP SA (<http://www.openerp.com>)
42+#
43+# This program is free software: you can redistribute it and/or modify
44+# it under the terms of the GNU Affero General Public License as
45+# published by the Free Software Foundation, either version 3 of the
46+# License, or (at your option) any later version
47+#
48+# This program is distributed in the hope that it will be useful,
49+# but WITHOUT ANY WARRANTY; without even the implied warranty of
50+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51+# GNU Affero General Public License for more details
52+#
53+# You should have received a copy of the GNU Affero General Public License
54+# along with this program. If not, see <http://www.gnu.org/licenses/>
55+#
56+##############################################################################
57+
58+{
59+ 'name': 'Sales Stock Analytics',
60+ 'version': '1.0',
61+ 'category': 'Sales Management',
62+ 'description': """
63+The base module to manage analytic distribution and sales orders.
64+=================================================================
65+
66+Using this module you will be able to link analytic accounts to sales orders.
67+ """,
68+ 'author': 'OpenERP SA',
69+ 'website': 'http://www.openerp.com',
70+ 'depends': ['sale_stock', 'sale_analytic_plans'],
71+ 'auto_install': True,
72+}
73
74=== added file 'sale_stock_analytics/sale_stock_analytics.py'
75--- sale_stock_analytics/sale_stock_analytics.py 1970-01-01 00:00:00 +0000
76+++ sale_stock_analytics/sale_stock_analytics.py 2013-11-27 10:56:04 +0000
77@@ -0,0 +1,32 @@
78+# -*- coding: utf-8 -*-
79+##############################################################################
80+#
81+# OpenERP, Open Source Management Solution
82+# Copyright (C) 2013-today OpenERP SA (<http://www.openerp.com>)
83+#
84+# This program is free software: you can redistribute it and/or modify
85+# it under the terms of the GNU Affero General Public License as
86+# published by the Free Software Foundation, either version 3 of the
87+# License, or (at your option) any later version
88+#
89+# This program is distributed in the hope that it will be useful,
90+# but WITHOUT ANY WARRANTY; without even the implied warranty of
91+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92+# GNU Affero General Public License for more details
93+#
94+# You should have received a copy of the GNU Affero General Public License
95+# along with this program. If not, see <http://www.gnu.org/licenses/>
96+#
97+##############################################################################
98+
99+from openerp.osv import osv
100+
101+class stock_picking(osv.Model):
102+ _inherit = 'stock.picking'
103+
104+ def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
105+ '''Call after the creation of the invoice line'''
106+ invoice_line_obj = self.pool.get('account.invoice.line')
107+ analytic_id = move_line.sale_line_id and move_line.sale_line_id.analytics_id and move_line.sale_line_id.analytics_id.id or False
108+ invoice_line_obj.write(cr, uid, invoice_line_id, {'analytics_id': analytic_id })
109+ return super(stock_picking, self)._invoice_line_hook(cr, uid, move_line, invoice_line_id)