Merge lp:~savoirfairelinux-openerp/purchase-wkfl/purchase_profit_forecast into lp:~purchase-core-editors/purchase-wkfl/7.0

Status: Needs review
Proposed branch: lp:~savoirfairelinux-openerp/purchase-wkfl/purchase_profit_forecast
Merge into: lp:~purchase-core-editors/purchase-wkfl/7.0
Diff against target: 289 lines (+251/-0)
7 files modified
purchase_profit_forecast/__init__.py (+21/-0)
purchase_profit_forecast/__openerp__.py (+41/-0)
purchase_profit_forecast/report/__init__.py (+22/-0)
purchase_profit_forecast/report/analytic.py (+22/-0)
purchase_profit_forecast/report/purchase.py (+54/-0)
purchase_profit_forecast/report/purchase_profit_view.xml (+89/-0)
purchase_profit_forecast/security/ir.model.access.csv (+2/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/purchase-wkfl/purchase_profit_forecast
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Review via email: mp+216326@code.launchpad.net

Commit message

[ADD] Add purchase profit forecast

Description of the change

[ADD] Add purchase profit forecast

To post a comment you must log in.
22. By Mathieu Benoit

[IMP] purchase_profit_forecast: add default security access

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

This project is now hosted on https://github.com/OCA/purchase-workflow. 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

22. By Mathieu Benoit

[IMP] purchase_profit_forecast: add default security access

21. By David Cormier

[NEW] Add purchase profit forecast

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'purchase_profit_forecast'
2=== added file 'purchase_profit_forecast/__init__.py'
3--- purchase_profit_forecast/__init__.py 1970-01-01 00:00:00 +0000
4+++ purchase_profit_forecast/__init__.py 2014-05-13 17:14:17 +0000
5@@ -0,0 +1,21 @@
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+import report
27
28=== added file 'purchase_profit_forecast/__openerp__.py'
29--- purchase_profit_forecast/__openerp__.py 1970-01-01 00:00:00 +0000
30+++ purchase_profit_forecast/__openerp__.py 2014-05-13 17:14:17 +0000
31@@ -0,0 +1,41 @@
32+# -*- coding: utf-8 -*-
33+##############################################################################
34+#
35+# OpenERP, Open Source Management Solution
36+# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
37+#
38+# This program is free software: you can redistribute it and/or modify
39+# it under the terms of the GNU Affero General Public License as
40+# published by the Free Software Foundation, either version 3 of the
41+# License, or (at your option) any later version.
42+#
43+# This program is distributed in the hope that it will be useful,
44+# but WITHOUT ANY WARRANTY; without even the implied warranty of
45+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+# GNU Affero General Public License for more details.
47+#
48+# You should have received a copy of the GNU Affero General Public License
49+# along with this program. If not, see <http://www.gnu.org/licenses/>.
50+#
51+##############################################################################
52+
53+{
54+ 'name': 'Purchase profit forecast',
55+ 'version': '1.1',
56+ 'category': 'Finance',
57+ 'description': """
58+ """,
59+ 'author': 'Savoir-faire Linux',
60+ 'website': 'http://www.savoirfairelinux.com/',
61+ 'depends': ['account', 'purchase'],
62+ 'data': [
63+ 'security/ir.model.access.csv',
64+ 'report/purchase_profit_view.xml',
65+ ],
66+ 'test': [
67+ ],
68+ 'demo': [],
69+ 'installable': True,
70+ 'active': False,
71+ 'certificate': False,
72+}
73
74=== added directory 'purchase_profit_forecast/report'
75=== added file 'purchase_profit_forecast/report/__init__.py'
76--- purchase_profit_forecast/report/__init__.py 1970-01-01 00:00:00 +0000
77+++ purchase_profit_forecast/report/__init__.py 2014-05-13 17:14:17 +0000
78@@ -0,0 +1,22 @@
79+# -*- coding: utf-8 -*-
80+##############################################################################
81+#
82+# OpenERP, Open Source Management Solution
83+# Copyright (c) 2010-2013 Savoir-faire Linux. All Rights Reserved.
84+#
85+# This program is free software: you can redistribute it and/or modify
86+# it under the terms of the GNU Affero General Public License as
87+# published by the Free Software Foundation, either version 3 of the
88+# License, or (at your option) any later version.
89+#
90+# This program is distributed in the hope that it will be useful,
91+# but WITHOUT ANY WARRANTY; without even the implied warranty of
92+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93+# GNU Affero General Public License for more details.
94+#
95+# You should have received a copy of the GNU Affero General Public License
96+# along with this program. If not, see <http://www.gnu.org/licenses/>.
97+#
98+##############################################################################
99+from . import purchase
100+from . import analytic
101
102=== added file 'purchase_profit_forecast/report/analytic.py'
103--- purchase_profit_forecast/report/analytic.py 1970-01-01 00:00:00 +0000
104+++ purchase_profit_forecast/report/analytic.py 2014-05-13 17:14:17 +0000
105@@ -0,0 +1,22 @@
106+from openerp.osv import orm, fields
107+
108+class account_analytic_line(orm.Model):
109+
110+ _inherit = 'account.analytic.line'
111+
112+ def reference_po(self, cr, uid, ids, name, arg, context=None):
113+
114+ res = {}
115+ for line in self.pool.get('account.analytic.line').browse(cr, uid, ids):
116+
117+ res[line.id] = line.account_id.purchase_order.name
118+
119+ return res
120+
121+ _columns = {
122+ 'reference_po': fields.function(reference_po,
123+ string='Reference PO',
124+ type='char',
125+ size=64,
126+ store=True),
127+ }
128
129=== added file 'purchase_profit_forecast/report/purchase.py'
130--- purchase_profit_forecast/report/purchase.py 1970-01-01 00:00:00 +0000
131+++ purchase_profit_forecast/report/purchase.py 2014-05-13 17:14:17 +0000
132@@ -0,0 +1,54 @@
133+from openerp.osv import orm, fields
134+from datetime import datetime, timedelta
135+
136+class purchase_profit(orm.Model):
137+ _name = "purchase.profit"
138+ _description = "Purchase Profit"
139+ _auto = False
140+ _log_access = True
141+
142+ _columns = {
143+ 'lot': fields.char('Lot', size=10),
144+ 'purchase': fields.char('Purchase', size=10),
145+ 'purchase landed costs': fields.char('Purchase Landed cost', size=10),
146+ 'sales landed costs': fields.char('Sales Landed Costs', size=10),
147+ 'refund': fields.char('Refund', size=10),
148+ 'sale': fields.char('Sale', size=10),
149+ 'balance': fields.char('Balance', size=10),
150+ }
151+
152+
153+class purchase_profit_config(orm.TransientModel):
154+
155+ _name = "purchase.profit.config"
156+ _description = "Purchase Profit"
157+
158+ _columns = {
159+ 'start_date': fields.datetime('Start date'),
160+ 'end_date': fields.datetime('End date')
161+ }
162+
163+ _defaults = {
164+ 'start_date': lambda *a: datetime.now().strftime('%Y-%m-%d'),
165+ 'end_date': lambda *a: (
166+ datetime.now() + timedelta(days=14)).strftime("%Y-%m-%d")
167+ }
168+
169+
170+ def purchase_profit_open_window(self, cr, uid, ids, context=None):
171+ mod_obj = self.pool.get('ir.model.data')
172+ act_obj = self.pool.get('ir.actions.act_window')
173+ result_context = {}
174+
175+ if context is None:
176+ context = {}
177+
178+ result = mod_obj.get_object_reference(
179+ cr, uid, 'purchase_profit_forecast', 'action_purchase_profit')
180+
181+ id = result and result[1] or False
182+
183+ result = act_obj.read(cr, uid, [id], context=context)[0]
184+ result['context'] = context
185+ return result
186+
187
188=== added file 'purchase_profit_forecast/report/purchase_profit_view.xml'
189--- purchase_profit_forecast/report/purchase_profit_view.xml 1970-01-01 00:00:00 +0000
190+++ purchase_profit_forecast/report/purchase_profit_view.xml 2014-05-13 17:14:17 +0000
191@@ -0,0 +1,89 @@
192+<?xml version="1.0" encoding="utf-8"?>
193+<openerp>
194+ <data>
195+
196+ <record id="purchase_profit_analytic" model="ir.ui.view">
197+ <field name="name">Purchase profit</field>
198+ <field name="model">account.analytic.line</field>
199+ <field name="inherit_id" ref="account.view_account_analytic_line_tree" />
200+ <field name="arch" type="xml">
201+ <field name="account_id" position="before">
202+ <field name="reference_po" />
203+ </field>
204+ </field>
205+ </record>
206+
207+ <record id="purchase_profit_analytic_filter" model="ir.ui.view">
208+ <field name="inherit_id" ref="account.view_account_analytic_line_filter" />
209+ <field name="model">account.analytic.line</field>
210+ <field name="arch" type="xml">
211+
212+ <xpath expr="//filter[@string='Analytic Account']"
213+ position="after">
214+ <filter string="Reference PO" domain="[]" context="{'group_by':'reference_po'}"/>
215+
216+ </xpath>
217+ </field>
218+ </record>
219+
220+
221+
222+ <!-- Report view -->
223+ <record id="purchase_profit_form" model="ir.ui.view">
224+ <field eval="1" name="priority"/>
225+ <field name="name">purchase.profit.form</field>
226+ <field name="model">purchase.profit</field>
227+ <field name="arch" type="xml">
228+ <tree string="Stock Forecast" create="false">
229+ <field name="lot" />
230+ </tree>
231+ </field>
232+ </record>
233+
234+ <!-- Wizard view -->
235+ <record id="purchase_profit_config_form" model="ir.ui.view">
236+ <field eval="1" name="priority" />
237+ <field name="name">purchase.profit.config.form</field>
238+ <field name="model">purchase.profit.config</field>
239+ <field name="arch" type="xml">
240+ <form string="Model" version="7.0">
241+ <group string="Purchase Profit">
242+ <field name="start_date" />
243+ <field name="end_date" />
244+ </group>
245+ <footer>
246+ <button name="purchase_profit_open_window" string="Open" type="object" class="oe_highlight"/>
247+ or
248+ <button string="Cancel" class="oe_link" special="cancel"/>
249+ </footer>
250+ </form>
251+ </field>
252+ </record>
253+
254+ <!-- Wizard action -->
255+ <record id="action_purchase_profit_config" model="ir.actions.act_window">
256+ <field name="name">Purchase Profit</field>
257+ <field name="type">ir.actions.act_window</field>
258+ <field name="res_model">purchase.profit.config</field>
259+ <field name="view_type">form</field>
260+ <field name="view_mode">tree,form</field>
261+ <field name="view_id" ref="purchase_profit_config_form"/>
262+ <field name="target">new</field>
263+ </record>
264+
265+ <!-- Action to open the report -->
266+ <record id="action_purchase_profit" model="ir.actions.act_window">
267+ <field name="name">Purchase Profit</field>
268+ <field name="res_model">purchase.profit</field>
269+ <field name="view_type">tree</field>
270+ <field name="view_mode">tree</field>
271+ <field name="view_id" ref="purchase_profit_form" />
272+ </record>
273+
274+ <!-- Action placement -->
275+ <menuitem action="action_purchase_profit_config"
276+ id="menu_action_purchase_profit_config"
277+ parent="stock.next_id_61" />
278+
279+ </data>
280+</openerp>
281
282=== added directory 'purchase_profit_forecast/security'
283=== added file 'purchase_profit_forecast/security/ir.model.access.csv'
284--- purchase_profit_forecast/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
285+++ purchase_profit_forecast/security/ir.model.access.csv 2014-05-13 17:14:17 +0000
286@@ -0,0 +1,2 @@
287+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
288+access_purchase_profit,access_purchase_profit,model_purchase_profit,,1,1,1,1
289\ No newline at end of file

Subscribers

People subscribed via source and target branches