Hello,

some of our reports need to print the Nationality value of a Party based on 
his country, and instead of doing a separate entity with the 'code' field 
related I was thinking if it woudn't be better idea to have an extra column.

this is my nationality.xml
------------------------------------------
    <data>
         <record model="country.country" id="af">
            <field name="nationality">Afghan</field>
            <field name="code">AF</field>
        </record>

        <record model="country.country" id="ax">
            <field name="nationality">Ålandic</field>
            <field name="code">AX</field>
        </record>
        
        <!-- etc -->

    </data>
--------------------------------------
and my nationality.py
----------------------------------
from trytond.model import ModelView, ModelSQL, fields

__all__ = ['Nationality']

#Nationality()
class Nationality(ModelSQL, ModelView):
    "Nationality"
    __name__ = "country.country"
    __description__ = __doc__

    nationality = fields.Char('Nationality', required=True)
    #country = fields.One2One('country.country', 'Country',
    #        required=True, select=True)

    @classmethod
    def __setup__(cls):
        super(Nationality, cls).__setup__()

-------------------------

but when I init the module:
trytond -c trytond.conf -d tryton --update=country_nationality -v

I get this following error:
File 
"/home/ivan/workspace/tryton26/env/lib/python2.7/site-packages/trytond/error.py",
 
line 70, in raise_user_error
    raise UserError(error)
trytond.exceptions.UserError: ('UserError', (u'The field "Name" on 
"Country" is required.', ''))

So... what am I doing wrong? am I missing some extra statement to add the 
column into the existing Country table?

Thanks.
Ivan Garcia.

-- 
-- 
[email protected] mailing list



Reply via email to