Merge lp:~openerp-dev/openobject-addons/trunk-move-service-product-to-hr-timesheet-tpa into lp:openobject-addons

Proposed by Turkesh Patel (openERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-move-service-product-to-hr-timesheet-tpa
Merge into: lp:openobject-addons
Diff against target: 357 lines (+70/-92)
15 files modified
account_analytic_analysis/res_config.py (+32/-0)
account_analytic_analysis/res_config_view.xml (+9/-0)
hr_timesheet/hr_timesheet_data.xml (+15/-6)
hr_timesheet/hr_timesheet_demo.xml (+9/-4)
hr_timesheet/test/test_hr_timesheet.yml (+2/-0)
product/product_data.xml (+0/-14)
product/product_demo.xml (+0/-5)
product/product_image_demo.xml (+0/-4)
purchase/purchase_demo.xml (+0/-3)
sale/res_config.py (+0/-37)
sale/res_config_view.xml (+2/-5)
sale/sale_demo.xml (+0/-2)
sale_stock/res_config.py (+1/-2)
sale_stock/res_config_view.xml (+0/-6)
website_sale/data/website_sale_demo.xml (+0/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-move-service-product-to-hr-timesheet-tpa
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+202636@code.launchpad.net

Description of the change

[IMP] Move Service product to the module hr_timesheet module.

To post a comment you must log in.
9031. By Turkesh Patel (openERP)

[IMP] improved image related code of service product

9032. By Turkesh Patel (openERP)

[IMP] improved code

9033. By Turkesh Patel (openERP)

[IMP] improved code to apply time method and view.

9034. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9035. By Turkesh Patel (openERP)

[IMP] move code to account_analytic_analysis module from hr_timesheet

9036. By Turkesh Patel (openERP)

[IMP] improved code

9037. By Turkesh Patel (openERP)

[MRG] merge with lp;openobject-addons

9038. By Turkesh Patel (openERP)

[IMP] improved view and yml

9039. By Turkesh Patel (openERP)

[IMP] improved code.

9040. By Turkesh Patel (openERP)

[RMV] remove unnecessary changes

9041. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9042. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9043. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9044. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9045. By Chirag Dodiya(OpenERP)

[IMP]Improved demo and data file

9046. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9047. By Chirag Dodiya(OpenERP)

[REM]Removed _get_default_time_unit method and improved typo

9048. By Chirag Dodiya(OpenERP)

[FIX]Fixed issue the "service" product is not set by default on admin

9049. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

Unmerged revisions

9049. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9048. By Chirag Dodiya(OpenERP)

[FIX]Fixed issue the "service" product is not set by default on admin

9047. By Chirag Dodiya(OpenERP)

[REM]Removed _get_default_time_unit method and improved typo

9046. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9045. By Chirag Dodiya(OpenERP)

[IMP]Improved demo and data file

9044. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9043. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9042. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9041. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

9040. By Turkesh Patel (openERP)

[RMV] remove unnecessary changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_analytic_analysis/res_config.py'
2--- account_analytic_analysis/res_config.py 2012-12-06 14:56:32 +0000
3+++ account_analytic_analysis/res_config.py 2014-03-27 07:11:26 +0000
4@@ -20,6 +20,7 @@
5 ##############################################################################
6
7 from openerp.osv import fields, osv
8+from openerp.tools.translate import _
9
10 class sale_configuration(osv.osv_memory):
11 _inherit = 'sale.config.settings'
12@@ -28,4 +29,35 @@
13 'group_template_required': fields.boolean("Mandatory use of templates.",
14 implied_group='account_analytic_analysis.group_template_required',
15 help="Allows you to set the template field as required when creating an analytic account or a contract."),
16+ 'time_unit': fields.many2one('product.uom', 'The default working time unit.'),
17 }
18+
19+ def default_get(self, cr, uid, fields, context=None):
20+ ir_model_data = self.pool.get('ir.model.data')
21+ res = super(sale_configuration, self).default_get(cr, uid, fields, context)
22+ if res.get('module_project'):
23+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
24+ res['time_unit'] = user.company_id.project_time_mode_id.id
25+ else:
26+ product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
27+ if product and product.exists():
28+ res['time_unit'] = product.uom_id.id
29+ return res
30+
31+ def set_sale_defaults(self, cr, uid, ids, context=None):
32+ ir_model_data = self.pool.get('ir.model.data')
33+ wizard = self.browse(cr, uid, ids)[0]
34+
35+ if wizard.time_unit:
36+ product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
37+ if product and product.exists():
38+ product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
39+ else:
40+ _logger.warning("Product with xml_id 'product.product_product_consultant' not found, UoMs not updated!")
41+
42+ if wizard.module_project and wizard.time_unit:
43+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
44+ user.company_id.write({'project_time_mode_id': wizard.time_unit.id})
45+ return {}
46+
47+
48
49=== modified file 'account_analytic_analysis/res_config_view.xml'
50--- account_analytic_analysis/res_config_view.xml 2012-11-29 16:08:47 +0000
51+++ account_analytic_analysis/res_config_view.xml 2014-03-27 07:11:26 +0000
52@@ -13,6 +13,15 @@
53 <label for="group_template_required"/>
54 </div>
55 </xpath>
56+ <xpath expr="//label[@string='Default Options']" position="replace">
57+ <label for="id" string="Default Options" attrs="{'invisible':[('module_account_analytic_analysis','=',False)]}"/>
58+ </xpath>
59+ <div name='time_unit' position="replace">
60+ <div name='time_unit' attrs="{'invisible': [('module_account_analytic_analysis','=',False)],'required':[('module_account_analytic_analysis','=',True)]}">
61+ <label for="time_unit"/>
62+ <field name="time_unit" domain="[('category_id.name','=','Working Time')]" class="oe_inline"/>
63+ </div>
64+ </div>
65 </field>
66 </record>
67
68
69=== modified file 'hr_timesheet/hr_timesheet_data.xml'
70--- hr_timesheet/hr_timesheet_data.xml 2014-01-15 15:25:26 +0000
71+++ hr_timesheet/hr_timesheet_data.xml 2014-03-27 07:11:26 +0000
72@@ -8,13 +8,22 @@
73 <field name="type">general</field>
74 </record>
75
76+
77+ <!-- Service Product -->
78+ <record id="product.product_product_consultant" model="product.product">
79+ <field name="list_price">75.0</field>
80+ <field name="standard_price">30.0</field>
81+ <field name="uom_id" ref="product.product_uom_hour"/>
82+ <field name="uom_po_id" ref="product.product_uom_hour"/>
83+ <field name="name">Service</field>
84+ <field name="categ_id" ref="product.product_category_all"/>
85+ <field name="type">service</field>
86+ <field name="sale_ok">False</field>
87+ </record>
88+
89 <record id="hr.employee" model="hr.employee">
90 <field name="journal_id" ref="analytic_journal"/>
91- </record>
92-
93- <record id="product.product_product_consultant" model="product.product">
94- <field name="sale_ok">True</field>
95- </record>
96-
97+ <field name="product_id" ref="product.product_product_consultant"/>
98+ </record>
99 </data>
100 </openerp>
101
102=== modified file 'hr_timesheet/hr_timesheet_demo.xml'
103--- hr_timesheet/hr_timesheet_demo.xml 2013-10-27 12:31:04 +0000
104+++ hr_timesheet/hr_timesheet_demo.xml 2014-03-27 07:11:26 +0000
105@@ -2,10 +2,6 @@
106 <openerp>
107 <data noupdate="1">
108
109- <record id="hr.employee" model="hr.employee">
110- <field name="product_id" ref="product.product_product_consultant"/>
111- <field name="journal_id" ref="analytic_journal"/>
112- </record>
113
114 <!-- complete our example employee -->
115 <record id="hr.employee_fp" model="hr.employee">
116@@ -89,6 +85,15 @@
117 <field name="general_account_id" ref="account.a_expense"/>
118 <field name="journal_id" ref="analytic_journal"/>
119 </record>
120+
121+ <record id="product.product_product_consultant" model="product.product">
122+ <field name="categ_id" ref="product.product_category_5"/>
123+ <field name="sale_ok" eval="True"/>
124+ </record>
125+ <!-- service product Image -->
126+ <record id="product.product_product_consultant" model="product.product">
127+ <field name="image" type="base64" file="hr_timesheet/static/img/product_product_consultant-image.jpg"/>
128+ </record>
129
130 </data>
131 </openerp>
132
133=== added directory 'hr_timesheet/static'
134=== added directory 'hr_timesheet/static/img'
135=== renamed file 'product/static/img/product_product_consultant-image.jpg' => 'hr_timesheet/static/img/product_product_consultant-image.jpg'
136=== modified file 'hr_timesheet/test/test_hr_timesheet.yml'
137--- hr_timesheet/test/test_hr_timesheet.yml 2013-10-27 12:31:04 +0000
138+++ hr_timesheet/test/test_hr_timesheet.yml 2014-03-27 07:11:26 +0000
139@@ -14,6 +14,8 @@
140 name: Gilles Gravie
141 parent_id: 'hr.employee_al'
142 user_id: 'base.user_demo'
143+ product_id: product.product_product_consultant
144+ journal_id: hr_timesheet.analytic_journal
145 -
146 Give the access rights of Employee to Sign In/Sign Out in Project.
147 -
148
149=== modified file 'product/product_data.xml'
150--- product/product_data.xml 2014-02-07 15:13:20 +0000
151+++ product/product_data.xml 2014-03-27 07:11:26 +0000
152@@ -236,20 +236,6 @@
153 <field name="digits" eval="3"/>
154 </record>
155
156- <!--
157- Product
158- -->
159- <record id="product_product_consultant" model="product.product">
160- <field name="list_price">75.0</field>
161- <field name="standard_price">30.0</field>
162- <field name="uom_id" ref="product.product_uom_hour"/>
163- <field name="uom_po_id" ref="product.product_uom_hour"/>
164- <field name="name">Service</field>
165- <field name="categ_id" ref="product.product_category_all"/>
166- <field name="type">service</field>
167- <field name="sale_ok" eval="False"/>
168- </record>
169-
170 <!-- Product Public Categories -->
171 <record id="categ_others" model="product.public.category">
172 <field name="name">Others</field>
173
174=== modified file 'product/product_demo.xml'
175--- product/product_demo.xml 2014-01-26 20:43:34 +0000
176+++ product/product_demo.xml 2014-03-27 07:11:26 +0000
177@@ -205,11 +205,6 @@
178 Resource: product.product
179 -->
180
181- <record id="product_product_consultant" model="product.product">
182- <field name="categ_id" ref="product.product_category_5"/>
183- <field name="sale_ok" eval="True"/>
184- </record>
185-
186 <record id="product_template_1" model="product.template">
187 <field name="name">On Site Monitoring</field>
188 <field name="categ_id" ref="product_category_5"/>
189
190=== modified file 'product/product_image_demo.xml'
191--- product/product_image_demo.xml 2014-01-17 07:00:28 +0000
192+++ product/product_image_demo.xml 2014-03-27 07:11:26 +0000
193@@ -2,10 +2,6 @@
194 <openerp>
195 <data noupdate="false">
196
197- <record id="product_product_consultant" model="product.product">
198- <field name="image" type="base64" file="product/static/img/product_product_consultant-image.jpg"/>
199- </record>
200-
201 <record id="product_product_1" model="product.product">
202 <field name="image" type="base64" file="product/static/img/product_product_1-image.jpg"/>
203 </record>
204
205=== modified file 'purchase/purchase_demo.xml'
206--- purchase/purchase_demo.xml 2012-11-29 22:26:45 +0000
207+++ purchase/purchase_demo.xml 2014-03-27 07:11:26 +0000
208@@ -14,9 +14,6 @@
209 <field eval="80.0" name="schedule_range"/>
210 </record>
211
212- <record id="product.product_product_consultant" model="product.product">
213- <field eval="False" name="purchase_ok"/>
214- </record>
215 </data>
216 </openerp>
217
218
219=== modified file 'sale/res_config.py'
220--- sale/res_config.py 2014-01-29 05:35:33 +0000
221+++ sale/res_config.py 2014-03-27 07:11:26 +0000
222@@ -71,7 +71,6 @@
223 '(650€/day for a developer), the duration (one year support contract).\n'
224 'You will be able to follow the progress of the contract and invoice automatically.\n'
225 '-It installs the account_analytic_analysis module.'),
226- 'time_unit': fields.many2one('product.uom', 'The default working time unit for services is'),
227 'group_sale_pricelist':fields.boolean("Use pricelists to adapt your price per customers",
228 implied_group='product.group_sale_pricelist',
229 help="""Allows to manage different prices based on rules per category of customers.
230@@ -113,42 +112,6 @@
231 help="Allows you to specify different delivery and invoice addresses on a sales order."),
232 }
233
234- def default_get(self, cr, uid, fields, context=None):
235- ir_model_data = self.pool.get('ir.model.data')
236- res = super(sale_configuration, self).default_get(cr, uid, fields, context)
237- if res.get('module_project'):
238- user = self.pool.get('res.users').browse(cr, uid, uid, context)
239- res['time_unit'] = user.company_id.project_time_mode_id.id
240- else:
241- product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
242- if product and product.exists():
243- res['time_unit'] = product.uom_id.id
244- return res
245-
246- def _get_default_time_unit(self, cr, uid, context=None):
247- ids = self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=context)
248- return ids and ids[0] or False
249-
250- _defaults = {
251- 'time_unit': _get_default_time_unit,
252- }
253-
254- def set_sale_defaults(self, cr, uid, ids, context=None):
255- ir_model_data = self.pool.get('ir.model.data')
256- wizard = self.browse(cr, uid, ids)[0]
257-
258- if wizard.time_unit:
259- product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
260- if product and product.exists():
261- product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
262- else:
263- _logger.warning("Product with xml_id 'product.product_product_consultant' not found, UoMs not updated!")
264-
265- if wizard.module_project and wizard.time_unit:
266- user = self.pool.get('res.users').browse(cr, uid, uid, context)
267- user.company_id.write({'project_time_mode_id': wizard.time_unit.id})
268- return {}
269-
270 def onchange_task_work(self, cr, uid, ids, task_work, context=None):
271 return {'value': {
272 'module_project_timesheet': task_work,
273
274=== modified file 'sale/res_config_view.xml'
275--- sale/res_config_view.xml 2014-01-25 23:08:47 +0000
276+++ sale/res_config_view.xml 2014-03-27 07:11:26 +0000
277@@ -22,12 +22,9 @@
278 </div>
279 </group>
280 <group name='default_options'>
281- <label for="id" string="Default Options" attrs="{'invisible':[('module_account_analytic_analysis','=',False)]}"/>
282+ <label for="id" string="Default Options" invisible="1"/>
283 <div>
284- <div name='time_unit' attrs="{'invisible': [('module_account_analytic_analysis','=',False)],'required':[('module_account_analytic_analysis','=',True)]}">
285- <label for="time_unit"/>
286- <field name="time_unit" domain="[('category_id.name','=','Working Time')]" class="oe_inline"/>
287- </div>
288+ <div name='time_unit'/>
289 </div>
290 </group>
291 </div>
292
293=== modified file 'sale/sale_demo.xml'
294--- sale/sale_demo.xml 2014-01-17 07:00:28 +0000
295+++ sale/sale_demo.xml 2014-03-27 07:11:26 +0000
296@@ -52,7 +52,6 @@
297 <record id="sale_order_line_4" model="sale.order.line">
298 <field name="order_id" ref="sale_order_2"/>
299 <field name="name">Service on demand</field>
300- <field name="product_id" ref="product.product_product_consultant"/>
301 <field name="product_uom_qty">24</field>
302 <field name="product_uos_qty">24</field>
303 <field name="product_uom" ref="product.product_uom_hour"/>
304@@ -109,7 +108,6 @@
305 <record id="sale_order_line_8" model="sale.order.line">
306 <field name="order_id" ref="sale_order_4"/>
307 <field name="name">Service on demand</field>
308- <field name="product_id" ref="product.product_product_consultant"/>
309 <field name="product_uom_qty">16</field>
310 <field name="product_uos_qty">16</field>
311 <field name="product_uom" ref="product.product_uom_hour"/>
312
313=== modified file 'sale_stock/res_config.py'
314--- sale_stock/res_config.py 2014-01-15 11:05:47 +0000
315+++ sale_stock/res_config.py 2014-03-27 07:11:26 +0000
316@@ -78,8 +78,7 @@
317
318 default_picking_policy = 'one' if wizard.default_picking_policy else 'direct'
319 ir_values.set_default(cr, SUPERUSER_ID, 'sale.order', 'picking_policy', default_picking_policy)
320- res = super(sale_configuration, self).set_sale_defaults(cr, uid, ids, context)
321- return res
322+ return {}
323
324 def onchange_invoice_methods(self, cr, uid, ids, group_invoice_so_lines, group_invoice_deli_orders, context=None):
325 if not group_invoice_deli_orders:
326
327=== modified file 'sale_stock/res_config_view.xml'
328--- sale_stock/res_config_view.xml 2014-01-15 11:05:47 +0000
329+++ sale_stock/res_config_view.xml 2014-03-27 07:11:26 +0000
330@@ -56,12 +56,6 @@
331 <field name="group_invoice_so_lines" position="replace">
332 <field name="group_invoice_so_lines" on_change="onchange_invoice_methods(group_invoice_so_lines, group_invoice_deli_orders)" class="oe_inline"/>
333 </field>
334- <xpath expr="//div[@name='time_unit']" position="replace">
335- <div attrs="{'invisible': [('task_work','=',False), ('module_account_analytic_analysis','=',False)],'required': ['|', ('task_work','=',True), ('module_account_analytic_analysis','=',True)]}">
336- <label for="time_unit"/>
337- <field name="time_unit" domain="[('category_id.name','=','Working Time')]" class="oe_inline"/>
338- </div>
339- </xpath>
340 </data>
341 </field>
342 </record>
343
344=== modified file 'website_sale/data/website_sale_demo.xml'
345--- website_sale/data/website_sale_demo.xml 2014-01-30 23:32:40 +0000
346+++ website_sale/data/website_sale_demo.xml 2014-03-27 07:11:26 +0000
347@@ -2,10 +2,6 @@
348 <openerp>
349 <data noupdate="1">
350
351- <record id="product.product_product_consultant" model="product.product">
352- <field name="image" type="base64" file="website/static/description/website_edit.png"/>
353- </record>
354-
355 <record id="product.product_product_4" model="product.product">
356 <field name="website_published" eval="True"/>
357 <field name="website_size_x">2</field>

Subscribers

People subscribed via source and target branches

to all changes: