Skip to content

Commit

Permalink
Use a view action instead of a method
Browse files Browse the repository at this point in the history
  • Loading branch information
guewen committed May 29, 2017
1 parent 3c71ced commit 2b68d38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sale_line_cost_control/__manifest__.py
Expand Up @@ -13,8 +13,8 @@
],
'website': 'https://www.camptocamp.com',
'data': ['security/security.xml',
'views/sale_views.xml',
'wizards/set_sale_line_purchase_price_views.xml',
'views/sale_views.xml',
],
'installable': True,
}
7 changes: 0 additions & 7 deletions sale_line_cost_control/models/sale.py
Expand Up @@ -22,10 +22,3 @@ def _compute_purchase_price_missing(self):
line.purchase_price,
precision_digits=precision
)

@api.multi
def action_set_purchase_price_on_line(self):
self.ensure_one()
action_xmlid = ('sale_line_cost_control.'
'action_set_sale_line_purchase_price')
return self.env.ref(action_xmlid).read()[0]
4 changes: 2 additions & 2 deletions sale_line_cost_control/views/sale_views.xml
Expand Up @@ -7,9 +7,9 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree/field[@name='purchase_price']" position="after">
<field name="purchase_price_missing" invisible="1"/>
<button type="object"
<button type="action"
class="btn-link oe_read_only"
name="action_set_purchase_price_on_line"
name="%(action_set_sale_line_purchase_price)d"
attrs="{'invisible': [('purchase_price_missing', '=', False)]}"
groups="base.group_user"
string="Set Cost"
Expand Down

0 comments on commit 2b68d38

Please sign in to comment.