summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRavi Patel <rap@openerp.com>2016-03-07 10:46:20 +0530
committerMartin Trigaux <mat@odoo.com>2016-03-09 11:15:32 +0100
commit85bcd6fdd86123e26a022d07be21b1e8bc16a771 (patch)
treecccbff1ce61ac66517436e12589f9e5d89e2185f /addons
parent4fed1026e02d561d9e9f16c6308b5799e86815c2 (diff)
[REF] account,payment_paypal: Remove the 'paypal_account' field
This field was relevant before the salepocalypse, it is no longer. Replaced by generic payment providers instead of putting paypal payment methods in account. Remove it from the res.company and res.config model Remove the method `_migrate_paypal_account` as it was used to find paypal accounts based on the removed field Closes #11231, task-22286
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/company.py1
-rw-r--r--addons/account/models/res_config.py5
-rw-r--r--addons/account/views/res_config_view.xml5
-rw-r--r--addons/payment_paypal/data/paypal.xml1
-rw-r--r--addons/payment_paypal/models/__init__.py1
-rw-r--r--addons/payment_paypal/models/paypal.py19
-rw-r--r--addons/payment_paypal/models/res_company.py43
7 files changed, 1 insertions, 74 deletions
diff --git a/addons/account/models/company.py b/addons/account/models/company.py
index 1a43f3c59f9..faa20059bc4 100644
--- a/addons/account/models/company.py
+++ b/addons/account/models/company.py
@@ -24,7 +24,6 @@ class ResCompany(models.Model):
('round_globally', 'Round Globally'),
], default='round_per_line', string='Tax Calculation Rounding Method',
help="If you select 'Round per Line' : for each tax, the tax amount will first be computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed, leading to the total amount for that tax. If you select 'Round Globally': for each tax, the tax amount will be computed for each PO/SO/invoice line, then these amounts will be summed and eventually this total tax amount will be rounded. If you sell with tax included, you should choose 'Round per line' because you certainly want the sum of your tax-included line subtotals to be equal to the total amount with taxes.")
- paypal_account = fields.Char(string='Paypal Account', size=128, help="Paypal username (usually email) for receiving online payments.")
currency_exchange_journal_id = fields.Many2one('account.journal', string="Exchange Gain or Loss Journal", domain=[('type', '=', 'general')])
income_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_credit_account_id',
string="Gain Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]")
diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py
index 4f7d7e134f3..ee77d3bf03d 100644
--- a/addons/account/models/res_config.py
+++ b/addons/account/models/res_config.py
@@ -24,10 +24,6 @@ class AccountConfigSettings(models.TransientModel):
help='Check this box if this company is a legal entity.')
currency_id = fields.Many2one('res.currency', related='company_id.currency_id', required=True,
string='Default company currency', help="Main currency of the company.")
- paypal_account = fields.Char(related='company_id.paypal_account', size=128, string='Paypal account',
- help="""Paypal account (email) for receiving online payments (credit card, etc.)
- If you set a paypal account, the customer will be able to pay your invoices or quotations
- with a button \"Pay with Paypal\" in automated emails or through the Odoo portal.""")
company_footer = fields.Text(related='company_id.rml_footer', string='Bank accounts footer preview',
readonly=True, help="Bank accounts as printed in the footer of each printed document")
@@ -144,7 +140,6 @@ class AccountConfigSettings(models.TransientModel):
self.expects_chart_of_accounts = company.expects_chart_of_accounts
self.currency_id = company.currency_id
self.transfer_account_id = company.transfer_account_id
- self.paypal_account = company.paypal_account
self.company_footer = company.rml_footer
self.tax_calculation_rounding_method = company.tax_calculation_rounding_method
self.bank_account_code_prefix = company.bank_account_code_prefix
diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml
index 3128ba57c0f..a433ae97291 100644
--- a/addons/account/views/res_config_view.xml
+++ b/addons/account/views/res_config_view.xml
@@ -229,10 +229,7 @@
<group>
<label for="id" string="Payments"/>
<div name="customer_payments">
- <div name='payment_acquirer'>
- <label for="paypal_account"/>
- <field name="paypal_account" placeholder="e.g. sales@odoo.com" class="oe_inline"/>
- </div>
+ <div name='payment_acquirer'/>
</div>
</group>
</form>
diff --git a/addons/payment_paypal/data/paypal.xml b/addons/payment_paypal/data/paypal.xml
index c4f08f5dfcb..af2d0da1f4d 100644
--- a/addons/payment_paypal/data/paypal.xml
+++ b/addons/payment_paypal/data/paypal.xml
@@ -17,6 +17,5 @@
<field name="paypal_api_password">dummy</field>
</record>
- <function model="payment.acquirer" name="_migrate_paypal_account"/>
</data>
</openerp>
diff --git a/addons/payment_paypal/models/__init__.py b/addons/payment_paypal/models/__init__.py
index 7af8e269d79..a1fe670f56f 100644
--- a/addons/payment_paypal/models/__init__.py
+++ b/addons/payment_paypal/models/__init__.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import paypal
-import res_company
diff --git a/addons/payment_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py
index 1e3b896a2c4..2c539a03f18 100644
--- a/addons/payment_paypal/models/paypal.py
+++ b/addons/payment_paypal/models/paypal.py
@@ -62,25 +62,6 @@ class AcquirerPaypal(osv.Model):
'paypal_api_enabled': False,
}
- def _migrate_paypal_account(self, cr, uid, context=None):
- """ COMPLETE ME """
- cr.execute('SELECT id, paypal_account FROM res_company')
- res = cr.fetchall()
- for (company_id, company_paypal_account) in res:
- if company_paypal_account:
- company_paypal_ids = self.search(cr, uid, [('company_id', '=', company_id), ('provider', '=', 'paypal')], limit=1, context=context)
- if company_paypal_ids:
- self.write(cr, uid, company_paypal_ids, {'paypal_email_account': company_paypal_account}, context=context)
- else:
- paypal_view = self.pool['ir.model.data'].get_object(cr, uid, 'payment_paypal', 'paypal_acquirer_button')
- self.create(cr, uid, {
- 'name': 'Paypal',
- 'provider': 'paypal',
- 'paypal_email_account': company_paypal_account,
- 'view_template_id': paypal_view.id,
- }, context=context)
- return True
-
def paypal_compute_fees(self, cr, uid, id, amount, currency_id, country_id, context=None):
""" Compute paypal fees.
diff --git a/addons/payment_paypal/models/res_company.py b/addons/payment_paypal/models/res_company.py
deleted file mode 100644
index 83ac270be0c..00000000000
--- a/addons/payment_paypal/models/res_company.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from openerp.osv import fields, osv
-
-
-class ResCompany(osv.Model):
- _inherit = "res.company"
-
- def _get_paypal_account(self, cr, uid, ids, name, arg, context=None):
- Acquirer = self.pool['payment.acquirer']
- company_id = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.id
- paypal_ids = Acquirer.search(cr, uid, [
- ('website_published', '=', True),
- ('name', 'ilike', 'paypal'),
- ('company_id', '=', company_id),
- ], limit=1, context=context)
- if paypal_ids:
- paypal = Acquirer.browse(cr, uid, paypal_ids[0], context=context)
- return dict.fromkeys(ids, paypal.paypal_email_account)
- return dict.fromkeys(ids, False)
-
- def _set_paypal_account(self, cr, uid, id, name, value, arg, context=None):
- Acquirer = self.pool['payment.acquirer']
- company_id = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.id
- paypal_account = self.browse(cr, uid, id, context=context).paypal_account
- paypal_ids = Acquirer.search(cr, uid, [
- ('website_published', '=', True),
- ('paypal_email_account', '=', paypal_account),
- ('company_id', '=', company_id),
- ], context=context)
- if paypal_ids:
- Acquirer.write(cr, uid, paypal_ids, {'paypal_email_account': value}, context=context)
- return True
-
- _columns = {
- 'paypal_account': fields.function(
- _get_paypal_account,
- fnct_inv=_set_paypal_account,
- nodrop=True,
- type='char', string='Paypal Account',
- help="Paypal username (usually email) for receiving online payments."
- ),
- }