mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
25 lines
815 B
Python
25 lines
815 B
Python
# Copyright (C) 2018 - TODAY, Pavlov Media
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class AgreementLine(models.Model):
|
|
_name = "agreement.line"
|
|
_description = "Agreement Lines"
|
|
|
|
product_id = fields.Many2one(comodel_name="product.product", string="Product")
|
|
name = fields.Char(string="Description", required=True)
|
|
agreement_id = fields.Many2one(
|
|
comodel_name="agreement", string="Agreement", ondelete="cascade"
|
|
)
|
|
qty = fields.Float(string="Quantity")
|
|
uom_id = fields.Many2one(
|
|
comodel_name="uom.uom", string="Unit of Measure", required=True
|
|
)
|
|
|
|
@api.onchange("product_id")
|
|
def _onchange_product_id(self):
|
|
self.name = self.product_id.name
|
|
self.uom_id = self.product_id.uom_id.id
|