Merge lp:~vauxoo/addons-vauxoo/purchase_requisition_line_analytic-rev1-yani into lp:addons-vauxoo/7.0
- purchase_requisition_line_analytic-rev1-yani
- Merge into 7.0
Proposed by
Yanina Aular (Vauxoo)
Status: | Merged |
---|---|
Merged at revision: | 1055 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/purchase_requisition_line_analytic-rev1-yani |
Merge into: | lp:addons-vauxoo/7.0 |
Diff against target: |
320 lines (+249/-2) 7 files modified
purchase_requisition_line_analytic/model/purchase_requisition.py (+2/-2) purchase_requisition_line_plan/__init__.py (+27/-0) purchase_requisition_line_plan/__openerp__.py (+54/-0) purchase_requisition_line_plan/model/__init__.py (+26/-0) purchase_requisition_line_plan/model/purchase_requisition.py (+75/-0) purchase_requisition_line_plan/view/purchase_requisition_view.xml (+40/-0) purchase_requisition_line_plan/wizard/__init__.py (+25/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/purchase_requisition_line_analytic-rev1-yani |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Yanina Aular (Vauxoo) | Pending | ||
Review via email: mp+223071@code.launchpad.net |
Commit message
Description of the change
New module that adds a cost center to the purchase requisition line
To post a comment you must log in.
- 1059. By Yanina Aular (Vauxoo)
-
[IMP] description and name
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'purchase_requisition_line_analytic/model/purchase_requisition.py' | |||
2 | --- purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-11 21:45:45 +0000 | |||
3 | +++ purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-13 14:00:51 +0000 | |||
4 | @@ -35,7 +35,7 @@ | |||
5 | 35 | 35 | ||
6 | 36 | _columns = { | 36 | _columns = { |
7 | 37 | 'account_analytic_id': fields.many2one( | 37 | 'account_analytic_id': fields.many2one( |
9 | 38 | 'account.analytic.plan.instance', 'Analytic Distribution', | 38 | 'account.analytic.account', 'Analytic Account', |
10 | 39 | help='This field is used to assign the selected'\ | 39 | help='This field is used to assign the selected'\ |
11 | 40 | ' analytic account to the line of the purchase order'), | 40 | ' analytic account to the line of the purchase order'), |
12 | 41 | } | 41 | } |
13 | @@ -63,5 +63,5 @@ | |||
14 | 63 | for pol_id in pol_ids: | 63 | for pol_id in pol_ids: |
15 | 64 | pol_brw = pol_obj.browse(cr, uid, pol_id) | 64 | pol_brw = pol_obj.browse(cr, uid, pol_id) |
16 | 65 | pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_id': | 65 | pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_id': |
18 | 66 | pol_brw.purchase_requisition_line_id.account_analytic_id}, context=context) | 66 | pol_brw.purchase_requisition_line_id.account_analytic_id.id}, context=context) |
19 | 67 | return res | 67 | return res |
20 | 68 | 68 | ||
21 | === added directory 'purchase_requisition_line_plan' | |||
22 | === added file 'purchase_requisition_line_plan/__init__.py' | |||
23 | --- purchase_requisition_line_plan/__init__.py 1970-01-01 00:00:00 +0000 | |||
24 | +++ purchase_requisition_line_plan/__init__.py 2014-06-13 14:00:51 +0000 | |||
25 | @@ -0,0 +1,27 @@ | |||
26 | 1 | #!/usr/bin/python | ||
27 | 2 | # -*- encoding: utf-8 -*- | ||
28 | 3 | ############################################################################### | ||
29 | 4 | # Module Writen to OpenERP, Open Source Management Solution | ||
30 | 5 | # Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). | ||
31 | 6 | # All Rights Reserved | ||
32 | 7 | ############# Credits ######################################################### | ||
33 | 8 | # Coded by: Yanina Aular <yani@vauxoo.com> | ||
34 | 9 | # Planified by: Humberto Arocha <hbto@vauxoo.com> | ||
35 | 10 | # Audited by: Humberto Arocha <hbto@vauxoo.com> | ||
36 | 11 | ############################################################################### | ||
37 | 12 | # This program is free software: you can redistribute it and/or modify | ||
38 | 13 | # it under the terms of the GNU Affero General Public License as published | ||
39 | 14 | # by the Free Software Foundation, either version 3 of the License, or | ||
40 | 15 | # (at your option) any later version. | ||
41 | 16 | # | ||
42 | 17 | # This program is distributed in the hope that it will be useful, | ||
43 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
44 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
45 | 20 | # GNU Affero General Public License for more details. | ||
46 | 21 | # | ||
47 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
48 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
49 | 24 | ############################################################################### | ||
50 | 25 | |||
51 | 26 | import model | ||
52 | 27 | import wizard | ||
53 | 0 | 28 | ||
54 | === added file 'purchase_requisition_line_plan/__openerp__.py' | |||
55 | --- purchase_requisition_line_plan/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
56 | +++ purchase_requisition_line_plan/__openerp__.py 2014-06-13 14:00:51 +0000 | |||
57 | @@ -0,0 +1,54 @@ | |||
58 | 1 | #!/usr/bin/python | ||
59 | 2 | # -*- encoding: utf-8 -*- | ||
60 | 3 | ############################################################################### | ||
61 | 4 | # Module Writen to OpenERP, Open Source Management Solution | ||
62 | 5 | # Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). | ||
63 | 6 | # All Rights Reserved | ||
64 | 7 | ############# Credits ######################################################### | ||
65 | 8 | # Coded by: Yanina Aular <yani@vauxoo.com> | ||
66 | 9 | # Planified by: Humberto Arocha <hbto@vauxoo.com> | ||
67 | 10 | # Audited by: Humberto Arocha <hbto@vauxoo.com> | ||
68 | 11 | ############################################################################### | ||
69 | 12 | # This program is free software: you can redistribute it and/or modify | ||
70 | 13 | # it under the terms of the GNU Affero General Public License as published | ||
71 | 14 | # by the Free Software Foundation, either version 3 of the License, or | ||
72 | 15 | # (at your option) any later version. | ||
73 | 16 | # | ||
74 | 17 | # This program is distributed in the hope that it will be useful, | ||
75 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
76 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
77 | 20 | # GNU Affero General Public License for more details. | ||
78 | 21 | # | ||
79 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
80 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
81 | 24 | ############################################################################### | ||
82 | 25 | |||
83 | 26 | { | ||
84 | 27 | 'name': 'Purchase Requisition Line Plan', | ||
85 | 28 | 'version': '1.0', | ||
86 | 29 | 'author': 'Vauxoo', | ||
87 | 30 | 'website': 'http://www.vauxoo.com/', | ||
88 | 31 | 'category': '', | ||
89 | 32 | 'description': ''' | ||
90 | 33 | A account analytic plan instance is added in purchase requisition lines | ||
91 | 34 | |||
92 | 35 | Add analytic account plan instance on purchase requisition line and purchase order line, so the purchase order takes | ||
93 | 36 | the account analytic value from the purchase requisition. | ||
94 | 37 | ''', | ||
95 | 38 | 'depends': [ | ||
96 | 39 | 'account_analytic_plans', | ||
97 | 40 | 'purchase_requisition', | ||
98 | 41 | 'purchase_requisition_line_view', | ||
99 | 42 | 'pr_line_related_po_line', | ||
100 | 43 | ], | ||
101 | 44 | 'data': [ | ||
102 | 45 | 'view/purchase_requisition_view.xml', | ||
103 | 46 | ], | ||
104 | 47 | 'demo': [], | ||
105 | 48 | 'test': [], | ||
106 | 49 | 'qweb': [], | ||
107 | 50 | 'js': [], | ||
108 | 51 | 'css': [], | ||
109 | 52 | 'active': False, | ||
110 | 53 | 'installable': True, | ||
111 | 54 | } | ||
112 | 0 | 55 | ||
113 | === added directory 'purchase_requisition_line_plan/data' | |||
114 | === added directory 'purchase_requisition_line_plan/demo' | |||
115 | === added directory 'purchase_requisition_line_plan/doc' | |||
116 | === added directory 'purchase_requisition_line_plan/doc/images' | |||
117 | === added directory 'purchase_requisition_line_plan/i18n' | |||
118 | === added directory 'purchase_requisition_line_plan/model' | |||
119 | === added file 'purchase_requisition_line_plan/model/__init__.py' | |||
120 | --- purchase_requisition_line_plan/model/__init__.py 1970-01-01 00:00:00 +0000 | |||
121 | +++ purchase_requisition_line_plan/model/__init__.py 2014-06-13 14:00:51 +0000 | |||
122 | @@ -0,0 +1,26 @@ | |||
123 | 1 | #!/usr/bin/python | ||
124 | 2 | # -*- encoding: utf-8 -*- | ||
125 | 3 | ############################################################################### | ||
126 | 4 | # Module Writen to OpenERP, Open Source Management Solution | ||
127 | 5 | # Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). | ||
128 | 6 | # All Rights Reserved | ||
129 | 7 | ############# Credits ######################################################### | ||
130 | 8 | # Coded by: Yanina Aular <yani@vauxoo.com> | ||
131 | 9 | # Planified by: Humberto Arocha <hbto@vauxoo.com> | ||
132 | 10 | # Audited by: Humberto Arocha <hbto@vauxoo.com> | ||
133 | 11 | ############################################################################### | ||
134 | 12 | # This program is free software: you can redistribute it and/or modify | ||
135 | 13 | # it under the terms of the GNU Affero General Public License as published | ||
136 | 14 | # by the Free Software Foundation, either version 3 of the License, or | ||
137 | 15 | # (at your option) any later version. | ||
138 | 16 | # | ||
139 | 17 | # This program is distributed in the hope that it will be useful, | ||
140 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
141 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
142 | 20 | # GNU Affero General Public License for more details. | ||
143 | 21 | # | ||
144 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
145 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
146 | 24 | ############################################################################### | ||
147 | 25 | |||
148 | 26 | import purchase_requisition | ||
149 | 0 | 27 | ||
150 | === added file 'purchase_requisition_line_plan/model/purchase_requisition.py' | |||
151 | --- purchase_requisition_line_plan/model/purchase_requisition.py 1970-01-01 00:00:00 +0000 | |||
152 | +++ purchase_requisition_line_plan/model/purchase_requisition.py 2014-06-13 14:00:51 +0000 | |||
153 | @@ -0,0 +1,75 @@ | |||
154 | 1 | # -*- encoding: utf-8 -*- | ||
155 | 2 | ######################################################################## | ||
156 | 3 | # | ||
157 | 4 | # OpenERP, Open Source Management Solution | ||
158 | 5 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved | ||
159 | 6 | # $Id$ | ||
160 | 7 | # | ||
161 | 8 | # This program is free software: you can redistribute it and/or modify | ||
162 | 9 | # it under the terms of the GNU Affero General Public License as published by | ||
163 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
164 | 11 | # (at your option) any later version. | ||
165 | 12 | # | ||
166 | 13 | # This program is distributed in the hope that it will be useful, | ||
167 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
168 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
169 | 16 | # GNU Affero General Public License for more details. | ||
170 | 17 | # | ||
171 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
172 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
173 | 20 | # | ||
174 | 21 | ######################################################################## | ||
175 | 22 | from datetime import datetime | ||
176 | 23 | from dateutil.relativedelta import relativedelta | ||
177 | 24 | import time | ||
178 | 25 | from openerp import netsvc | ||
179 | 26 | |||
180 | 27 | from openerp.osv import fields, osv | ||
181 | 28 | from openerp.tools.translate import _ | ||
182 | 29 | import openerp.addons.decimal_precision as dp | ||
183 | 30 | from openerp import tools | ||
184 | 31 | |||
185 | 32 | class purchase_order_line(osv.Model): | ||
186 | 33 | _inherit = "purchase.order.line" | ||
187 | 34 | |||
188 | 35 | _columns = { | ||
189 | 36 | 'account_analytic_plan_id': fields.many2one( | ||
190 | 37 | 'account.analytic.plan.instance', 'Analytic Distribution', | ||
191 | 38 | help='This field is used to assign the selected'\ | ||
192 | 39 | ' analytic account to the line of the purchase order'), | ||
193 | 40 | |||
194 | 41 | } | ||
195 | 42 | |||
196 | 43 | |||
197 | 44 | class purchase_requisition_line(osv.Model): | ||
198 | 45 | _inherit = "purchase.requisition.line" | ||
199 | 46 | |||
200 | 47 | _columns = { | ||
201 | 48 | 'account_analytic_plan_id': fields.many2one( | ||
202 | 49 | 'account.analytic.plan.instance', 'Analytic Distribution', | ||
203 | 50 | help='This field is used to assign the selected'\ | ||
204 | 51 | ' analytic account to the line of the purchase order'), | ||
205 | 52 | } | ||
206 | 53 | |||
207 | 54 | class purchase_requisition(osv.Model): | ||
208 | 55 | _inherit = "purchase.requisition" | ||
209 | 56 | |||
210 | 57 | |||
211 | 58 | def make_purchase_order(self, cr, uid, ids, partner_id, context=None): | ||
212 | 59 | if context is None: | ||
213 | 60 | context = {} | ||
214 | 61 | res = super(purchase_requisition, self).make_purchase_order(cr, uid, ids, partner_id, context=context) | ||
215 | 62 | |||
216 | 63 | pol_obj = self.pool.get('purchase.order.line') | ||
217 | 64 | prl_obj = self.pool.get('purchase.requisition.line') | ||
218 | 65 | po_obj = self.pool.get('purchase.order') | ||
219 | 66 | |||
220 | 67 | for requisition in self.browse(cr, uid, ids, context=context): | ||
221 | 68 | po_req = po_obj.search(cr, uid, [('requisition_id','=',requisition.id)], context=context) | ||
222 | 69 | for po_id in po_req: | ||
223 | 70 | pol_ids = pol_obj.search(cr, uid, [('order_id','=',po_id)]) | ||
224 | 71 | for pol_id in pol_ids: | ||
225 | 72 | pol_brw = pol_obj.browse(cr, uid, pol_id) | ||
226 | 73 | pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_plan_id': | ||
227 | 74 | pol_brw.purchase_requisition_line_id.account_analytic_plan_id.id}, context=context) | ||
228 | 75 | return res | ||
229 | 0 | 76 | ||
230 | === added directory 'purchase_requisition_line_plan/report' | |||
231 | === added directory 'purchase_requisition_line_plan/security' | |||
232 | === added directory 'purchase_requisition_line_plan/static' | |||
233 | === added directory 'purchase_requisition_line_plan/static/description' | |||
234 | === added file 'purchase_requisition_line_plan/static/description/index.html' | |||
235 | === added directory 'purchase_requisition_line_plan/static/src' | |||
236 | === added directory 'purchase_requisition_line_plan/static/src/css' | |||
237 | === added directory 'purchase_requisition_line_plan/static/src/img' | |||
238 | === added file 'purchase_requisition_line_plan/static/src/img/icon.png' | |||
239 | 1 | Binary files purchase_requisition_line_plan/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_plan/static/src/img/icon.png 2014-06-13 14:00:51 +0000 differ | 77 | Binary files purchase_requisition_line_plan/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_plan/static/src/img/icon.png 2014-06-13 14:00:51 +0000 differ |
240 | === added directory 'purchase_requisition_line_plan/static/src/js' | |||
241 | === added directory 'purchase_requisition_line_plan/static/src/xml' | |||
242 | === added directory 'purchase_requisition_line_plan/test' | |||
243 | === added directory 'purchase_requisition_line_plan/view' | |||
244 | === added file 'purchase_requisition_line_plan/view/purchase_requisition_view.xml' | |||
245 | --- purchase_requisition_line_plan/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000 | |||
246 | +++ purchase_requisition_line_plan/view/purchase_requisition_view.xml 2014-06-13 14:00:51 +0000 | |||
247 | @@ -0,0 +1,40 @@ | |||
248 | 1 | <?xml version="1.0"?> | ||
249 | 2 | <openerp> | ||
250 | 3 | <data> | ||
251 | 4 | <record id="view_purchase_requisition_form_account_analytic_plan" model="ir.ui.view"> | ||
252 | 5 | <field name="name">purchase.requisition.form.account.analytic.plan</field> | ||
253 | 6 | <field name="model">purchase.requisition</field> | ||
254 | 7 | <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/> | ||
255 | 8 | <field name="arch" type="xml"> | ||
256 | 9 | <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty']" position="after"> | ||
257 | 10 | <field name="account_analytic_plan_id"/> | ||
258 | 11 | </xpath> | ||
259 | 12 | <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty']" position="after"> | ||
260 | 13 | <field name="account_analytic_plan_id"/> | ||
261 | 14 | </xpath> | ||
262 | 15 | </field> | ||
263 | 16 | </record> | ||
264 | 17 | |||
265 | 18 | <record id="view_purchase_requisition_line_form_account_analytic" model="ir.ui.view"> | ||
266 | 19 | <field name="name">purchase.requisition.line.form.account.analytic</field> | ||
267 | 20 | <field name="model">purchase.requisition.line</field> | ||
268 | 21 | <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_form"/> | ||
269 | 22 | <field name="arch" type="xml"> | ||
270 | 23 | <xpath expr="//field[@name='product_qty']" position="after"> | ||
271 | 24 | <field name="account_analytic_plan_id"/> | ||
272 | 25 | </xpath> | ||
273 | 26 | </field> | ||
274 | 27 | </record> | ||
275 | 28 | |||
276 | 29 | <record id="view_purchase_requisition_line_tree_account_analytic" model="ir.ui.view"> | ||
277 | 30 | <field name="name">purchase.requisition.line.tree.account.analytic</field> | ||
278 | 31 | <field name="model">purchase.requisition.line</field> | ||
279 | 32 | <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_tree"/> | ||
280 | 33 | <field name="arch" type="xml"> | ||
281 | 34 | <xpath expr="//field[@name='product_qty']" position="after"> | ||
282 | 35 | <field name="account_analytic_plan_id" groups="purchase.group_analytic_accounting"/> | ||
283 | 36 | </xpath> | ||
284 | 37 | </field> | ||
285 | 38 | </record> | ||
286 | 39 | </data> | ||
287 | 40 | </openerp> | ||
288 | 0 | 41 | ||
289 | === added directory 'purchase_requisition_line_plan/wizard' | |||
290 | === added file 'purchase_requisition_line_plan/wizard/__init__.py' | |||
291 | --- purchase_requisition_line_plan/wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
292 | +++ purchase_requisition_line_plan/wizard/__init__.py 2014-06-13 14:00:51 +0000 | |||
293 | @@ -0,0 +1,25 @@ | |||
294 | 1 | #!/usr/bin/python | ||
295 | 2 | # -*- encoding: utf-8 -*- | ||
296 | 3 | ############################################################################### | ||
297 | 4 | # Module Writen to OpenERP, Open Source Management Solution | ||
298 | 5 | # Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). | ||
299 | 6 | # All Rights Reserved | ||
300 | 7 | ############# Credits ######################################################### | ||
301 | 8 | # Coded by: Yanina Aular <yani@vauxoo.com> | ||
302 | 9 | # Planified by: Humberto Arocha <hbto@vauxoo.com> | ||
303 | 10 | # Audited by: Humberto Arocha <hbto@vauxoo.com> | ||
304 | 11 | ############################################################################### | ||
305 | 12 | # This program is free software: you can redistribute it and/or modify | ||
306 | 13 | # it under the terms of the GNU Affero General Public License as published | ||
307 | 14 | # by the Free Software Foundation, either version 3 of the License, or | ||
308 | 15 | # (at your option) any later version. | ||
309 | 16 | # | ||
310 | 17 | # This program is distributed in the hope that it will be useful, | ||
311 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
312 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
313 | 20 | # GNU Affero General Public License for more details. | ||
314 | 21 | # | ||
315 | 22 | # You should have received a copy of the GNU Affero General Public License | ||
316 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
317 | 24 | ############################################################################### | ||
318 | 25 | |||
319 | 0 | 26 | ||
320 | === added directory 'purchase_requisition_line_plan/workflow' |