Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
7323 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Autor Beste Antwort

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
Verwerfen

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Mai 22
2837
1
Juni 25
589
1
Dez. 23
1371
0
Nov. 23
1611
1
Apr. 23
7426