Payment gateway module creation howto



I am digging into creating a payment gateway module in Odoo 10. So far I have done the following:

- Copied the paypal payment module as base

- Changed all occurrences of paypal with pagseguro

- Changed all occurrences of Paypal with PagSeguro

- Renamed files containing *paypal* with *pagseguro*

I was expecting to at least be able to install the module and later understand how it works and write the necessary logic, however I am having this error during installation.

I was wondering if anyone could please guide me on what the problem could be. I also tried the same thing with another payment gateway as base and I had the same error [1].

Alternatively, is there any payment gateway skeleton/scaffold/bob-template so I can start with?

Thank you very much!

[1]: Herewith the installation error

  File "/home/av/repos/volunteering/abba/abba10.odoo/parts/odoo/odoo/", line 3901, in _create
    self._check_selection_field_value(name, val)
  File "/home/av/repos/volunteering/abba/abba10.odoo/parts/odoo/odoo/", line 2116, in _check_selection_field_value
    field.convert_to_cache(value, self)
  File "/home/av/repos/volunteering/abba/abba10.odoo/parts/odoo/odoo/", line 1739, in convert_to_cache
    raise ValueError("Wrong value for %s: %r" % (self, value))
ParseError: "Wrong value for payment.acquirer.provider: 'pagseguro'" while parsing /home/av/repos/volunteering/abba/abba10.odoo/addons/addons_haevas_payment/payment_pagseguro/data/payment_acquirer_data.xml:4, near
<record id="payment.payment_acquirer_pagseguro" model="payment.acquirer">
            <field name="name">PagSeguro</field>
            <field name="image" type="base64" file="payment_pagseguro/static/src/img/pagseguro_icon.png"/>
            <field name="provider">pagseguro</field>
            <field name="company_id" ref="base.main_company"/>
            <field name="view_template_id" ref="pagseguro_acquirer_button"/>
            <field name="environment">test</field>
            <field name="pre_msg">
&lt;p&gt;You will be redirected to the PagSeguro website after clicking on the payment button.&lt;/p&gt;</field>
            <field name="pagseguro_email_account">dummy</field>
            <field name="pagseguro_token">dummy</field>
            <field name="pagseguro_redirect_url">dummy</field>
            <field name="pagseguro_notification_url">dummy</field>
2 Answers
Best Answer

I also have this problem. After searching code, I find a reason:

    def _check_selection_field_value(self, field, value):

        """ Check whether value is among the valid values for the given

            selection/reference field, and raise an exception if not.


  Therefore, You must override field provider with add_selection:

Example for your instance: 

provider = fields.Selection(selection_add=[('pagseguro', 'Pagseguro')])

Omar Baqueiro
Best Answer

Cannot comment on this.. I am trying something similar and also get the error:

Wrong value for payment.acquirer.provider

Has anyone been able to successfully resolve this error?