hi all i have a question,
how can i generate automatic invoice with state open when confirm sale in sales order
Product : Service
Create Invoice : on demand
Sales Invoicing : Generate invoice based on sales order
Now :
1. Create sales order
2. Save
3. Confirm Sale
4. Create Invoice
i want when confirm sale, invoice automatic generate
i have ovveride method like this
def _prepare_invoice(self, cr, uid, order, lines, context=None):
obj_model = self.pool.get('ir.model')obj_model_id = obj_model.search(cr,uid,[ ('model','=',self.__class__.__name__) ])
invoice = super(in_cabang_to_sale,self)._prepare_invoice(cr, uid, order, lines, context=context) invoice.update({
'cabang':order.cabang.id,
'model_id': obj_model_id[0],
'transaction_id':order.id,
})
return invoice
def _make_invoice(self, cr, uid, order, lines, context=None):
result = super(in_cabang_to_sale,self)._make_invoice(cr, uid, order, lines, context=context) workflow.trg_validate(uid, 'account.invoice', result, 'invoice_open', cr)return result
def action_ship_create(self, cr, uid, ids, context=None):
res = super(in_cabang_to_sale,self).action_ship_create(cr, uid, ids, context=context)self.signal_workflow(cr, uid, ids, 'manual_invoice')
return res
Anyone can help me? thanks before