Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
Place two models on one view
Hello all. I need to do some interesting feature, and I hope you help me. I have some models with dates, for example project, task, resource.leaves, my custom models, etc. And my customer wants to see all this records on one gantt-view. For example, if I need to place task, I need to see resource.leaves to prevent placing task in busy employee's time. Openerp documentation says it is impossible. But this is nesessary feature, and in spite of documentation I will trying to realize this. May be somebody already released this, or have been trying to release - I will glad to see your experience.
Thank you, I forgot about this possibility. I have tried to do this, and it is working. If you are interesting, this is example of code (it is data from crm module. Report contains phonecalls, meeting and lead events on one calendar view):
report.py:
from osv import fields,osv
import tools
class crm_summary(osv.osv):
<tab indent must be started here>
_name = "crm.summary"
_auto = False
_columns = {
'type': fields.char('Type', size=128, readonly=True),
'name': fields.char('Name', size=512, readonly=True),
'date': fields.datetime('Date', readonly=True),
}
_order = "date DESC"
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'crm_summary')
cr.execute("""
CREATE view crm_summary as
(SELECT l.id || 'l' as id,
'lead' as type,
l.title_action as name,
l.date_action as date
FROM crm_lead l
GROUP BY l.id, type, l.title_action, l.date_action
)
UNION
(SELECT c.id || 'c' as id,
'call' as type,
c.name as name,
c.date as date
FROM crm_phonecall c
GROUP BY c.id, type, c.name, c.date
)
UNION(
SELECT m.id || 'm' as id,
'meeting' as type,
m.name as name,
m.date as date
FROM crm_meeting m
GROUP BY m.id, type, m.name, m.date
)
""")
<tab indent must be ended here>
crm_summary()
report.xml:
<record id="crm_summary_calendar" model="ir.ui.view">
<field name="name">Crm summary calendar</field>
<field name="model">crm.summary</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar string="Crm summary" color="type" date_start="date">
<field name="name"/>
</calendar>
</field>
</record>
This doesn't work: the ids seems to overlap, and the tree view show only the last model added by union directive.
You can use Super_calendar module. you can see it here. https://launchpad.net/server-env-tools
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 4/18/13, 6:07 PM |
Seen: 8566 times |
Last updated: 10/6/17, 9:42 AM |