Merge lp:~vauxoo/addons-vauxoo/cicsa_price_unit_estimated_prl-dev-yani into lp:~vauxoo/addons-vauxoo/addons-vauxoo-cicsa
- cicsa_price_unit_estimated_prl-dev-yani
- Merge into addons-vauxoo-cicsa
Proposed by
Yanina Aular (Vauxoo)
Status: | Merged |
---|---|
Merged at revision: | 1057 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/cicsa_price_unit_estimated_prl-dev-yani |
Merge into: | lp:~vauxoo/addons-vauxoo/addons-vauxoo-cicsa |
Diff against target: |
295 lines (+242/-0) 6 files modified
purchase_requisition_line_price_unit/__init__.py (+27/-0) purchase_requisition_line_price_unit/__openerp__.py (+52/-0) purchase_requisition_line_price_unit/model/__init__.py (+26/-0) purchase_requisition_line_price_unit/model/purchase_requisition_line.py (+86/-0) purchase_requisition_line_price_unit/view/purchase_requisition_view.xml (+26/-0) purchase_requisition_line_price_unit/wizard/__init__.py (+25/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/cicsa_price_unit_estimated_prl-dev-yani |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Yanina Aular (Vauxoo) | Pending | ||
Review via email:
|
Commit message
Description of the change
An estimated unit price per line in the purchase requisition, a subtotal for each line
of the purchase requisition and a total of all lines is added.
To post a comment you must log in.
- 1058. By Yanina Aular (Vauxoo)
-
[FIX] price unit not be required in model
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'purchase_requisition_line_price_unit' |
2 | === added file 'purchase_requisition_line_price_unit/__init__.py' |
3 | --- purchase_requisition_line_price_unit/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ purchase_requisition_line_price_unit/__init__.py 2014-06-18 14:56:09 +0000 |
5 | @@ -0,0 +1,27 @@ |
6 | +#!/usr/bin/python |
7 | +# -*- encoding: utf-8 -*- |
8 | +############################################################################### |
9 | +# Module Writen to OpenERP, Open Source Management Solution |
10 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
11 | +# All Rights Reserved |
12 | +############# Credits ######################################################### |
13 | +# Coded by: Yanina Aular <yani@vauxoo.com> |
14 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
15 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
16 | +############################################################################### |
17 | +# This program is free software: you can redistribute it and/or modify |
18 | +# it under the terms of the GNU Affero General Public License as published |
19 | +# by the Free Software Foundation, either version 3 of the License, or |
20 | +# (at your option) any later version. |
21 | +# |
22 | +# This program is distributed in the hope that it will be useful, |
23 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 | +# GNU Affero General Public License for more details. |
26 | +# |
27 | +# You should have received a copy of the GNU Affero General Public License |
28 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
29 | +############################################################################### |
30 | + |
31 | +import model |
32 | +import wizard |
33 | |
34 | === added file 'purchase_requisition_line_price_unit/__openerp__.py' |
35 | --- purchase_requisition_line_price_unit/__openerp__.py 1970-01-01 00:00:00 +0000 |
36 | +++ purchase_requisition_line_price_unit/__openerp__.py 2014-06-18 14:56:09 +0000 |
37 | @@ -0,0 +1,52 @@ |
38 | +#!/usr/bin/python |
39 | +# -*- encoding: utf-8 -*- |
40 | +############################################################################### |
41 | +# Module Writen to OpenERP, Open Source Management Solution |
42 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
43 | +# All Rights Reserved |
44 | +############# Credits ######################################################### |
45 | +# Coded by: Yanina Aular <yani@vauxoo.com> |
46 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
47 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
48 | +############################################################################### |
49 | +# This program is free software: you can redistribute it and/or modify |
50 | +# it under the terms of the GNU Affero General Public License as published |
51 | +# by the Free Software Foundation, either version 3 of the License, or |
52 | +# (at your option) any later version. |
53 | +# |
54 | +# This program is distributed in the hope that it will be useful, |
55 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
56 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
57 | +# GNU Affero General Public License for more details. |
58 | +# |
59 | +# You should have received a copy of the GNU Affero General Public License |
60 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
61 | +############################################################################### |
62 | + |
63 | +{ |
64 | + 'name': 'Purchase Requisition Line Price Unit', |
65 | + 'version': '1.0', |
66 | + 'author': 'Vauxoo', |
67 | + 'website': 'http://www.vauxoo.com/', |
68 | + 'category': '', |
69 | + 'description': ''' |
70 | +Purchase Requisition Line Price Unit |
71 | +==================================== |
72 | + |
73 | +An estimated unit price per line in the purchase requisition, a subtotal for each line |
74 | +of the purchase requisition and a total of all lines is added. |
75 | +''', |
76 | + 'depends': [ |
77 | + 'purchase_requisition', |
78 | + ], |
79 | + 'data': [ |
80 | + 'view/purchase_requisition_view.xml' |
81 | + ], |
82 | + 'demo': [], |
83 | + 'test': [], |
84 | + 'qweb': [], |
85 | + 'js': [], |
86 | + 'css': [], |
87 | + 'active': False, |
88 | + 'installable': True, |
89 | +} |
90 | |
91 | === added directory 'purchase_requisition_line_price_unit/data' |
92 | === added directory 'purchase_requisition_line_price_unit/demo' |
93 | === added directory 'purchase_requisition_line_price_unit/doc' |
94 | === added directory 'purchase_requisition_line_price_unit/doc/images' |
95 | === added directory 'purchase_requisition_line_price_unit/i18n' |
96 | === added directory 'purchase_requisition_line_price_unit/model' |
97 | === added file 'purchase_requisition_line_price_unit/model/__init__.py' |
98 | --- purchase_requisition_line_price_unit/model/__init__.py 1970-01-01 00:00:00 +0000 |
99 | +++ purchase_requisition_line_price_unit/model/__init__.py 2014-06-18 14:56:09 +0000 |
100 | @@ -0,0 +1,26 @@ |
101 | +#!/usr/bin/python |
102 | +# -*- encoding: utf-8 -*- |
103 | +############################################################################### |
104 | +# Module Writen to OpenERP, Open Source Management Solution |
105 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
106 | +# All Rights Reserved |
107 | +############# Credits ######################################################### |
108 | +# Coded by: Yanina Aular <yani@vauxoo.com> |
109 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
110 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
111 | +############################################################################### |
112 | +# This program is free software: you can redistribute it and/or modify |
113 | +# it under the terms of the GNU Affero General Public License as published |
114 | +# by the Free Software Foundation, either version 3 of the License, or |
115 | +# (at your option) any later version. |
116 | +# |
117 | +# This program is distributed in the hope that it will be useful, |
118 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
119 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
120 | +# GNU Affero General Public License for more details. |
121 | +# |
122 | +# You should have received a copy of the GNU Affero General Public License |
123 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
124 | +############################################################################### |
125 | + |
126 | +import purchase_requisition_line |
127 | |
128 | === added file 'purchase_requisition_line_price_unit/model/purchase_requisition_line.py' |
129 | --- purchase_requisition_line_price_unit/model/purchase_requisition_line.py 1970-01-01 00:00:00 +0000 |
130 | +++ purchase_requisition_line_price_unit/model/purchase_requisition_line.py 2014-06-18 14:56:09 +0000 |
131 | @@ -0,0 +1,86 @@ |
132 | +# -*- encoding: utf-8 -*- |
133 | +######################################################################## |
134 | +# |
135 | +# OpenERP, Open Source Management Solution |
136 | +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
137 | +# $Id$ |
138 | +# |
139 | +# This program is free software: you can redistribute it and/or modify |
140 | +# it under the terms of the GNU Affero General Public License as published by |
141 | +# the Free Software Foundation, either version 3 of the License, or |
142 | +# (at your option) any later version. |
143 | +# |
144 | +# This program is distributed in the hope that it will be useful, |
145 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
146 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
147 | +# GNU Affero General Public License for more details. |
148 | +# |
149 | +# You should have received a copy of the GNU Affero General Public License |
150 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
151 | +# |
152 | +######################################################################## |
153 | +from datetime import datetime |
154 | +from dateutil.relativedelta import relativedelta |
155 | +import time |
156 | +from openerp import netsvc |
157 | + |
158 | +from openerp.osv import fields, osv |
159 | +from openerp.tools.translate import _ |
160 | +import openerp.addons.decimal_precision as dp |
161 | +from openerp import tools |
162 | + |
163 | +class purchase_requisition(osv.Model): |
164 | + _inherit = "purchase.requisition" |
165 | + |
166 | + def _get_requisition(self, cr, uid, ids, context=None): |
167 | + result = {} |
168 | + for line in self.pool.get('purchase.requisition.line').browse(cr, uid, ids, context=context): |
169 | + result[line.requisition_id.id] = True |
170 | + return result.keys() |
171 | + |
172 | + def _amount_all(self, cr, uid, ids, field_name, arg, context=None): |
173 | + res = {} |
174 | + cur_obj=self.pool.get('res.currency') |
175 | + for requisition in self.browse(cr, uid, ids, context=context): |
176 | + res[requisition.id] = { |
177 | + 'amount_untaxed': 0.0, |
178 | + 'amount_tax': 0.0, |
179 | + 'amount_total': 0.0, |
180 | + } |
181 | + val = val1 = 0.0 |
182 | + cur = requisition.currency_id |
183 | + for line in requisition.line_ids: |
184 | + val1 += line.price_subtotal |
185 | + for c in self.pool.get('account.tax').compute_all(cr, uid, [], line.price_unit, line.product_qty, line.product_id)['taxes']: |
186 | + val += c.get('amount', 0.0) |
187 | + #res[requisition.id]['amount_tax']=cur_obj.round(cr, uid, cur, val) |
188 | + amount_untaxed =cur_obj.round(cr, uid, cur, val1) |
189 | + res[requisition.id]['amount_total']= amount_untaxed # + res[requisition.id]['amount_tax'] |
190 | + return res |
191 | + |
192 | + _columns = { |
193 | + 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total', |
194 | + store={ |
195 | + 'purchase.requisition.line': (_get_requisition, None, 10), |
196 | + }, multi="sums",help="The total amount"), |
197 | + } |
198 | + |
199 | +class purchase_requisition_line(osv.Model): |
200 | + _inherit = "purchase.requisition.line" |
201 | + |
202 | + def _amount_line(self, cr, uid, ids, prop, arg, context=None): |
203 | + res = {} |
204 | + cur_obj=self.pool.get('res.currency') |
205 | + tax_obj = self.pool.get('account.tax') |
206 | + for line in self.browse(cr, uid, ids, context=context): |
207 | + taxes = tax_obj.compute_all(cr, uid, [], line.price_unit, line.product_qty, line.product_id) |
208 | + #cur = line.requisition_id.pricelist_id.currency_id |
209 | + cur = line.requisition_id.currency_id |
210 | + res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) |
211 | + return res |
212 | + |
213 | + _columns = { |
214 | + 'price_unit': fields.float('Unit Price', digits_compute= dp.get_precision('Product Price')), |
215 | + 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')), |
216 | + } |
217 | + |
218 | |
219 | === added directory 'purchase_requisition_line_price_unit/report' |
220 | === added directory 'purchase_requisition_line_price_unit/security' |
221 | === added directory 'purchase_requisition_line_price_unit/static' |
222 | === added directory 'purchase_requisition_line_price_unit/static/description' |
223 | === added file 'purchase_requisition_line_price_unit/static/description/index.html' |
224 | === added directory 'purchase_requisition_line_price_unit/static/src' |
225 | === added directory 'purchase_requisition_line_price_unit/static/src/css' |
226 | === added directory 'purchase_requisition_line_price_unit/static/src/img' |
227 | === added file 'purchase_requisition_line_price_unit/static/src/img/icon.png' |
228 | Binary files purchase_requisition_line_price_unit/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_price_unit/static/src/img/icon.png 2014-06-18 14:56:09 +0000 differ |
229 | === added directory 'purchase_requisition_line_price_unit/static/src/js' |
230 | === added directory 'purchase_requisition_line_price_unit/static/src/xml' |
231 | === added directory 'purchase_requisition_line_price_unit/test' |
232 | === added directory 'purchase_requisition_line_price_unit/view' |
233 | === added file 'purchase_requisition_line_price_unit/view/purchase_requisition_view.xml' |
234 | --- purchase_requisition_line_price_unit/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000 |
235 | +++ purchase_requisition_line_price_unit/view/purchase_requisition_view.xml 2014-06-18 14:56:09 +0000 |
236 | @@ -0,0 +1,26 @@ |
237 | +<?xml version="1.0"?> |
238 | +<openerp> |
239 | + <data> |
240 | + <record id="view_purchase_requisition_form_inherit_price_unit" model="ir.ui.view"> |
241 | + <field name="name">purchase.requisition.form.inherit.price_unit</field> |
242 | + <field name="model">purchase.requisition</field> |
243 | + <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/> |
244 | + <field name="arch" type="xml"> |
245 | + <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty'][last()]" position="after"> |
246 | + <field name="price_unit" required="1"/> |
247 | + <field name="price_subtotal" required="1"/> |
248 | + </xpath> |
249 | + <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty'][last()]" position="after"> |
250 | + <field name="price_unit" required="1"/> |
251 | + <field name="price_subtotal" required="1"/> |
252 | + </xpath> |
253 | + <xpath expr="//field[@name='line_ids']" position="after"> |
254 | + <group class="oe_subtotal_footer oe_right"> |
255 | + <field name="amount_total" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/> |
256 | + </group> |
257 | + </xpath> |
258 | + </field> |
259 | + </record> |
260 | + |
261 | + </data> |
262 | +</openerp> |
263 | |
264 | === added directory 'purchase_requisition_line_price_unit/wizard' |
265 | === added file 'purchase_requisition_line_price_unit/wizard/__init__.py' |
266 | --- purchase_requisition_line_price_unit/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
267 | +++ purchase_requisition_line_price_unit/wizard/__init__.py 2014-06-18 14:56:09 +0000 |
268 | @@ -0,0 +1,25 @@ |
269 | +#!/usr/bin/python |
270 | +# -*- encoding: utf-8 -*- |
271 | +############################################################################### |
272 | +# Module Writen to OpenERP, Open Source Management Solution |
273 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
274 | +# All Rights Reserved |
275 | +############# Credits ######################################################### |
276 | +# Coded by: Yanina Aular <yani@vauxoo.com> |
277 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
278 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
279 | +############################################################################### |
280 | +# This program is free software: you can redistribute it and/or modify |
281 | +# it under the terms of the GNU Affero General Public License as published |
282 | +# by the Free Software Foundation, either version 3 of the License, or |
283 | +# (at your option) any later version. |
284 | +# |
285 | +# This program is distributed in the hope that it will be useful, |
286 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
287 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
288 | +# GNU Affero General Public License for more details. |
289 | +# |
290 | +# You should have received a copy of the GNU Affero General Public License |
291 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
292 | +############################################################################### |
293 | + |
294 | |
295 | === added directory 'purchase_requisition_line_price_unit/workflow' |