How to send mail for multiple users(CC) through code? - email

This is the code I am trying currently for one person
def send_mail_employee(self,cr,uid,ids,context=None):
record_obj = self.browse(cr,uid,ids,context=context)
ir_model_data = self.pool.get('ir.model.data')
template_obj = self.pool.get('email.template')
attch_ids = []
for rec in record_obj:
if not rec.name.work_email:
raise osv.except_osv(_('Warning!'), _('Please configure employee email address!'))
else:
for attch in rec.attchment_lines:
attch_ids.append(attch.id)
template_id = ir_model_data.get_object_reference(cr,uid,'registers', 'email_template_register_courier')[1]
self.pool.get('email.template').write(cr,uid,template_id,{'body_html' : rec.email_body,'subject' : rec.subject,'attachment_ids':[(6,0,attch_ids)]})
self.pool.get('email.template').send_mail(cr,uid,template_id,rec.id,force_send=True,context=context)
raise osv.except_osv(_('Success'), _('Mail has been sent successfully'))
return True
and the template is like this
<openerp>
<data>
<!--Email template for Register Courier-->
<record id="email_template_register_courier" model="email.template">
<field name="name">Notification for Courier</field>
<field name="email_from">${object.name.work_email}</field>
<field name="subject">Notification for Courier</field>
<field name="email_to">${object.name.work_email}</field>
<field name="email_cc">${object.cc.work_email}</field>
<field name="model_id" ref="model_registers_courierin"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name.name},</p>
<p>This email is to inform you that your courier received</p>
<P>Thank you</p>
</div>
]]>
</field>
</record>
</data>
</openerp>
Now i have created a one2many field like a tree view named as 'ref_cc', i want to send the whole record to those list of persons in the email cc by code.Any idea would be really helpful.

Related

salesforce lightening Page- Disable Aura popup component

I added one aura component to Opportunity lightening page. when doInit method start then That aura component will display popup component. I added some visibility filter conditions to that aura component so when conditions are met then component will display.
if i open opportunity record page in edit page mode then aura popup component is displaying.
Question : what is the best way to disable popup in page edit mode only.
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction"
access="global"
controller='CustomerProductRequirementsController'>
<aura:attribute name="isOpen" type="boolean" default="false" />
<aura:attribute name="areThereCPReqs" type="boolean" default="false" />
<aura:attribute name="disablebutton" type="boolean" default="false" />
<aura:attribute name="toggleSpinner" type="boolean" default="false"/>
<!--aura:attribute name="test" type="string" default="nothing"/-->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!--h1>info-{!v.test} </h1-->
<aura:if isTrue="{!v.isOpen}" >
<div style="height:640px">
<section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<div class="slds-modal__content slds-p-around_medium" style="width:80%" id="modal-content-id-1">
<span class="slds-m-left_xx-large"><b>Are there customer product requirements? </b></span>
<lightning:button label="Yes" class="slds-button slds-button_brand slds-m-left_medium" onclick="{!c.handleYesORNoAction}" name="YES" disabled="{!v.disablebutton}"/>
<lightning:button label="No" class="slds-button slds-button_brand slds-m-left_small" onclick="{!c.handleYesORNoAction}" name="NO" disabled="{!v.disablebutton}"/>
<aura:if isTrue="{!v.toggleSpinner}">
<div class="slds-spinner slds-spinner_xx-small " role="alert" style="position:absolute;top:50%;left:5%;" aura:id="toggleSpinner" >
<lightning:spinner alternativeText="Loading" size="small" />
</div>
</aura:if>
</div>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open"></div>
</div>
</aura:if>
</aura:component>
**controller.js **
({
doInit: function(component, event, helper) {
component.set("v.isOpen", true);
},
handleYesORNoAction: function(component, event, helper) {
helper.Helper_CreateGCSRRecords(component,event);
component.set("v.disablebutton",true);
component.set("v.toggleSpinner", true);
},
})

How to display One2many field's view in my custom view?

My ticket has many comments and I created a view for my comment and make a One2Many field in ticket model. But it is not displaying my desired view. Here is my model
class Ticket(model.Model):
_name = 'Tickets'
comment_ids = fields.One2many('comments', 'comment_id')
Here my second model
class Comments(models.Model):
_name = 'comments'
comment = fields.Text(string="Comment")
comment_id = fields.Char(string='Comment Id')
Here is my Ticket's View:
<notebook>
<page name="body" string="Body">
<field name="comment_ids" />
</page>
</notebook>
Here is my Comment's Form View:
<form>
<div class="form-group">
<label name="comment">Comment:</label>
<textarea class="form-control" rows="5" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Here is my Comment's Tree View:
<tree>
<field name = 'comment_id'/>
<field name = 'comment'/>
</tree>
If your comment model have more than one tree view or form view, if you don't specify
witch view you want to display Odoo will compute the one with the highest priority:
so just specify the id of the tree view in your one2many field
<field name="comment_ids" context="{'tree_view_ref': 'your_app.tree_view_xml_id', 'form_view_ref': 'your_app.form_view_xml_id'}"/>
Or you can use embedded view:
<field name="comment_ids">
<tree>
<field name = 'comment_id'/>
<field name = 'comment'/>
</tree>
<form>
<div class="form-group">
<label name="comment">Comment:</label>
<textarea class="form-control" rows="5" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</field>
Note: if you have only this two views this means that Odoo didn't load this views so check if the XML file is in the manifest file and make sure you upgrade your module.

