Merge lp:~vauxoo/addons-vauxoo/6.0-mrp_consume_invisible-dev_luis into lp:addons-vauxoo/6.0

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 531
Proposed branch: lp:~vauxoo/addons-vauxoo/6.0-mrp_consume_invisible-dev_luis
Merge into: lp:addons-vauxoo/6.0
Diff against target: 54 lines (+8/-6)
2 files modified
mrp_consume_produce/mrp.py (+6/-4)
mrp_consume_produce/mrp_consume_produce_view.xml (+2/-2)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/6.0-mrp_consume_invisible-dev_luis
Reviewer Review Type Date Requested Status
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+204097@code.launchpad.net

Description of the change

Se agregaron atributos en los botones agregaros por mrp_consume_produce, para que se muestren únicamente en el momento que se deben de mostrar.

To post a comment you must log in.
532. By Luis Torres - http://www.vauxoo.com

[FIX][mrp_consume_produce]Change validations

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp_consume_produce/mrp.py'
2--- mrp_consume_produce/mrp.py 2014-01-16 18:45:04 +0000
3+++ mrp_consume_produce/mrp.py 2014-01-31 22:43:09 +0000
4@@ -33,8 +33,8 @@
5 def _check_boolean(self,cr,uid,ids,field_name,args,context={}):
6 res = {}
7 for production in self.browse(cr,uid,ids,context=context):
8- moves = [move for move in production.move_lines]
9- if len(moves)==0 and production.state<>'draft':
10+ moves = [move for move in production.move_lines2]
11+ if len(moves)>0 and production.state<>'draft':
12 res[production.id]=True
13 else:
14 res[production.id]=False
15@@ -50,13 +50,15 @@
16 def _check_len_move_prod(self,cr,uid,ids,field_name,args,context={}):
17 res = {}
18 for production in self.browse(cr,uid,ids,context=context):
19- res[production.id]=len(production.move_created_ids2)
20+ res[production.id] = False
21+ if len(production.move_created_ids2) > 0:
22+ res[production.id] = True
23 return res
24
25 _columns = {
26 'consumed' : fields.function(_check_boolean, method=True, string='consumed?', type='boolean', help="indicates if product to consume have been consumed or canceled"),
27 'len_move' : fields.function(_check_len_move, method=True, string='moves', type='float'),
28- 'len_move_prod' : fields.function(_check_len_move_prod, method=True, string='produced', type='integer',),
29+ 'len_move_prod' : fields.function(_check_len_move_prod, method=True, string='produced', type='boolean',),
30 }
31
32 def action_finished_consume(self,cr,uid,ids,context={}):
33
34=== modified file 'mrp_consume_produce/mrp_consume_produce_view.xml'
35--- mrp_consume_produce/mrp_consume_produce_view.xml 2014-01-16 18:45:04 +0000
36+++ mrp_consume_produce/mrp_consume_produce_view.xml 2014-01-31 22:43:09 +0000
37@@ -21,7 +21,7 @@
38 </xpath>
39
40 <xpath expr="/form/notebook/page[@string='Consumed Products']/group/button[@name='%(create_consume_action)d']" position="after">
41- <button name="action_finished_consume" states="in_production" string="Finished Consumed" icon="gtk-convert" type="object"/>
42+ <button name="action_finished_consume" string="Finished Consumed" icon="gtk-convert" type="object" attrs="{'invisible': ['|','|',('consumed','=',False),('state','!=','in_production'),('moves_lines2','=',0)]}"/>
43 </xpath>
44
45 <xpath expr="/form/notebook/page[@string='Finished Products']" position="inside">
46@@ -29,7 +29,7 @@
47 </xpath>
48
49 <xpath expr="/form/notebook/page[@string='Finished Products']" position="inside">
50- <button name="action_finish" states="in_production" string="Finish Production" icon="gtk-ok" type="object"/>
51+ <button name="action_finish" string="Finish Production" icon="gtk-ok" type="object" attrs="{'invisible': ['|','|',('consumed','=',False),('state','=','done'),('len_move_prod','=',0)]}"/>
52 </xpath>
53
54 <xpath expr="/form/group/field[@name='origin']" position="after">

Subscribers

People subscribed via source and target branches

to all changes: