Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

New Journal Entries

By
Jihen BEN ALI
on 3/26/16, 6:24 AM 267 views

Hi,

When creating a new customer_invoice I want to add a new journal entries

for that I had add it a new action in the invoice workflow but I'm getting an error could you help me to fix it please.

This is my workflow:

<record id="account.act_open" model="workflow.activity">

<field name="wkf_id" ref="account.wkf" />

<field name="name">done</field>

<field name="name">open</field>

<field name="action">action_date_assign()

action_move_create()

action_move_create_two()

action_number()

invoice_validate()

</field>

<field name="kind">function</field>

</record>

This is my python file:

class customer_invoice(osv.osv):

_inherit= 'account.invoice'

_columns={

'product_cost_account':fields.many2one('account.account','Product Cost Account', required= True),

'cost_account':fields.many2one('account.account','Cost Account', required= True),

}

@api.multi

def action_move_create_two(self):

move_obj = self.pool.get('account.move')

for inv in self.browse():

res = {}

res1 = {}

if inv.type == 'out_invoice':

for lines in inv.invoice_line:

cost_price = lines.product_id.standard_price * lines.quantity

print'cost_price',cost_price

res.update({'name':inv.product_cost_account.name, 'debit':cost_price })

res1.update({'name':inv.cost_account.name, 'credit':cost_price })

for i in [res,res1]:

new_move_id = move_obj.create({'line_id': [(0,0, i)]})

self.write({'account_move_id': new_move_id})

You could post your error log

Axel Mendoza
on 3/26/16, 4:01 PM

My pb is that I got nothing nothing happened like I did not change it

Jihen BEN ALI
on 3/26/16, 4:34 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/26/16, 6:24 AM
Seen: 267 times
Last updated: 3/26/16, 3:14 PM