7 changed files with 125 additions and 18 deletions
@ -0,0 +1,43 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import models, fields |
||||
|
|
||||
|
|
||||
|
class RecurrencePeriod(models.Model): |
||||
|
"""This class is used to create new model recurrence period""" |
||||
|
_name = "recurrence.period" |
||||
|
_description = "Recurrence Period " |
||||
|
|
||||
|
name = fields.Char(string="Name") |
||||
|
duration = fields.Float(string="Duration") |
||||
|
unit = fields.Selection([('hours', 'hours'), |
||||
|
('days', 'Days'), ('weeks', 'Weeks'), |
||||
|
('months', 'Months'), ('years', 'Years')], |
||||
|
string='Unit') |
||||
|
|
||||
|
|
||||
|
class SubPackages(models.Model): |
||||
|
""" This function is used to inherit subscription packages""" |
||||
|
_inherit = 'subscription.package' |
||||
|
|
||||
|
recurrence_period_id = fields.Many2one("recurrence.period", |
||||
|
string="Recurrence Period") |
|
@ -0,0 +1,54 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<record id="recurrence_view_tree" model="ir.ui.view"> |
||||
|
<field name="name">recurrence.period.tree</field> |
||||
|
<field name="model">recurrence.period</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<tree string="Channel"> |
||||
|
<field name="name"/> |
||||
|
<field name="duration"/> |
||||
|
<field name="unit"/> |
||||
|
</tree> |
||||
|
</field> |
||||
|
</record> |
||||
|
<record id="recurrence_period_views_form" model="ir.ui.view"> |
||||
|
<field name="name">recurrence.period.form</field> |
||||
|
<field name="model">recurrence.period</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Test"> |
||||
|
<sheet> |
||||
|
<group> |
||||
|
<field name="name"/> |
||||
|
<field name="duration" widget="float_time"/> |
||||
|
<field name="unit"/> |
||||
|
</group> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="recurrence_menu_root_id" model="ir.actions.act_window"> |
||||
|
<field name="name">Recurrence Period</field> |
||||
|
<field name="res_model">recurrence.period</field> |
||||
|
<field name="view_mode">list,form</field> |
||||
|
</record> |
||||
|
<menuitem id="subscription_config_menu_subscription_recurrence" |
||||
|
name="Recurrence Period" |
||||
|
parent="subscription_package.subscription_menu_config" |
||||
|
action="subscription_package.recurrence_menu_root_id" |
||||
|
sequence="24"/> |
||||
|
|
||||
|
|
||||
|
<record id="recurrence_id_form_inherit" model="ir.ui.view"> |
||||
|
<field name="name">subscription.package.form.inherit</field> |
||||
|
<field name="model">subscription.package</field> |
||||
|
<field name="inherit_id" ref="subscription_package.subscription_package_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='reference_code']" position="after"> |
||||
|
<field name="recurrence_period_id"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
|
||||
|
</odoo> |
Loading…
Reference in new issue