In Purchase receipt account is not autopopulated if partner is not selected

Bug #1239666 reported by Amit Gupta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

Hi All,

In Purchase Receipt form if we will not select partner (partner is not a required field) then we can not validate it will show account field is invalid.

Solution:
1. Either account field should be visible so we can select account value.

2. Or we have to define default account field value base on journal_id and also need to change basic_onchange_partner function in account.voucher class

# If we didnt select partner then account_id will be false according to below function

def basic_onchange_partner(self, cr, uid, ids, partner_id, journal_id, ttype, context=None):
        partner_pool = self.pool.get('res.partner')
        journal_pool = self.pool.get('account.journal')
        res = {'value': {'account_id': False}}
        if not partner_id or not journal_id:
            return res

        journal = journal_pool.browse(cr, uid, journal_id, context=context)
        partner = partner_pool.browse(cr, uid, partner_id, context=context)
        account_id = False
        if journal.type in ('sale','sale_refund'):
            account_id = partner.property_account_receivable.id

        elif journal.type in ('purchase', 'purchase_refund','expense'):

            account_id = partner.property_account_payable.id
        else:
            account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id

        res['value']['account_id'] = account_id
        return res

so we need to change below line
if partner_id and journal.type in ('sale','sale_refund'):
            account_id = partner.property_account_receivable.id

        elif patner_id and journal.type in ('purchase', 'purchase_refund','expense'):

            account_id = partner.property_account_payable.id

plateform : ubuntu
version openerp 7.0

Related branches

description: updated
Amit Parik (amit-parik)
affects: openobject-server → openobject-addons
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

The main thing is account field is invisible and it comes based on supplier. We have to make account field visible, So user can make purchase receipt without supplier.

Thank you!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Amit Gupta (amitgupta369) wrote :

Hi,

In basic_onchange_partner function

 res = {'value': {'account_id': False}}
 if not partner_id or not journal_id:
            return res
 # Means if partner_id or journal_id is not available then it will return account_id =False. But according to me it should be
if not partner_id and not journal_id:
       return res
Because partner_id is not a required field in purchase receipt then account_id should return base on journal_id but due to this if condition it is returning account_id =False

Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Foram Katharotiya (OpenERP) (fka-openerp) wrote :

Hello,

  - It has been Fixed in this branch https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-opw-598293-fka
    revno: 9489
    revid: <email address hidden>

  -It will be available in 7.0 soon.

Thanks,
FKA

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.