I need to edit the function action_move_create because I had edit the field amount_total
I need that debit in account_move_line to be equal to the new amount_total
I had tried this but I'm getting an error.
def action_move_create(self, cr, uid, ids, context=None):
res = super(snc_invoice, self).action_move_create(cr, uid, ids, context=context)
account_move = self.pool.get('account.move')
for inv in self.browse(cr, uid, ids, context=context):
if inv.type == 'out_invoice':
sql = "update account_move_line set debit="+str(inv.amount_total) +",credit="+str(inv.amount_total) + " where move_id = " + str(inv.move_id.id)
the error that I'm getting :"
ValueError: "ERREUR: la nouvelle ligne viole la contrainte de v\xe9rification \xab account_move_line \xbb de la relation \xab account_move_line_credit_debit1 \xbb
DETAIL: La ligne en \xe9chec contient (104, 2016-04-22 11:30:12.059, null, 1, null, 2016-04-22, 8, null, f, null, 1, 1518.5, normal, 1, null, null, valid, 1518.5, null, 8, 5, 2016-04-22 11:30:12.059, 2016-04-22, 2016-04-22, 1, 32, /, null, 0.00, null, null, null, 0.00, 1.00)
" while evaluating
-> res = self._obj.execute(query, params)
Any help please
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
|Asked: 4/22/16, 7:30 AM|
|Seen: 304 times|
|Last updated: 4/25/16, 3:33 AM|