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
=== added directory 'purchase_profit_forecast'
=== added file 'purchase_profit_forecast/__init__.py'
--- purchase_profit_forecast/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/__init__.py 2014-05-13 17:14:17 +0000
@@ -0,0 +1,21 @@
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##############################################################################
21import report
022
=== added file 'purchase_profit_forecast/__openerp__.py'
--- purchase_profit_forecast/__openerp__.py 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/__openerp__.py 2014-05-13 17:14:17 +0000
@@ -0,0 +1,41 @@
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': 'Purchase profit forecast',
24 'version': '1.1',
25 'category': 'Finance',
26 'description': """
27 """,
28 'author': 'Savoir-faire Linux',
29 'website': 'http://www.savoirfairelinux.com/',
30 'depends': ['account', 'purchase'],
31 'data': [
32 'security/ir.model.access.csv',
33 'report/purchase_profit_view.xml',
34 ],
35 'test': [
36 ],
37 'demo': [],
38 'installable': True,
39 'active': False,
40 'certificate': False,
41}
042
=== added directory 'purchase_profit_forecast/report'
=== added file 'purchase_profit_forecast/report/__init__.py'
--- purchase_profit_forecast/report/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/report/__init__.py 2014-05-13 17:14: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##############################################################################
21from . import purchase
22from . import analytic
023
=== added file 'purchase_profit_forecast/report/analytic.py'
--- purchase_profit_forecast/report/analytic.py 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/report/analytic.py 2014-05-13 17:14:17 +0000
@@ -0,0 +1,22 @@
1from openerp.osv import orm, fields
2
3class account_analytic_line(orm.Model):
4
5 _inherit = 'account.analytic.line'
6
7 def reference_po(self, cr, uid, ids, name, arg, context=None):
8
9 res = {}
10 for line in self.pool.get('account.analytic.line').browse(cr, uid, ids):
11
12 res[line.id] = line.account_id.purchase_order.name
13
14 return res
15
16 _columns = {
17 'reference_po': fields.function(reference_po,
18 string='Reference PO',
19 type='char',
20 size=64,
21 store=True),
22 }
023
=== added file 'purchase_profit_forecast/report/purchase.py'
--- purchase_profit_forecast/report/purchase.py 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/report/purchase.py 2014-05-13 17:14:17 +0000
@@ -0,0 +1,54 @@
1from openerp.osv import orm, fields
2from datetime import datetime, timedelta
3
4class purchase_profit(orm.Model):
5 _name = "purchase.profit"
6 _description = "Purchase Profit"
7 _auto = False
8 _log_access = True
9
10 _columns = {
11 'lot': fields.char('Lot', size=10),
12 'purchase': fields.char('Purchase', size=10),
13 'purchase landed costs': fields.char('Purchase Landed cost', size=10),
14 'sales landed costs': fields.char('Sales Landed Costs', size=10),
15 'refund': fields.char('Refund', size=10),
16 'sale': fields.char('Sale', size=10),
17 'balance': fields.char('Balance', size=10),
18 }
19
20
21class purchase_profit_config(orm.TransientModel):
22
23 _name = "purchase.profit.config"
24 _description = "Purchase Profit"
25
26 _columns = {
27 'start_date': fields.datetime('Start date'),
28 'end_date': fields.datetime('End date')
29 }
30
31 _defaults = {
32 'start_date': lambda *a: datetime.now().strftime('%Y-%m-%d'),
33 'end_date': lambda *a: (
34 datetime.now() + timedelta(days=14)).strftime("%Y-%m-%d")
35 }
36
37
38 def purchase_profit_open_window(self, cr, uid, ids, context=None):
39 mod_obj = self.pool.get('ir.model.data')
40 act_obj = self.pool.get('ir.actions.act_window')
41 result_context = {}
42
43 if context is None:
44 context = {}
45
46 result = mod_obj.get_object_reference(
47 cr, uid, 'purchase_profit_forecast', 'action_purchase_profit')
48
49 id = result and result[1] or False
50
51 result = act_obj.read(cr, uid, [id], context=context)[0]
52 result['context'] = context
53 return result
54
055
=== added file 'purchase_profit_forecast/report/purchase_profit_view.xml'
--- purchase_profit_forecast/report/purchase_profit_view.xml 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/report/purchase_profit_view.xml 2014-05-13 17:14:17 +0000
@@ -0,0 +1,89 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="purchase_profit_analytic" model="ir.ui.view">
6 <field name="name">Purchase profit</field>
7 <field name="model">account.analytic.line</field>
8 <field name="inherit_id" ref="account.view_account_analytic_line_tree" />
9 <field name="arch" type="xml">
10 <field name="account_id" position="before">
11 <field name="reference_po" />
12 </field>
13 </field>
14 </record>
15
16 <record id="purchase_profit_analytic_filter" model="ir.ui.view">
17 <field name="inherit_id" ref="account.view_account_analytic_line_filter" />
18 <field name="model">account.analytic.line</field>
19 <field name="arch" type="xml">
20
21 <xpath expr="//filter[@string='Analytic Account']"
22 position="after">
23 <filter string="Reference PO" domain="[]" context="{'group_by':'reference_po'}"/>
24
25 </xpath>
26 </field>
27 </record>
28
29
30
31 <!-- Report view -->
32 <record id="purchase_profit_form" model="ir.ui.view">
33 <field eval="1" name="priority"/>
34 <field name="name">purchase.profit.form</field>
35 <field name="model">purchase.profit</field>
36 <field name="arch" type="xml">
37 <tree string="Stock Forecast" create="false">
38 <field name="lot" />
39 </tree>
40 </field>
41 </record>
42
43 <!-- Wizard view -->
44 <record id="purchase_profit_config_form" model="ir.ui.view">
45 <field eval="1" name="priority" />
46 <field name="name">purchase.profit.config.form</field>
47 <field name="model">purchase.profit.config</field>
48 <field name="arch" type="xml">
49 <form string="Model" version="7.0">
50 <group string="Purchase Profit">
51 <field name="start_date" />
52 <field name="end_date" />
53 </group>
54 <footer>
55 <button name="purchase_profit_open_window" string="Open" type="object" class="oe_highlight"/>
56 or
57 <button string="Cancel" class="oe_link" special="cancel"/>
58 </footer>
59 </form>
60 </field>
61 </record>
62
63 <!-- Wizard action -->
64 <record id="action_purchase_profit_config" model="ir.actions.act_window">
65 <field name="name">Purchase Profit</field>
66 <field name="type">ir.actions.act_window</field>
67 <field name="res_model">purchase.profit.config</field>
68 <field name="view_type">form</field>
69 <field name="view_mode">tree,form</field>
70 <field name="view_id" ref="purchase_profit_config_form"/>
71 <field name="target">new</field>
72 </record>
73
74 <!-- Action to open the report -->
75 <record id="action_purchase_profit" model="ir.actions.act_window">
76 <field name="name">Purchase Profit</field>
77 <field name="res_model">purchase.profit</field>
78 <field name="view_type">tree</field>
79 <field name="view_mode">tree</field>
80 <field name="view_id" ref="purchase_profit_form" />
81 </record>
82
83 <!-- Action placement -->
84 <menuitem action="action_purchase_profit_config"
85 id="menu_action_purchase_profit_config"
86 parent="stock.next_id_61" />
87
88 </data>
89</openerp>
090
=== added directory 'purchase_profit_forecast/security'
=== added file 'purchase_profit_forecast/security/ir.model.access.csv'
--- purchase_profit_forecast/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ purchase_profit_forecast/security/ir.model.access.csv 2014-05-13 17:14:17 +0000
@@ -0,0 +1,2 @@
1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2access_purchase_profit,access_purchase_profit,model_purchase_profit,,1,1,1,1
0\ No newline at end of file3\ No newline at end of file

Subscribers

People subscribed via source and target branches