[FIX] payment: Move website_published field to website_payment

We have to keep website_published defined in payemnt so that demo data publish
only payment_transfer for the website_sale tour.
This commit is contained in:
Antony Lesuisse
2015-08-06 00:14:24 +02:00
parent ed4137495c
commit 4a3a3e5f3a
8 changed files with 61 additions and 36 deletions
+2 -5
View File
@@ -99,7 +99,7 @@ class PaymentAcquirer(osv.Model):
_defaults = {
'company_id': lambda self, cr, uid, obj, ctx=None: self.pool['res.users'].browse(cr, uid, uid).company_id.id,
'environment': 'test',
'environment': 'prod',
'validation': 'manual',
'website_published': False,
'auto_confirm': 'at_pay_confirm',
@@ -335,7 +335,7 @@ class PaymentAcquirer(osv.Model):
def render_payment_block(self, cr, uid, reference, amount, currency_id, tx_id=None, partner_id=False, partner_values=None, tx_values=None, company_id=None, context=None):
html_forms = []
domain = [('website_published', '=', True), ('validation', '=', 'automatic')]
domain = [('validation', '=', 'automatic')]
if company_id:
domain.append(('company_id', '=', company_id))
acquirer_ids = self.search(cr, uid, domain, context=context)
@@ -351,9 +351,6 @@ class PaymentAcquirer(osv.Model):
html_block = '\n'.join(filter(None, html_forms))
return self._wrap_payment_block(cr, uid, html_block, amount, currency_id, context=context)
def website_publish_button(self, cr, uid, ids, context=None):
for i in self.browse(cr, uid, ids, context=context):
i.website_published = not i.website_published
class PaymentTransaction(osv.Model):
""" Transaction Model. Each specific acquirer can extend the model by adding
@@ -15,11 +15,6 @@
<field name="arch" type="xml">
<form string="Payment Acquirer">
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe">
<field name="website_published" widget="website_button"/>
</button>
</div>
<group name="acquirer_base">
<group name="acquirer_left">
<field name="name"/>
@@ -91,7 +86,6 @@
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="provider"/>
<field name="website_published"/>
<field name="environment"/>
</tree>
</field>
+1 -1
View File
@@ -13,8 +13,8 @@
'website_portal',
],
'data': [
'views/website_payment_view.xml',
'views/website_payment_templates.xml',
'views/website_settings_payment.xml',
],
'auto_install': False,
}
+2 -1
View File
@@ -1 +1,2 @@
import website
import website
import payment
+6
View File
@@ -0,0 +1,6 @@
from openerp import models
class PaymentAcquirer(models.Model):
_name = 'payment.acquirer'
_inherit = ['payment.acquirer','website.published.mixin']
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="website_settings_payment" model="ir.ui.view">
<field name="name">website.form</field>
<field name="model">website</field>
<field name="inherit_id" ref="website.view_website_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='other']" position='before'>
<div name="shop">
<separator string="E-Commerce"/>
<group name="shop">
<button type="action"
name="%(payment.action_payment_acquirer)d"
string="Configure payment acquirers" class="oe_link"/>
</group>
</div>
</xpath>
</field>
</record>
<record id="acquirer_form_published" model="ir.ui.view">
<field name="name">payment.acquirer.form.published</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_base']" position="before">
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe">
<field name="website_published" widget="website_button"/>
</button>
</div>
</xpath>
</field>
</record>
<record id="acquirer_list_published" model="ir.ui.view">
<field name="name">payment.acquirer.tree.published</field>
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_list"/>
<field name="arch" type="xml">
<field name="provider" position="after">
<field name="website_published"/>
</field>
</field>
</record>
</data>
</openerp>
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="website_settings_payment" model="ir.ui.view">
<field name="name">website.form</field>
<field name="model">website</field>
<field name="inherit_id" ref="website.view_website_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='other']" position='before'>
<div name="shop">
<separator string="E-Commerce"/>
<group name="shop">
<button type="action"
name="%(payment.action_payment_acquirer)d"
string="Configure payment acquirers" class="oe_link"/>
</group>
</div>
</xpath>
</field>
</record>
</data>
</openerp>
+1 -1
View File
@@ -10,7 +10,7 @@ OpenERP E-Commerce
""",
'author': 'OpenERP SA',
'depends': ['website', 'sale', 'payment', 'website_portal'],
'depends': ['sale', 'website_payment', 'website_portal'],
'data': [
'data/data.xml',
'data/web_planner_data.xml',