Tryton Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(63)

Issue 483002: trytond: Merge all kind of buttons (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
6 years, 7 months ago by ced
Modified:
6 years, 6 months ago
Reviewers:
albert-nan
Visibility:
Public.

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+253 lines, -205 lines) Patch
M CHANGELOG View 1 chunk +1 line, -0 lines 0 comments Download
M doc/ref/models/models.rst View 1 chunk +5 lines, -0 lines 0 comments Download
M trytond/ir/module/module.xml View 2 chunks +10 lines, -20 lines 0 comments Download
M trytond/ir/ui/form.rnc View 1 chunk +0 lines, -4 lines 0 comments Download
M trytond/ir/ui/form.rng View 1 chunk +0 lines, -15 lines 0 comments Download
M trytond/ir/ui/tree.rnc View 1 chunk +0 lines, -4 lines 0 comments Download
M trytond/ir/ui/tree.rng View 1 chunk +0 lines, -15 lines 0 comments Download
M trytond/ir/ui/view.py View 2 chunks +7 lines, -0 lines 7 comments Download
M trytond/ir/ui/view.xml View 1 chunk +1 line, -5 lines 0 comments Download
M trytond/model/modelview.py View 2 chunks +31 lines, -13 lines 0 comments Download
M trytond/modules/account/fiscalyear.xml View 2 chunks +4 lines, -6 lines 0 comments Download
M trytond/modules/account/move.xml View 1 chunk +2 lines, -3 lines 0 comments Download
M trytond/modules/account_invoice/invoice.py View 3 chunks +10 lines, -1 line 0 comments Download
M trytond/modules/account_invoice/invoice.xml View 1 chunk +1 line, -6 lines 0 comments Download
M trytond/modules/account_statement/statement.xml View 1 chunk +5 lines, -8 lines 0 comments Download
M trytond/modules/ldap_connection/connection.py View 2 chunks +10 lines, -0 lines 0 comments Download
M trytond/modules/ldap_connection/connection.xml View 1 chunk +2 lines, -2 lines 0 comments Download
M trytond/modules/production/production.py View 2 chunks +9 lines, -0 lines 0 comments Download
M trytond/modules/production/production.xml View 1 chunk +6 lines, -8 lines 0 comments Download
M trytond/modules/purchase/purchase.py View 3 chunks +21 lines, -1 line 0 comments Download
M trytond/modules/purchase/purchase.xml View 1 chunk +6 lines, -10 lines 0 comments Download
M trytond/modules/sale/sale.py View 3 chunks +21 lines, -1 line 0 comments Download
M trytond/modules/sale/sale.xml View 1 chunk +11 lines, -15 lines 0 comments Download
M trytond/modules/sale_opportunity/opportunity.xml View 1 chunk +5 lines, -9 lines 0 comments Download
M trytond/modules/stock/inventory.xml View 2 chunks +3 lines, -3 lines 0 comments Download
M trytond/modules/stock/period.xml View 1 chunk +2 lines, -2 lines 0 comments Download
M trytond/modules/stock/shipment.py View 6 chunks +27 lines, -0 lines 0 comments Download
M trytond/modules/stock/shipment.xml View 5 chunks +24 lines, -35 lines 0 comments Download
M trytond/modules/stock_forecast/forecast.py View 2 chunks +7 lines, -0 lines 0 comments Download
M trytond/modules/stock_forecast/forecast.xml View 2 chunks +4 lines, -6 lines 0 comments Download
M trytond/modules/stock_split/stock.py View 1 chunk +12 lines, -0 lines 0 comments Download
M trytond/modules/stock_split/stock.xml View 2 chunks +3 lines, -7 lines 0 comments Download
M trytond/res/request.xml View 1 chunk +3 lines, -6 lines 0 comments Download

Messages

Total messages: 8
ced
6 years, 7 months ago (2012-08-22 17:17:49 UTC) #1
albert-nan
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py File trytond/ir/ui/view.py (right): http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76 trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show') What's the advantage of creating a decorator instead ...
6 years, 7 months ago (2012-08-22 22:04:05 UTC) #2
ced
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py File trytond/ir/ui/view.py (right): http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76 trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show') On 2012/08/22 22:04:06, albert-nan wrote: > What's the ...
6 years, 7 months ago (2012-08-22 23:08:05 UTC) #3
albert-nan
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py File trytond/ir/ui/view.py (right): http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76 trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show') On 2012/08/22 23:08:05, ced wrote: > On 2012/08/22 ...
6 years, 7 months ago (2012-08-23 09:51:43 UTC) #4
ced
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py File trytond/ir/ui/view.py (right): http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76 trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show') On 2012/08/23 09:51:43, albert-nan wrote: > On 2012/08/22 ...
6 years, 7 months ago (2012-08-23 09:59:12 UTC) #5
albert-nan
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py File trytond/ir/ui/view.py (right): http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76 trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show') On 2012/08/23 09:59:12, ced wrote: > On 2012/08/23 ...
6 years, 7 months ago (2012-08-23 10:19:58 UTC) #6
albert-nan
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py File trytond/ir/ui/view.py (right): http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76 trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show') On 2012/08/23 10:19:59, albert-nan wrote: > On 2012/08/23 ...
6 years, 7 months ago (2012-08-23 10:22:57 UTC) #7
ced
6 years, 7 months ago (2012-08-23 10:27:57 UTC) #8
http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py
File trytond/ir/ui/view.py (right):

http://codereview.tryton.org/483002/diff/1/trytond/ir/ui/view.py#newcode76
trytond/ir/ui/view.py:76: @ModelView.button_action('ir.act_view_show')
On 2012/08/23 10:22:57, albert-nan wrote:
> On 2012/08/23 10:19:59, albert-nan wrote:
> > On 2012/08/23 09:59:12, ced wrote:
> > > On 2012/08/23 09:51:43, albert-nan wrote:
> > > > On 2012/08/22 23:08:05, ced wrote:
> > > > > On 2012/08/22 22:04:06, albert-nan wrote:
> > > > > > What's the advantage of creating a decorator instead of simply
> providing
> > a
> > > > > > function that returns the value?
> > > > > > 
> > > > > > Something like this:
> > > > > > 
> > > > > > @ModelView.button
> > > > > > def show(self, ids):
> > > > > >     return self.action('ir.act_view_show')
> > > > > 
> > > > > I find it more explicit and coherent with the existing
ModelView.button
> > > > > decorator.
> > > > 
> > > > IMHO a return makes it explicit that the function must return an ID.
> > > 
> > > We don't care, implementation in the future could change.
> > > 
> > > > Also, it
> > > > makes it optional having a ir.model.data record for the action which may
> not
> > > > necessarily exist if the action was created dynamically (of course it
> could
> > be
> > > > created). 
> > > 
> > > Not possible to use dynamically created action, you must have an id.
> > > And if you don't have XML id for it, then just return it because it is not
> > > mandatory to use the decorator.
> > > 
> > > > It also avoid having a hard-coded model in the code:
> > > 
> > > Don't understand.
> > 
> > I meant a hard-coded ir.model.data text. As you said it is not mandatory to
> use
> > the decorator, but I find it cleaner if all button actions have the same
> > structure. Of course, it is a matter of taste.
> > 
> > BTW, what happens with decorators when the function is inherited? What is
the
> > calling order? Must the developer create a decorator for the new
(inheriting)
> > function? What if the ir.model.data must be changed?
> 
> Thinking about it.. I suppose the decorator of the inherited function is
called
> when/if "super" is called form the inheriting one. Is it right?
> 

Yes.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 0147766