Use active_ids in relate actions

This commit is contained in:
Sergi Almacellas Abellana 2014-05-29 18:22:14 +02:00
parent c08d26758d
commit ebbbcc0bbb
3 changed files with 10 additions and 2 deletions

View file

@ -10,6 +10,7 @@ def register():
Pool.register(
Sale,
SaleLine,
Work,
Product,
ConfigurationCompany,
Configuration,

View file

@ -5,7 +5,7 @@ from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
from trytond.pyson import Eval, Bool
__all__ = ['Sale', 'SaleLine', 'ConfigurationCompany', 'Configuration']
__all__ = ['Sale', 'SaleLine', 'ConfigurationCompany', 'Configuration', 'Work']
__metaclass__ = PoolMeta
PROJECT_METHODS = [
@ -163,3 +163,10 @@ class SaleLine():
def create_works(cls, lines):
for line in lines:
line.create_work()
class Work():
__name__ = 'project.work'
sale_lines = fields.One2Many('sale.line', 'work', 'Sale Lines',
readonly=True)

View file

@ -17,7 +17,7 @@
<record model="ir.action.act_window" id="act_work_form">
<field name="name">Project/Task</field>
<field name="res_model">project.work</field>
<field name="domain">[('id', '=', Eval('work'))]</field>
<field name="domain">[('sale_lines', 'in', Eval('active_ids'))]</field>
</record>
<record model="ir.action.keyword" id="act_work_keyword1">
<field name="keyword">form_relate</field>