← Back to team overview

account-payment-team team mailing list archive

Re: [Merge] lp:~mikel-martin/account-payment/group-by into lp:account-payment

 

Thanks to your comments Stefan, they help me a understanding this better.

Now I end up with the following code in a separate file, to solve the problem when creating invoices from delivery orders ( stock.picking )

I suppose I could be useful to other people too but i don't know where to place it 

________________________________________________________________________
from osv import fields, osv

#----------------------------------------------------------
# Stock Picking
#----------------------------------------------------------
class stock_picking(osv.osv):
    _inherit = "stock.picking"

    def action_invoice_create(self, cr, uid, ids, journal_id=False,
            group=False, type='out_invoice', context=None):
        res = super(stock_picking, self).action_invoice_create(cr, uid, ids, journal_id, group, type, context)
        for picking_id, invoice_id in res.items(): # .iteritems() in Python 2.x
            inv_obj = self.pool.get("account.invoice")
            invoice = inv_obj.browse(cr, uid, invoice_id)
            result = inv_obj.onchange_partner_id(cr, uid, invoice_id, invoice.type, invoice.partner_id.id, invoice.date_invoice, invoice.payment_term, invoice.partner_bank_id, invoice.company_id.id)
            inv_obj.write(cr, uid, invoice_id, result['value'])
        return res






-- 
https://code.launchpad.net/~mikel-martin/account-payment/group-by/+merge/134433
Your team Account Payment is subscribed to branch lp:account-payment.


References