Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
7249 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit

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

Related Posts Odpovědi Zobrazení Aktivita
0
kvě 22
2798
1
čvn 25
513
1
pro 23
1315
0
lis 23
1572
1
dub 23
7362