diff --git a/view/payment_type_tree.xml b/view/payment_type_tree.xml
--- a/trytond/trytond/modules/account_payment_type/view/payment_type_tree.xml
+++ b/trytond/trytond/modules/account_payment_type/view/payment_type_tree.xml
@@ -2,7 +2,6 @@
-
diff --git a/view/payment_type_form.xml b/view/payment_type_form.xml
--- a/trytond/trytond/modules/account_payment_type/view/payment_type_form.xml
+++ b/trytond/trytond/modules/account_payment_type/view/payment_type_form.xml
@@ -4,13 +4,10 @@
+
+
-
-
-
-
-
diff --git a/tests/test_account_payment_type.py b/tests/test_account_payment_type.py
--- a/trytond/trytond/modules/account_payment_type/tests/test_account_payment_type.py
+++ b/trytond/trytond/modules/account_payment_type/tests/test_account_payment_type.py
@@ -78,12 +78,10 @@
payment_payable, = self.payment_type.create([{
'name': 'Payment Payable',
'kind': 'payable',
- 'company': company.id,
}])
payment_receivable, = self.payment_type.create([{
'name': 'Payment Receivable',
'kind': 'receivable',
- 'company': company.id,
}])
move, = self.move.create([{
'period': period.id,
diff --git a/payment_type.xml b/payment_type.xml
--- a/trytond/trytond/modules/account_payment_type/payment_type.xml
+++ b/trytond/trytond/modules/account_payment_type/payment_type.xml
@@ -54,14 +54,5 @@
-
-
-
-
-
-
- [('company', '=', user.company.id if user.company else None)]
-
-
diff --git a/payment_type.py b/payment_type.py
--- a/trytond/trytond/modules/account_payment_type/payment_type.py
+++ b/trytond/trytond/modules/account_payment_type/payment_type.py
@@ -1,11 +1,10 @@
# This file is part of account_payment_type module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
-
from trytond.model import ModelView, ModelSQL, fields
-from trytond.pyson import Eval, If
from trytond.pool import Pool
from trytond.transaction import Transaction
+from trytond import backend
__all__ = ['PaymentType']
@@ -17,11 +16,6 @@
name = fields.Char('Name', required=True, translate=True)
code = fields.Char('Code')
active = fields.Boolean('Active')
- company = fields.Many2One('company.company', 'Company', required=True,
- select=True, readonly=True, domain=[
- ('id', If(Eval('context', {}).contains('company'), '=', '!='),
- Eval('context', {}).get('company', 0)),
- ])
note = fields.Text('Description', translate=True,
help=('Description of the payment type that will be shown in '
'descriptions'))
@@ -32,6 +26,17 @@
help='The kind of payment type.')
@classmethod
+ def __register__(cls, module_name):
+ TableHandler = backend.get('TableHandler')
+ cursor = Transaction().cursor
+ table = TableHandler(cursor, cls, module_name)
+
+ super(PaymentType, cls).__register__(module_name)
+
+ # Migration from 3.4: drop required on company
+ table.not_null_action('company', action='remove')
+
+ @classmethod
def __setup__(cls):
super(PaymentType, cls).__setup__()
cls._check_modify_fields = set(['kind'])
@@ -49,10 +54,6 @@
def default_active():
return True
- @staticmethod
- def default_company():
- return Transaction().context.get('company')
-
def get_rec_name(self, name):
if self.code:
return '[' + self.code + '] ' + self.name