Odoo 도움말

2

0
2 응답
2
Avatar

Axel Mendoza 쿠바

--Axel Mendoza--
14051
| 8 8 10
Camaguey, 쿠바
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza 쿠바
16. 2. 4. 오전 4:07

@Yenthe

Take this code of one of our modules as example, The code in bold is like do it all for me with just the object and the context vars:

def send_notifications(self, cr, uid, ids, context=None):

template_pool = self.pool.get('email.template')

template = self.pool.get('ir.model.data').get_object(cr, uid, 'solt_maintenance_preventive', 'solt_maintenance_remind_email')

assert template._name == 'email.template'

if context == None:

context = {}

res_groups_pool = self.pool.get('res.groups')

emails_send = []

group_id = self.pool.get('ir.model.data').get_object_reference(cr, SUPERUSER_ID,

'solt_maintenance', 'group_maintenance_planner')

if group_id:

for users_obj in res_groups_pool.browse(cr,uid,group_id[1],context=context).users:

if users_obj.email:

emails_send.append(users_obj.email)

context['email_send'] = ",".join(emails_send)

for sched in ids:

msg_id = template_pool.send_mail(cr, uid, template.id, sched, True, context=context)

The template used is here:

<record id="solt_maintenance_remind_email" model="email.template">

<field name="name">Maintenance Remind Email</field>

<field name="model_id" ref="model_solt_maintenance_schedule" />

<field name="email_from"><![CDATA[${object.object_id.company_id.name} <${object.object_id.company_id.email}>]]></field>

<field name="email_to">${ctx.email_send}</field>

<field name="subject">[Recordatorio] Intervención de mantenimiento para:

${object.object_id.name}</field>

<field name="body_html"><![CDATA[

<p>Se ha determinado que al objetivo ${object.object_id.name} se le debe proporcionar mantenimiento de acuerdo a su programacion.</p>

]]></field>

</record>

질문하기
Keep Informed
0 팔로워
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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now