Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5 Odpovědi
7702 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Autor

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

Nejlepší odpověď

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 

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď

_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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
pro 22
21780
0
čvn 16
2765
0
říj 19
2821
2
kvě 25
10221
0
úno 21
3722