Which versioning control system is using XTL files ? SW identification

I'm trying to identify versioning system by folder structure. I've got this project from our new customer and he has no idea about anything. I need help with software identification, so I can browse the sources. Repo struct. is as following:
.index contains SQLite3 DB
There is a lot of .xtl files in within these folders. I tried Mercurial, but it's not Mercurial repo. Please help me with identification.
XTL file content example:
<t:content lang="en-us" style="background-image:url('/svc/stream/media/coffee_strip');background-position:left top;background-size:auto;background-repeat:repeat-x;background-attachment:scroll;" styleClass="cover-and-fit fix-alt" xmlns:t="uri:t">
<div class="grid grid-gutter-large">
<div class="grid-row">
<div class="grid-col ice-container box-shadow grid-one-fifth" style="background-image: url("/svc/stream/media/paper_background"); background-attachment: scroll; background-size: auto; background-position: left top; background-repeat: no-repeat;">
<div class="ice-content align-center small-padding-top small-padding-bottom">
<t:link href="/en"><t:img height="100" src="/media/DC_logo_new" width="95"/></t:link>
</div>
</div>
<div class="grid-col ice-container grid-four-fifths">
<div class="grid"><div class="grid-row"><div class="grid-col ice-container grid-three-fourths"><t:module class="Menu" function="display" styleClass="small-padding-top mini-margin-top align-center cs-inversed">
<t:prop name="root" value="auto"/>
<t:prop name="template" value="horizontal"/>
<t:prop name="style" value="clean"/>
<t:prop name="mobileTemplate" value="off-canvas-left"/>
<t:prop name="startlevel" value="1"/>
<t:prop name="maxdepth" value="0"/>
<t:prop name="mobileToggle" value="with-text"/>
<t:prop name="limit" value="none"/>
<t:prop name="fillAllSpace" value="false"/>
</t:module></div><div class="grid-col ice-container grid-one-fourth"><t:module class="product" function="myCart" styleClass="none-margin-bottom small-padding-bottom small-padding-top small-margin-top align-center cs-inversed"/></div></div></div>
</div>
</div>
</div>
</t:content>

Odoo Email Template Customization

I have Odoo version 10. I want to edit Quotation Email Header and Footer. I want to change
Header Background Color
Footer Background Color
Remove Powered by Odoo
I tried to search every template. but I could not find it.
Your help is appreciated.
Thanks
Override the Email template form sale
<record id="sale.email_template_edi_sale" model="email.template">
...
...
</record>
I have customized like this.
<record id="sale.email_template_edi_sale" model="email.template">
<field name="name">Sales Order</field>
<field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field>
<field name="subject">${object.company_id.name} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' })</field>
<field name="partner_to">${object.partner_invoice_id.id}</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="auto_delete" eval="False"/>
<field name="email_cc">${object.message_follower_ids.email}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html">
<![CDATA[
<div style="font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hi ${object.prospect_f_name},</p>
<p>I appreciate the opportunity to submit a customized proposal for ${object.cmpny_name}. Please see the attached proposal and let me know if you have any questions.</p>
<p>Thank you for the opportunity!</p>
</div>
]]>
</field>
</record>
For this you need to override templates -
The easiest way to override the template is -
<template id="module_name.template_id" name="Any Override Template">
.
.
</template>
Here is your solution.
You need to override that sale.mail_template_data_notification_email_sale_order email templates
So just need to copy all code of that template and need to the past into your custom modules.
<record id="sale.mail_template_data_notification_email_sale_order" model="mail.template">
<!-- Write same code here and do changes where you want -->
</record>
Thanks

Joomla get class from Form Field

I have a Joomla fields form like this:
<field
name="visible"
type="list"
label="COM_VISIBLE"
description="COM_VISIBLE_TOOLTIP"
class="inputbox">
<option value="0">COM_HIDDEN</option>
<option value="1">COM_VISIBLE</option>
</field>
How to get class properties??
$field->label and $field->input it's ok...
but with
JFormFieldList
JFormFieldMedia
JFormFieldHidden
JFormFieldMedia
return "Undefined property: JFormFieldList::$class in... ()"
Otherwise it's empty
SOLVED
$class = $this->form->getFieldAttribute($field->fieldname, 'class', '', $field->group); –