Skip to Content
Menú
This question has been flagged
2 Respostes
7153 Vistes

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
Best Answer

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 Best Answer

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?..

Related Posts Respostes Vistes Activitat
0
de maig 22
2739
1
de juny 25
399
1
de des. 23
1225
0
de nov. 23
1526
1
d’abr. 23
7242