I run Flectra inside a Docker container. I have custom fields in sale.order which I want to transfer to account.invoice.
class SaleOrder(models.Model):
_inherit = 'sale.order'
myField = fields.Integer(string='My Field', default=21, required = True)
@api.multi
def _prepare_invoice(self):
res = super(SaleOrder, self)._prepare_invoice()
# res.update({
# 'myField': self.myField,
# })
res['myField'] = self.myField
return res
class SaleInvoice(models.Model):
_inherit = 'account.invoice'
myField = fields.Integer(string='My Field', default=21, required = True)
I tried to override _prepare_invoice and also _create_invoices in different variations, but none worked. From my understanding they should have worked, but I am new to Odoo/Flectra, so I would be happy for any help.
I use Flectra 1.7 (Community Edition) which I think corresponds to Odoo 14.