Note that there are some explanatory texts on larger screens.

plurals
  1. POSupplier invoices and account types
    primarykey
    data
    text
    <p>i succeeded in generating a supplier invoice. The problem i have now is that i can not pay the invoice i create (by code). It seems it is due to the incorrect account being used for payment ?</p> <p>The error is : nothing happens , event the state does not change from open to paid but when i manually changes the account to the 'X111111 creditors (test)' from the demo data it gets paid without problems.</p> <p>Here is my code:</p> <pre><code> for commission in self.browse(cr, uid, ids, context=context): if commission.supplier_invoice.id: continue journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'purchase'), ('company_id', '=', commission.invoice.company_id.id)], limit=1) if not journal_ids: raise osv.except_osv(_('Error!'), # TODO change text message _('Please define sales journal for this company: "%s" (id:%d).') % ( 'dummy', 'dummy')) invoice_line = { 'name': 'commission', 'sequence': 5, 'invoice_id': False, 'account_id': commission.salesperson.partner_id.property_account_receivable.id, 'price_unit': commission.commission_total, 'quantity': 1.0, } invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, invoice_line, context=context) new_invoice = { 'name': 'commission on sale', 'type': 'in_invoice', 'reference': '', 'account_id': commission.salesperson.partner_id.property_account_receivable.id, 'partner_id': commission.salesperson.partner_id.id, 'journal_id': journal_ids[0], 'invoice_line': [(6, 0, [invoice_line_id])], 'currency_id': commission.invoice.currency_id.id, 'comment': 'test', 'fiscal_position': commission.salesperson.partner_id.property_account_position.id, 'company_id': commission.invoice.company_id.id, 'user_id': uid } invoice_id = self.pool.get('account.invoice').create(cr, uid, new_invoice, context=context) self.write(cr, uid, [commission.id], {'supplier_invoice': invoice_id}, context=context) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload