Commits

Korbinian Preisler  committed 9b4175f

Guidelines

  • Participants
  • Parent commits 946b87b

Comments (0)

Files changed (7)

 
 For more information about this module please contact virtual things:
 
-  http://virtual-things.biz/
+  http://virtual-things.biz/
 #this repository contains the full copyright notices and license terms.
 
 from bank import *
+from party import *

File __tryton__.py

 {
     'name': 'Party Bank',
     'name_de_DE': 'Partei Bankverbindungen',
-    'version': '0.0.1',
+    'version': '0.0.2',
     'author': 'virtual things',
     'email': 'info@virtual-things.biz',
     'website': 'http://www.virtual-things.biz/',
     ],
     'xml': [
         'bank.xml',
+        'party.xml'
     ],
     'translation': [
         'de_DE.csv',
     'Bank Account'
     _name = 'bank.account'
     _description = __doc__
-    _rec_name = 'full_name'
 
-    full_name = fields.Function('get_full_name', type='char', string='Name')
     code = fields.Char('Account Number', help='National Standard Code')
     iban = fields.Char('IBAN')
     bank = fields.Many2One('bank.bank', 'Bank', required=True,
                             ondelete='CASCADE', required=True)
     owner = fields.Char('Differing Owner')
 
-    def get_full_name(self, cursor, user, ids, name, arg, context=None):
+    def get_rec_name(self, cursor, user, ids, name, arg, context=None):
         res = {}
         for account in self.browse(cursor, user, ids, context=context):
             res[account.id] = ", ".join(x for x in [account.bank.name,
     def on_change_bank(self, cursor, user, ids, vals, context=None):
         bank_obj = self.pool.get('bank.bank')
         res = {}
-        bank = bank_obj.browse(cursor, user, vals.get('bank'),
+        if vals.get('bank'):
+            bank = bank_obj.browse(cursor, user, vals.get('bank'),
                                 context=context)
-        if bank:
-            res['bank_code'] = bank.bank_code
-            res['bic'] = bank.bic
+            if bank:
+                res['bank_code'] = bank.bank_code
+                res['bic'] = bank.bic
         return res
 
 BankAccount()
-
-
-class Party(ModelSQL, ModelView):
-    'Party'
-    _name = 'party.party'
-    _description = __doc__
-
-    bank_accounts = fields.One2Many('bank.account', 'party', 'Bank Accounts')
-
-Party()
         <record model="ir.ui.view" id="bank_view_tree">
             <field name="model">bank.bank</field>
             <field name="type">tree</field>
-            <field name="priority">10</field>
             <field name="arch" type="xml">
                 <![CDATA[
                     <tree string="Banks">
         </record>
         <menuitem parent="menu_bank_view" sequence="50"
                     action="act_bank_view2" id="menu_bank_view2"/>
-        <record model="ir.ui.view" id="party_bank_view_form">
-            <field name="model">party.party</field>
-            <field name="type">form</field>
-            <field name="inherit" ref="party.party_view_form"/>
-            <field name="arch" type="xml">
-                <![CDATA[
-                <data>
-                    <xpath
-                        expr="/form/notebook/page[@id=&quot;accounting&quot;]"
-                        position="after">
-                        <page string="Bank Accounts" col="1" id="bank_accounts">
-                            <field name="bank_accounts"/>
-                        </page>
-                    </xpath>
-                </data>
-                ]]>
-            </field>
-        </record>
         <record model="ir.ui.view" id="bank_account_view_form">
             <field name="model">bank.account</field>
             <field name="type">form</field>
+#This file is part of 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
+
+class Party(ModelSQL, ModelView):
+    'Party'
+    _name = 'party.party'
+    _description = __doc__
+
+    bank_accounts = fields.One2Many('bank.account', 'party', 'Bank Accounts')
+
+Party()
+<?xml version="1.0"?>
+<!-- This file is part of Tryton. The COPYRIGHT file at the top level of this
+  repository contains the full copyright notices and license terms. -->
+<tryton>
+    <data>
+        <record model="ir.ui.view" id="party_bank_view_form">
+            <field name="model">party.party</field>
+            <field name="type">form</field>
+            <field name="inherit" ref="party.party_view_form"/>
+            <field name="arch" type="xml">
+                <![CDATA[
+                <data>
+                    <xpath
+                        expr="/form/notebook/page[@id=&quot;accounting&quot;]"
+                        position="after">
+                        <page string="Bank Accounts" col="1" id="bank_accounts">
+                            <field name="bank_accounts"/>
+                        </page>
+                    </xpath>
+                </data>
+                ]]>
+            </field>
+        </record>
+    </data>
+</tryton>