Skip to content

Commit

Permalink
[FIX] sale_service: add missing link between task and SO
Browse files Browse the repository at this point in the history
  • Loading branch information
bouvyd committed Jan 18, 2016
1 parent 0a23003 commit 40f2987
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addons/sale_service/models/sale_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ def unlink(self, cr, uid, ids, context=None):
res = super(project_task, self).unlink(cr, uid, ids, context)
return res

def action_view_so(self, cr, uid, ids, context=None):
task = self.browse(cr, uid, ids, context=context)[0]
return {
"type": "ir.actions.act_window",
"res_model": "sale.order",
"views": [[False, "form"]],
"res_id": task.sale_line_id.order_id.id,
"context": {"create": False},
}


class ProductProduct(models.Model):
_inherit = 'product.product'
Expand Down
6 changes: 6 additions & 0 deletions addons/sale_service/views/sale_service_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button type="object" name="action_view_so"
class="oe_stat_button" icon="fa-dollar"
attrs="{'invisible': [('sale_line_id', '=', False)]}"
string="Sales Order"/>
</xpath>
<field name="company_id" position="before">
<field name="sale_line_id" string="Order Line" groups="base.group_no_one"/>
</field>
Expand Down

0 comments on commit 40f2987

Please sign in to comment.