Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
7140 Vistas

For Example,

By default domain for jornnal_id in invoice is written in invoice py file(_get_journal()).But i need to add one more domain (domestic/export) journal.I have added in xml but its not working because default function calling.

Because i need to generate sequence based on journal in multi-company concept.

can any one help me????? 

Avatar
Descartar
Mejor respuesta

In Custom Module inherit the field using replace tag add default code. In the same code additional add your domains. i.e Single field two or more domain (default openerp domain and your custom domain) condition And or OR based on your requirement.

Avatar
Descartar
Autor Mejor respuesta

Yeah That is fine.

But by default they have written two domains in python field.i need to customize that field in xml.how can i write??

def _get_journal(self, cr, uid, context=None):
        if context is None:
            context = {}
        type_inv = context.get('type', 'out_invoice')
        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
        company_id = context.get('company_id', user.company_id.id)
        type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
        journal_obj = self.pool.get('account.journal')
        domain = [('company_id', '=', company_id)]
        if isinstance(type_inv, list):
            domain.append(('type', 'in', [type2journal.get(type) for type in type_inv if type2journal.get(type)]))
        else:
            domain.append(('type', '=', type2journal.get(type_inv, 'sale')))
        res = journal_obj.search(cr, uid, domain, limit=1)
        return res and res[0] or False

 

i need to add one domain in xml...

<field name="journal_id" groups="account.group_account_user"
                                on_change="onchange_journal_id(journal_id, context)"  domain="[('seq_type', '=', seq_type),]"/>.

i added seq type field in both invoice form and journal form.based on this i am checking domain,but its not working????

Avatar
Descartar

oh.. code seems correct have u checked the seq_type value in db?..

Publicaciones relacionadas Respuestas Vistas Actividad
0
may 22
2723
1
jun 25
396
1
dic 23
1198
0
nov 23
1518
1
abr 23
7234