콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
6634 화면

Hi there,

Is it possible to create an automation in Odoo 14 for create invoices after the quotation is confirmed in sales module?

Thank you

아바타
취소
베스트 답변

Hi,

You can override the function of 'Confirm' button in sale order and create invoice from it.
See the below code.

class SaleOrder(models.Model):
    _inherit = 'sale.order'

    def action_confirm(self):
        res = super(SaleOrder, self).action_confirm()
        invoice_lines = []
        for line in self.order_line:
            vals = {
                'name': line.name,
                'price_unit': line.price_unit,
                'quantity': line.product_uom_qty,
                'product_id': line.product_id.id,
                'product_uom_id': line.product_uom.id,
                'tax_ids': [(6, 0, line.tax_id.ids)],
                'sale_line_ids': [(6, 0, [line.id])],
            }
            invoice_lines.append((0, 0, vals))
        self.env['account.move'].create({
            'ref': self.client_order_ref,
            'move_type': 'out_invoice',
            'invoice_origin': self.name,
            'invoice_user_id': self.user_id.id,
            'partner_id': self.partner_invoice_id.id,
            'currency_id': self.pricelist_id.currency_id.id,
            'invoice_line_ids': invoice_lines
        })
        return res

Regards

아바타
취소

thank you cybrosys!

베스트 답변

Hi,

Use this free module as it is or you can refer the coding done inside the free module, which automatically create the picking and invoice on confirming the sales order.

Module: Sale Order Automation


Thanks

아바타
취소
관련 게시물 답글 화면 활동
1
1월 25
927
0
10월 24
1255
3
3월 16
4596
1
3월 25
1009
1
5월 24
1489