Browse Source
Merge pull request #19 from houssine78/9.0
Merge pull request #19 from houssine78/9.0
change for price_to_weight modulepull/22/head
Houssine BAKKALI
7 years ago
committed by
GitHub
17 changed files with 495 additions and 37 deletions
-
3beesdoo_shift/__openerp__.py
-
12beesdoo_shift/data/cron.xml
-
7beesdoo_shift/data/stage.xml
-
12beesdoo_shift/data/system_parameter.xml
-
182beesdoo_shift/models/cooperative_status.py
-
62beesdoo_shift/models/task.py
-
3beesdoo_shift/security/ir.model.access.csv
-
80beesdoo_shift/views/cooperative_status.xml
-
21beesdoo_shift/views/exempt_reason.xml
-
1beesdoo_shift/views/planning.xml
-
3beesdoo_shift/views/task.xml
-
1beesdoo_shift/wizard/__init__.py
-
37beesdoo_shift/wizard/extension.py
-
26beesdoo_shift/wizard/extension.xml
-
62beesdoo_shift/wizard/subscribe.py
-
12beesdoo_shift/wizard/subscribe.xml
-
4pos_price_to_weight/static/src/js/models.js
@ -0,0 +1,12 @@ |
|||
<odoo> |
|||
<record id="ir_cron_update_today" model="ir.cron"> |
|||
<field name="name">Update Cooperatoor status base on the date</field> |
|||
<field name="interval_number">24</field> |
|||
<field name="interval_type">hours</field> |
|||
<field name="numbercall">-1</field> |
|||
<field name="doall" eval="False" /> |
|||
<field name="model">cooperative.status</field> |
|||
<field name="function">_set_today</field> |
|||
<field name="args">()</field> |
|||
</record> |
|||
</odoo> |
@ -1,10 +1,18 @@ |
|||
<odoo noupdate="1"> |
|||
<record id="seq_solucom_matricule_cabinet" model="ir.config_parameter"> |
|||
<record id="alert_delay_param" model="ir.config_parameter"> |
|||
<field name="key">alert_delay</field> |
|||
<field name="value">28</field> |
|||
</record> |
|||
<record id="seq_solucom_matricule_cabinet" model="ir.config_parameter"> |
|||
<record id="default_grace_delay" model="ir.config_parameter"> |
|||
<field name="key">default_grace_delay</field> |
|||
<field name="value">10</field> |
|||
</record> |
|||
<record id="default_extension_delay" model="ir.config_parameter"> |
|||
<field name="key">default_extension_delay</field> |
|||
<field name="value">28</field> |
|||
</record> |
|||
<record id="always_update" model="ir.config_parameter"> |
|||
<field name="key">always_update</field> |
|||
<field name="value">0</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,21 @@ |
|||
<odoo> |
|||
<record model="ir.ui.view" id="exempt_reason_tree_view"> |
|||
<field name="name">Exempt Reason Tree view</field> |
|||
<field name="model">cooperative.exempt.reason</field> |
|||
<field name="arch" type="xml"> |
|||
<tree editable="top"> |
|||
<field name="name" /> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
<record model="ir.actions.act_window" id="action_exempt_reason"> |
|||
<field name="name">Exempt Reason</field> |
|||
<field name="res_model">cooperative.exempt.reason</field> |
|||
<field name="view_mode">tree</field> |
|||
</record> |
|||
|
|||
<menuitem name="Exempt Reason" id="menu_exempt_reason" parent="menu_status_top" |
|||
action="action_exempt_reason" groups="beesdoo_shift.group_cooperative_admin" /> |
|||
</odoo> |
|||
|
|||
|
@ -0,0 +1,37 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from openerp import models, fields, api, _ |
|||
from openerp.exceptions import UserError |
|||
|
|||
class Subscribe(models.TransientModel): |
|||
_name = 'beesdoo.shift.extension' |
|||
_inherit = 'beesdoo.shift.action_mixin' |
|||
|
|||
def _get_default_extension_delay(self): |
|||
return int(self.env['ir.config_parameter'].get_param('default_extension_delay', 28)) |
|||
|
|||
|
|||
extension_start_date = fields.Date(string="Start date for the extension", default=fields.Date.today, readonly=True) |
|||
auto = fields.Boolean("Auto Extension", default=False) |
|||
extension_days = fields.Integer(default=_get_default_extension_delay) |
|||
|
|||
@api.multi |
|||
def auto_ext(self): |
|||
self = self._check() |
|||
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)]) |
|||
status_id.sudo().write({'extension_start_time': self.extension_start_date}) |
|||
|
|||
@api.multi |
|||
def extension(self): |
|||
self = self._check() #maybe a different group |
|||
grace_delay = int(self.env['ir.config_parameter'].get_param('default_grace_delay', 10)) |
|||
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)]) |
|||
if not status_id.extension_start_time: |
|||
raise UserError(_('You should not make a manual extension when the grace delay has not been triggered yet')) |
|||
extension_date = fields.Date.from_string(status_id.extension_start_time) |
|||
today = fields.Date.from_string(status_id.today) |
|||
today_delay = (today - extension_date).days - grace_delay |
|||
if today_delay < 0: |
|||
raise UserError(_('You should not start a manual extension during the grace delay')) |
|||
status_id.sudo().write({'time_extension': self.extension_days + today_delay}) |
|||
|
|||
#TO continue |
@ -0,0 +1,26 @@ |
|||
<odoo> |
|||
<record model="ir.ui.view" id="extension_coop_wizard_view_form"> |
|||
<field name="name">Extension Management</field> |
|||
<field name="model">beesdoo.shift.extension</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<field name="cooperator_id" invisible="1"/> |
|||
<field name="auto" invisible="1"/> |
|||
<group attrs="{'invisible': [('auto', '=', False)]}"> |
|||
<field name="extension_start_date" /> |
|||
</group> |
|||
<group attrs="{'invisible': [('auto', '=', True)]}"> |
|||
<field name="extension_days" /> |
|||
</group> |
|||
<footer> |
|||
<button type="object" name="extension" |
|||
string="Confirm" class="oe_highlight" attrs="{'invisible': [('auto', '=', True)]}" /> |
|||
<button type="object" name="auto_ext" |
|||
string="Confirm" class="oe_highlight" attrs="{'invisible': [('auto', '=', False)]}" /> |
|||
or |
|||
<button special="cancel" string="Cancel" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue