On 26/07/13 12:52 -0000, Code Review - New issues: ced wrote:
> URL: http://codereview.tryton.org/1001002/

I would like to share some changes I have done in this patch with the
refactoring:

    - Field.order_field:

        I remove it and replace by a generic function (similar to
        default value) with this form:

            @classmethod
            def order_<field name>(cls, tables):
                …

        where tables is a dict of dict containing the joins somthing
        like this:

            {
                None: (invoice, None),
                'party': {
                    None: (party, <join_on sql expression>),
                    'addresses': {
                        None: (address, <on>),
                        },
                    },
                'lines': {
                    None: (invoice_lines, <on>),
                    },
                }

        and the method should return a sql expression (or a list) on
        which to order.

        this is a more powerful feature then the previous one as it
        allows to add tables to join on for the ordering.

    - Function.searcher:

        The searcher method can return a full domain (instead of a
        simple 'AND').

    - Field.convert_domain(self, domain, tables, Model):

        The convertion of the simple domain clause is managed by the
        field. This will allow to define new OPERATORS for specific
        fields. The method can return any sql expression and also
        modify the tables to add new join's.
        For now, the nested joins are still using subqueries but a
        future optimisation could convert them into real join's.

    - Field.sql_format:

        Same as above but for formating the value

    - Field.sql_type:

        Return the namedtuple('SQLType', 'base type') which defines the
        SQL type to use for creation and casting.

    - backend:

        It is now dynamic so we don't have to worry about early import.
        This will also allow to have external lib (or move out MySQL) to
        implement new DB support.

    - None vs False:

        I fixed some more misuse of False and we are more strict on this
        topic.

Comments are welcome.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpizKLEFKpeL.pgp
Description: PGP signature

Reply via email to