Odoo Help

8

How to Change Custom icons for Payment Acquirers?

By
Ayaz Mansuri
on 3/28/16, 3:00 AM 2,587 views

Hello...!!!

Currently I'm Working on Payment Integration Module., But Unable to set custom icon/image for payment methods.

if we create custom payment module, payment_demo, it will be set like...

<img t-if="not submit_txt" src="/payment_demo/static/src/img/demo_icon.png"/>

 But, How can i set custom icon without creating custom payment module..!!!

Thanks,

Ayaz Mansuri

3
Ayaz Mansuri
On 5/2/16, 9:46 AM

Thank You Guys For your Contribution..but finally i've solved this without creating custom payment module, no need to place image in existing payment module, no need write methods., Just Put one field in payment acquirer model..like...

In Your Py File:

class acquirer(osv.Model):

    _inherit = 'payment.acquirer'

   _columns = { 

    'payment_icon': fields.char(string='Icon location', help='Custom icon to use for this acquirer.'),

}

In Your XML File:

<record id="acquirer_form_payment" model="ir.ui.view">

    <field name="name">acquirer.form.payerse</field>

    <field name="model">payment.acquirer</field>

    <field name="inherit_id" ref="payment.acquirer_form"/>

    <field name="arch" type="xml">

        <xpath expr='//group[@name="acquirer_display"]' position='after'>

    <group>

            <field name="payment_icon"/>

    </group>

        </xpath>

    </field>

</record> 

And...........

  <template id="payment_inherit" inherit_id="website_sale.payment">

    <!-- Enable custom icons in Payment Acquirers -->

    <xpath expr="//div[@id='payment_method']//img" position="attributes">

        <attribute name="t-att-src">acquirer.payment_icon or '/payment_%s/static/src/img/%s_icon.png' % (acquirer.provider, acquirer.provider)</attribute>

    </xpath>

</template>

Now Go to Settings > Payment Acquirers > Select any of payment Method > Go to payment_icon Field & Write icon image path like this. /your_module_name/static/src/img/lastschrift_icon.png

This is how you can change payment icons without creating custom payment module...!!!

Thanks...!!!


9

Cybrosys Technologies

--Cybrosys Technologies--
1464
| 2 2 5
Calicut, India
--Cybrosys Technologies--

Cybrosys Technologies is a private limited ISO certified company in Technology and Software Engineering sector. We serve as one of the best and trusted Odoo official partner, providing ultimate Customization and Implementation services in Odoo ERP. A frequent contributor to Odoo Apps, our customized free apps are downloaded by more than one lakh users. Most of our apps augment the potentialities of Odoo and are trending in the Odoo app store.

Cybrosys keeps privilege to be one among the finest Odoo Official Partners with 200+ free apps contribution towards the Odoo community. Cybrosys also stands number one in Odoo-social Media Integration empowering every kind of business solutions.

We are also enriched with highly skilled UI/UX technical experts for Developing, Implementing and Designing, thereby providing ultimate benefit to our customer base.

Today Cybrosys has reached par excellent in Odoo Implementation and allied services, proving its credibility and reliability. Our proven services are used by customers sprawling across 160+ countries including Middle East, African continents, UK, Germany, Spain, Thailand, Hong Kong, New Zealand, Australia, Malaysia, Singapore, Egypt etc.

We are rapidly expanding our base with robust quality management and business process re-engineering to meet the ultimate customer desire.

To know more about Cybrosys Technologies and our Odoo Apps, Kindly visit:

Cybrosys Technologies 

Odoo Apps 

And inbox us your queries to odoo@cybrosys.com

Cybrosys Technologies
On 4/7/16, 1:32 AM

Hi Mansuri,


The image icon should be saved in this format 'acquirername_icon.png'

The payment methods in odoo e-commerce is listed by using this methode in the corresponding template

        <li t-foreach="acquirers or []" t-as="acquirer">

            <label t-if="acquirer.button">

                <input t-att-value="acquirer.id" type="radio" name="acquirer" t-att-checked="acquirers[0] == acquirer"/>

                <img class="media-object" style="width: 60px; display: inline-block;"

                    t-att-title="acquirer.name"

                    t-att-src="'/payment_%s/static/src/img/%s_icon.png' % (acquirer.provider, acquirer.provider)"/>

                <span t-field="acquirer.name"/>

            </label>

        </li>

I hope it will help.

Where is the file, script, to write this code ?

Lince
on 4/23/16, 3:36 AM

You don't need to include this code...its already there. just give name for that icon as mentioned in answer

fasluca
on 4/25/16, 1:05 AM

Hi Lince, At the time of installation of module 'payment_demo ' some datas are to be set in payment.acquirer as Demo demo test here you may need to create tempate demo_acquirer_button. Note: Look here the provider is 'demo'. You also have to inherit payment.acquirer and follow the code: class PaymentAcquirer(models.Model): _inherit = 'payment.acquirer' def _get_providers(self, cr, uid, context=None): providers = super(PaymentAcquirer, self)._get_providers(cr, uid, context=context) providers.append(['demo', 'demo']) return providers

nikesh
on 4/29/16, 2:31 AM
1
nikesh
On 4/29/16, 2:36 AM

Hi Lince,
At the time of installation of module 'payment_demo ' some datas are to be set in payment.acquirer as

 

<openerp>
    <data noupdate="1">
        <record id="payment_acquirer_sagepay" model="payment.acquirer">
            <field name="name">Demo</field>
            <field name="provider">demo</field>
            <field name="company_id" ref="base.main_company"/>
            <field name="view_template_id" ref="demo_acquirer_button"/>
            <field name="environment">test</field>
        </record>
    </data>
</openerp>


Here you may need to create tempate demo_acquirer_button.

 Note: Look here the provider is 'demo'. You also have to inherit payment.acquirer and follow the code:

class PaymentAcquirer(models.Model): 
    _inherit = 'payment.acquirer'
    def _get_providers(self, cr, uid, context=None):
        providers = super(PaymentAcquirer, self)._get_providers(cr, uid, context=context)
        providers.append(['demo', 'demo'])
        return providers


0

Prakash Sharma

--Prakash Sharma--
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 4/20/16, 6:33 AM

just place a icon as the name of acquire name in static/src/img.

For example if you want to change the image of payment_transfer;

place a  .png image  inside payment_transfer/static/src/img/ having name transfer_icon


For example if you want to change the image of payment_paypal;

place a  .png image  inside payment_paypal/static/src/img/ having name paypal_icon

 



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

Question tools

1 follower(s)

Stats

Asked: 3/28/16, 3:00 AM
Seen: 2587 times
Last updated: 9/21/17, 9:03 AM