Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
8079 Lượt xem

to pass the fields value of sale.order.line to account.invoice.line

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

there is function _prepare_invoice_line in sale.py. You can do inherit that function and pass your values.

Ảnh đại diện
Huỷ bỏ
Tác giả

i'm working with odoo8 , i can't find this method !

Câu trả lời hay nhất

for those who have odoo 16, you can inherit from sale_order_line and override the function _prepare_invoice_line like this:

def _prepare_invoice_line(self, **optional_values):
return super(SaleOrderLine, self)._prepare_invoice_line(
your_field=self.your_field,
,
**optional_values
)

(don't forget to add your_field into your inherited model from  sale.order.line )

add your_field to the inherited model from account_move_line and use them in your views 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You want to pass the field's value of sale.order.line to account.invoice.line object. You need to override `_prepare_invoice_line` method of sale.order.line object.

Like this:

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

   
    def _prepare_invoice_line(self,**optional_values):
        res = super(SaleOrderLine, self)._prepare_invoice_line()
        res.update({'account_move_line_field_name': self.sale_order_line_fieldName, })
        return res

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

_prepare_invoice is the name of the method in Odoo 8 and can be used with _make_invoice to create the invoice from the order selected

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can override _prepare_order_line_invoice_line method of sale.order.line object which are in sale.py file.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 22
22240
0
thg 6 16
2958
0
thg 10 19
2981
2
thg 5 25
10487
0
thg 2 21
3963