Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions coopiteasy_subscription/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions coopiteasy_subscription/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2019 Coop IT Easy SCRL fs
# Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).


{
"name": "Coop IT Easy Subscriptions",
"version": "12.0.1.0.0",
"author": "Coop IT Easy SC",
"license": "AGPL-3",
"category": "Contract Management",
"website": "https://coopiteasy.be",
"summary": """
Configure included support hours, compute quarter support time and invoice overshoot.
""",
"depends": [
"contract",
"project",
],
"data": [
"views/contract_views.xml",
"views/product_template_views.xml",
],
"installable": True,
}
2 changes: 2 additions & 0 deletions coopiteasy_subscription/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import contract_line
from . import product_template
25 changes: 25 additions & 0 deletions coopiteasy_subscription/models/contract_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Coop IT Easy SC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class Contract(models.Model):
_inherit = "contract.contract"
support_line_ids = fields.One2many(
comodel_name="contract.line",
related="contract_line_ids",
) # fixme can't modify the line because it's a related fields => need to be able to edit project _id


class ContractLine(models.Model):
_inherit = "contract.line"

project_id = fields.Many2one(
string="Project",
comodel_name="project.project",
)
is_support_line = fields.Boolean(
related="product_id.is_support_product",
)
nb_included_hours = fields.Float(related="product_id.nb_included_hours")
14 changes: 14 additions & 0 deletions coopiteasy_subscription/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Coop IT Easy SC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

is_support_product = fields.Boolean()
nb_included_hours = fields.Float(
string="Number of included hours",
default=0,
)
Empty file.
Empty file.
41 changes: 41 additions & 0 deletions coopiteasy_subscription/views/contract_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- <record id="contract_line_form_view" model="ir.ui.view">-->
<!-- <field name="name">contract.line form view (in contract)</field>-->
<!-- <field name="model">contract.line</field>-->
<!-- <field name="inherit_id" ref="contract.contract_line_form_view"/>-->
<!-- <field name="arch" type="xml">-->
<!-- <field name="product_id" position="after">-->
<!-- <field name="is_support_line"/>-->
<!-- <field name="nb_included_hours"/>-->
<!-- </field>-->
<!-- </field>-->
<!-- </record>-->

<record id="contract_contract_form_view" model="ir.ui.view">
<field name="name">contract.contract.form.view</field>
<field name="model">contract.contract</field>
<field name="inherit_id" ref="contract.contract_contract_form_view"/>
<field name="arch" type="xml">
<page name="recurring_invoice_line" position="after">
<page name="support_line" string="Support Invoicing">
<field name="support_line_ids"
attrs="{'readonly': [('is_terminated','=',True)]}"
>
<!-- domain="[('is_support_line', '=', True')]"-->
<tree create="false" delete="false">
<field name="product_id"/>
<field name="is_support_line"/>
<field name="nb_included_hours"/>
<field name="project_id"/>
</tree>
</field>
<!-- domain="[(product_id.is_support_product, '=', True)]"-->
</page>
</page>
</field>
</record>

</data>
</odoo>
21 changes: 21 additions & 0 deletions coopiteasy_subscription/views/product_template_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>

<record model="ir.ui.view" id="product_template_form_view">
<field name="name">product.template.form.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='email_template_and_project']" position="before">
<group string="Subscription" name="subscription" attrs="{'invisible': [('type', '!=', 'service')]}">
<field name="is_support_product" />
<field name="nb_included_hours" attrs="{'invisible': [('is_support_product', '=', False)]}"/>
</group>
</xpath>
</field>
</record>


</data>
</odoo>