Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
5ea05f86 by Cédric Krier at 2023-01-08T20:10:39+01:00
Rename reconciliation name to number
- - - - -


4 changed files:

- modules/account/CHANGELOG
- modules/account/move.py
- modules/account/view/move_reconciliation_form.xml
- modules/account/view/move_reconciliation_tree.xml


Changes:

=====================================
modules/account/CHANGELOG
=====================================
@@ -1,3 +1,4 @@
+* Rename reconciliation name to number
 * Accrue and allocate rounding errors when there are multiple taxes
 * Use match pattern to find journal
 * Display general ledger information on account form


=====================================
modules/account/move.py
=====================================
@@ -489,7 +489,8 @@
 class Reconciliation(ModelSQL, ModelView):
     'Account Move Reconciliation Lines'
     __name__ = 'account.move.reconciliation'
-    name = fields.Char('Name', size=None, required=True)
+    _rec_name = 'number'
+    number = fields.Char("Number", required=True)
     company = fields.Many2One('company.company', "Company", required=True)
     lines = fields.One2Many(
         'account.move.line', 'reconciliation', 'Lines',
@@ -508,6 +509,7 @@
 
     @classmethod
     def __setup__(cls):
+        cls.number.search_unaccented = False
         super().__setup__()
         t = cls.__table__()
         cls._sql_indexes.add(Index(t, (t.date, Index.Range())))
@@ -527,6 +529,10 @@
         date_exist = table.column_exist('date')
         company_exist = table.column_exist('company')
 
+        # Migration from 6.6: rename name to number
+        if table.column_exist('name') and not table.column_exist('number'):
+            table.column_rename('name', 'number')
+
         super(Reconciliation, cls).__register__(module_name)
 
         # Migration from 3.8: new date field
@@ -552,5 +558,5 @@
             cursor.execute(*sql_table.update([sql_table.company], [value]))
 
     @classmethod
-    def order_name(cls, tables):
+    def order_number(cls, tables):
         table, _ = tables[None]
@@ -556,5 +562,5 @@
         table, _ = tables[None]
-        return [CharLength(table.name), table.name]
+        return [CharLength(table.number), table.number]
 
     @classmethod
     def default_company(cls):
@@ -569,8 +575,8 @@
         vlist = [x.copy() for x in vlist]
         default_company = cls.default_company()
         for vals in vlist:
-            if 'name' not in vals:
-                vals['name'] = configuration.get_multivalue(
+            if 'number' not in vals:
+                vals['number'] = configuration.get_multivalue(
                     'reconciliation_sequence',
                     company=vals.get('company', default_company)).get()
 


=====================================
modules/account/view/move_reconciliation_form.xml
=====================================
@@ -2,8 +2,8 @@
 <!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
 this repository contains the full copyright notices and license terms. -->
 <form>
-    <label name="name"/>
-    <field name="name"/>
+    <label name="number"/>
+    <field name="number"/>
     <label name="company"/>
     <field name="company"/>
 


=====================================
modules/account/view/move_reconciliation_tree.xml
=====================================
@@ -2,7 +2,7 @@
 <!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
 this repository contains the full copyright notices and license terms. -->
 <tree>
-    <field name="name"/>
+    <field name="number"/>
     <field name="date"/>
     <field name="company"/>
     <field name="delegate_to"/>



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/5ea05f86a16cb48505f9fdc02c41f35b18fc91f3

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/5ea05f86a16cb48505f9fdc02c41f35b18fc91f3
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to