-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
22 changed files
with
894 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
**This file is going to be generated by oca-gen-addon-readme.** | ||
|
||
*Manual changes will be overwritten.* | ||
|
||
Please provide content in the ``readme`` directory: | ||
|
||
* **DESCRIPTION.rst** (required) | ||
* INSTALL.rst (optional) | ||
* CONFIGURE.rst (optional) | ||
* **USAGE.rst** (optional, highly recommended) | ||
* DEVELOP.rst (optional) | ||
* ROADMAP.rst (optional) | ||
* HISTORY.rst (optional, recommended) | ||
* **CONTRIBUTORS.rst** (optional, highly recommended) | ||
* CREDITS.rst (optional) | ||
|
||
Content of this README will also be drawn from the addon manifest, | ||
from keys such as name, authors, maintainers, development_status, | ||
and license. | ||
|
||
A good, one sentence summary in the manifest is also highly recommended. | ||
|
||
|
||
Automatic changelog generation | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
`HISTORY.rst` can be auto generated using `towncrier <https://pypi.org/project/towncrier>`_. | ||
|
||
Just put towncrier compatible changelog fragments into `readme/newsfragments` | ||
and the changelog file will be automatically generated and updated when a new fragment is added. | ||
|
||
Please refer to `towncrier` documentation to know more. | ||
|
||
NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. | ||
If you need to run it manually, refer to `OCA/maintainer-tools README <https://github.com/OCA/maintainer-tools>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Calendar Monthly Extension", | ||
"version": "16.0.1.0.0", | ||
"category": "Productivity/Calendar", | ||
"license": "AGPL-3", | ||
"author": "Onestein,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/calendar", | ||
"depends": ["calendar"], | ||
"data": [ | ||
"security/ir_model_access.xml", | ||
"data/calendar_recurrence_day_data.xml", | ||
"data/calendar_recurrence_weekday_data.xml", | ||
"views/calendar_event_view.xml", | ||
], | ||
"assets": { | ||
"web.assets_backend": ["calendar_monthly_multi/static/src/scss/backend.scss"] | ||
}, | ||
} |
96 changes: 96 additions & 0 deletions
96
calendar_monthly_multi/data/calendar_recurrence_day_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record id="day_1" model="calendar.recurrence.day"> | ||
<field name="day">1</field> | ||
</record> | ||
<record id="day_2" model="calendar.recurrence.day"> | ||
<field name="day">2</field> | ||
</record> | ||
<record id="day_3" model="calendar.recurrence.day"> | ||
<field name="day">3</field> | ||
</record> | ||
<record id="day_4" model="calendar.recurrence.day"> | ||
<field name="day">4</field> | ||
</record> | ||
<record id="day_5" model="calendar.recurrence.day"> | ||
<field name="day">5</field> | ||
</record> | ||
<record id="day_6" model="calendar.recurrence.day"> | ||
<field name="day">6</field> | ||
</record> | ||
<record id="day_7" model="calendar.recurrence.day"> | ||
<field name="day">7</field> | ||
</record> | ||
<record id="day_8" model="calendar.recurrence.day"> | ||
<field name="day">8</field> | ||
</record> | ||
<record id="day_9" model="calendar.recurrence.day"> | ||
<field name="day">9</field> | ||
</record> | ||
<record id="day_10" model="calendar.recurrence.day"> | ||
<field name="day">10</field> | ||
</record> | ||
<record id="day_11" model="calendar.recurrence.day"> | ||
<field name="day">11</field> | ||
</record> | ||
<record id="day_12" model="calendar.recurrence.day"> | ||
<field name="day">12</field> | ||
</record> | ||
<record id="day_13" model="calendar.recurrence.day"> | ||
<field name="day">13</field> | ||
</record> | ||
<record id="day_14" model="calendar.recurrence.day"> | ||
<field name="day">14</field> | ||
</record> | ||
<record id="day_15" model="calendar.recurrence.day"> | ||
<field name="day">15</field> | ||
</record> | ||
<record id="day_16" model="calendar.recurrence.day"> | ||
<field name="day">16</field> | ||
</record> | ||
<record id="day_17" model="calendar.recurrence.day"> | ||
<field name="day">17</field> | ||
</record> | ||
<record id="day_18" model="calendar.recurrence.day"> | ||
<field name="day">18</field> | ||
</record> | ||
<record id="day_19" model="calendar.recurrence.day"> | ||
<field name="day">19</field> | ||
</record> | ||
<record id="day_20" model="calendar.recurrence.day"> | ||
<field name="day">20</field> | ||
</record> | ||
<record id="day_21" model="calendar.recurrence.day"> | ||
<field name="day">21</field> | ||
</record> | ||
<record id="day_22" model="calendar.recurrence.day"> | ||
<field name="day">22</field> | ||
</record> | ||
<record id="day_23" model="calendar.recurrence.day"> | ||
<field name="day">23</field> | ||
</record> | ||
<record id="day_24" model="calendar.recurrence.day"> | ||
<field name="day">24</field> | ||
</record> | ||
<record id="day_25" model="calendar.recurrence.day"> | ||
<field name="day">25</field> | ||
</record> | ||
<record id="day_26" model="calendar.recurrence.day"> | ||
<field name="day">26</field> | ||
</record> | ||
<record id="day_27" model="calendar.recurrence.day"> | ||
<field name="day">27</field> | ||
</record> | ||
<record id="day_28" model="calendar.recurrence.day"> | ||
<field name="day">28</field> | ||
</record> | ||
<record id="day_29" model="calendar.recurrence.day"> | ||
<field name="day">29</field> | ||
</record> | ||
<record id="day_30" model="calendar.recurrence.day"> | ||
<field name="day">30</field> | ||
</record> | ||
<record id="day_31" model="calendar.recurrence.day"> | ||
<field name="day">31</field> | ||
</record> | ||
</odoo> |
40 changes: 40 additions & 0 deletions
40
calendar_monthly_multi/data/calendar_recurrence_weekday_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record id="MO" model="calendar.recurrence.weekday"> | ||
<field name="sequence">0</field> | ||
<field name="key">MO</field> | ||
<field name="name">Monday</field> | ||
</record> | ||
<record id="TU" model="calendar.recurrence.weekday"> | ||
<field name="sequence">1</field> | ||
<field name="key">TU</field> | ||
<field name="name">Tuesday</field> | ||
</record> | ||
<record id="WE" model="calendar.recurrence.weekday"> | ||
<field name="sequence">2</field> | ||
<field name="key">WE</field> | ||
<field name="name">Wednesday</field> | ||
</record> | ||
<record id="TH" model="calendar.recurrence.weekday"> | ||
<field name="sequence">3</field> | ||
<field name="key">TH</field> | ||
<field name="name">Thursday</field> | ||
</record> | ||
<record id="FR" model="calendar.recurrence.weekday"> | ||
<field name="sequence">4</field> | ||
<field name="key">FR</field> | ||
<field name="name">Friday</field> | ||
</record> | ||
<record id="SA" model="calendar.recurrence.weekday"> | ||
<field name="sequence">5</field> | ||
<field name="key">SA</field> | ||
<field name="name">Saturday</field> | ||
<field name="weekend_day">True</field> | ||
</record> | ||
<record id="SU" model="calendar.recurrence.weekday"> | ||
<field name="sequence">6</field> | ||
<field name="key">SU</field> | ||
<field name="name">Sunday</field> | ||
<field name="weekend_day">True</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from . import calendar_event | ||
from . import calendar_recurrence | ||
from . import calendar_recurrence_day | ||
from . import calendar_recurrence_weekday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class CalendarEvent(models.Model): | ||
_inherit = "calendar.event" | ||
|
||
month_by = fields.Selection(selection_add=[("dates", "Dates of month")]) | ||
weekday = fields.Selection( | ||
selection_add=[ | ||
("weekday", "Weekday"), | ||
("weekend_day", "Weekend Day"), | ||
("day", "Day"), | ||
("custom", "Custom"), | ||
] | ||
) | ||
day_ids = fields.Many2many( | ||
comodel_name="calendar.recurrence.day", | ||
compute="_compute_recurrence", | ||
readonly=False, | ||
) | ||
weekday_ids = fields.Many2many( | ||
comodel_name="calendar.recurrence.weekday", | ||
compute="_compute_recurrence", | ||
readonly=False, | ||
) | ||
|
||
@api.model | ||
def _get_recurrent_fields(self): | ||
fields = super()._get_recurrent_fields() | ||
fields.add("day_ids") | ||
fields.add("weekday_ids") | ||
return fields | ||
|
||
def _get_recurrence_params(self): | ||
params = super()._get_recurrence_params() | ||
event_date = self._get_start_date() | ||
params.update( | ||
day_ids=[ | ||
self.env["calendar.recurrence.day"].get_id_from_day(event_date.day) | ||
], | ||
weekday_ids=[ | ||
self.env["calendar.recurrence.weekday"].get_id_by_sequence( | ||
event_date.weekday() | ||
) | ||
], | ||
) | ||
return params |
Oops, something went wrong.