Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hi there i'm creating a module to make 2 kinds of invoice with 2 different sequence ...first one with tax and the other with out
i create a Boolean field to check the kind of invoice and when i press Validate i got that error
ValueError: "invoice_validate() takes at least 4 arguments (4 given)" while evaluating u'invoice_validate()'
here is my module code
the .py file
from openerp import models, fields, api
and here is my view xml file
and here is my sequence file
<?xml version="1.0" encoding="utf-8"?>
may i have some help please ?
This code works for us :)
def invoice_validate(self, cr, uid, ids, context=None):
for invoice in self.browse(cr, uid, ids, context=context):
if not invoice.custom_field:
raise openerp.exceptions.Warning("Custom error")
super(account_invoice,self).invoice_validate(cr, uid, ids, context=context)
1. You declared different class, invoice_edits, so calling super to invoice_validate makes no sense..
declare account_invoice class ( and _inherit = 'account.invoice')
2. overriding invoice_validate method does nothing, since the original method only writes state=open and has nothing to do with selecting sequence for invoice...
Maybe the easiest way to achieve what you want.. is to define 2 different journals, and assign different number sequences to each journal... that way, you can easily add more sequences/journals, and define the sequence simply by selecting appropriate journal before validating invoice... no coding needed at all for it.. or, if you want you can code come check on selected journal..
The invoice_validate function of account.invoice takes only 1 arguments (self). This function is called from account_invoice_workflow.xml with only 1 argument.
You override the function with a different signature, just like the purchase and portal_sale modules do. But I think you also need to rework the workflow XML document.
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/11/15, 11:23 AM|
|Seen: 1533 times|
|Last updated: 8/10/15, 1:24 PM|