helo!
I' use the sale module .
in the sale.order.line i want to have 2 new fields so i create a new model (in my custom module) like:
class cave_vente(models.Model):
_name = 'cave.vente'
_description = "classe vente personnalise"
_inherits = 'sale.order.line'
@api.model
def _calcul_qt_vendu(self):
qty = 0
for rec in self:
qty= rec.qte_sortie - rec.qte_retournee
rec.update({'product_uom_qty': qty})
qte_sortie = fields.Integer('Quantité chargée')
qte_retournee = fields.Integer('Quantité retournée')
product_uom_qty = fields.Integer('Quantité commandée', compute='_calcul_qt_vendu', store=True, readonly=True)
##########
maybe i can vreate new view based on cave.vente model - but in this new view i'll have to call again all the field in sale.order.form (and it not sure i undertand each of them)
How can i use this new fields (qte_sortie and qte_retournee ) in sale.order.form (the view of sale.order)?
YOU can inherit directly in sale.order.line. is that applicable? without naming a new model. thus you can inherit sale order view and add these fields in it.