mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[ADD] agreement.line
This commit is contained in:
@@ -6,6 +6,7 @@ from . import (
|
|||||||
agreement,
|
agreement,
|
||||||
agreement_appendix,
|
agreement_appendix,
|
||||||
agreement_clause,
|
agreement_clause,
|
||||||
|
agreement_line,
|
||||||
agreement_recital,
|
agreement_recital,
|
||||||
agreement_section,
|
agreement_section,
|
||||||
agreement_serviceprofile,
|
agreement_serviceprofile,
|
||||||
|
|||||||
@@ -279,8 +279,7 @@ class Agreement(models.Model):
|
|||||||
string="Appendices", copy=True)
|
string="Appendices", copy=True)
|
||||||
serviceprofile_ids = fields.One2many('agreement.serviceprofile',
|
serviceprofile_ids = fields.One2many('agreement.serviceprofile',
|
||||||
'agreement_id',
|
'agreement_id',
|
||||||
string="Service Profiles",
|
string="Service Profiles")
|
||||||
readonly=True)
|
|
||||||
analytic_id = fields.Many2one('account.analytic.account',
|
analytic_id = fields.Many2one('account.analytic.account',
|
||||||
string='Analytic Account', index=True)
|
string='Analytic Account', index=True)
|
||||||
analytic_line_ids = fields.One2many('account.analytic.line',
|
analytic_line_ids = fields.One2many('account.analytic.line',
|
||||||
@@ -301,11 +300,8 @@ class Agreement(models.Model):
|
|||||||
copy=False,
|
copy=False,
|
||||||
domain=[('active', '=', True)]
|
domain=[('active', '=', True)]
|
||||||
)
|
)
|
||||||
products_ids = fields.Many2many(
|
line_ids = fields.One2many('agreement.line', 'agreement_id',
|
||||||
'product.template',
|
string="Products/Services", copy=False)
|
||||||
string="Products",
|
|
||||||
copy=False
|
|
||||||
)
|
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
('active', 'Active'),
|
('active', 'Active'),
|
||||||
|
|||||||
22
agreement/models/agreement_line.py
Normal file
22
agreement/models/agreement_line.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# 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('product.product', string='Product')
|
||||||
|
name = fields.Char(string="Description", required=True)
|
||||||
|
agreement_id = fields.Many2one('agreement', string="Agreement",
|
||||||
|
ondelete="cascade")
|
||||||
|
qty = fields.Float(string='Quantity')
|
||||||
|
uom_id = fields.Many2one('product.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
|
||||||
@@ -66,8 +66,8 @@
|
|||||||
<div class="oe_edit_only">
|
<div class="oe_edit_only">
|
||||||
<p>
|
<p>
|
||||||
For dynamic content use mako expression '${expression}'. For ex:
|
For dynamic content use mako expression '${expression}'. For ex:
|
||||||
1. object's field name: ${object.field_name} or
|
1. object's field name: ${object.field_name} or
|
||||||
2. many2one field name: ${object.many2one_field_id.field_name}
|
2. many2one field name: ${object.many2one_field_id.field_name}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<group name="parties" string="Parties">
|
<group name="parties" string="Parties">
|
||||||
@@ -163,12 +163,21 @@
|
|||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page name="products" string="Products/Services">
|
<page name="products" string="Products/Services">
|
||||||
<group string="Products/Services">
|
<field name="line_ids" nolabel="1">
|
||||||
<field name="product_ids" nolabel="1"/>
|
<tree editable="top">
|
||||||
</group>
|
<field name="product_id"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="qty"/>
|
||||||
|
<field name="uom_id" groups="product.group_uom"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page name="serviceprofiles" string="Service Profiles">
|
<page name="serviceprofiles" string="Service Profiles">
|
||||||
<field name="serviceprofile_ids" nolabel="1"/>
|
<field name="serviceprofile_ids" nolabel="1">
|
||||||
|
<tree editable="top">
|
||||||
|
<field name="name"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page name="financials" string="Financials">
|
<page name="financials" string="Financials">
|
||||||
<group>
|
<group>
|
||||||
|
|||||||
@@ -13,6 +13,25 @@
|
|||||||
string="Agreements"
|
string="Agreements"
|
||||||
data-key="agreement"
|
data-key="agreement"
|
||||||
groups="agreement.group_agreement_manager">
|
groups="agreement.group_agreement_manager">
|
||||||
|
<h2>Operations</h2>
|
||||||
|
<div class="row mt16 o_settings_container">
|
||||||
|
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||||
|
<div class="o_setting_left_pane">
|
||||||
|
<field name="group_uom"/>
|
||||||
|
</div>
|
||||||
|
<div class="o_setting_right_pane">
|
||||||
|
<label for="group_uom"/>
|
||||||
|
<div class="text-muted">
|
||||||
|
Sell and purchase products in different units of measure
|
||||||
|
</div>
|
||||||
|
<div class="content-group">
|
||||||
|
<div class="mt16" attrs="{'invisible': [('group_uom', '=', False)]}">
|
||||||
|
<button name="%(product.product_uom_form_action)d" icon="fa-arrow-right" type="action" string="Units Of Measure" class="btn-link"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h2>Advanced Features</h2>
|
<h2>Advanced Features</h2>
|
||||||
<div class="row mt16 o_settings_container">
|
<div class="row mt16 o_settings_container">
|
||||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||||
|
|||||||
Reference in New Issue
Block a user