Création de module pack_account : structure de modèle et vue

This commit is contained in:
eloyoussef 2018-03-30 11:49:58 +02:00
parent 1afbe75845
commit 36058fe141
7 changed files with 192 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import models

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{
'name': 'GOLEM resources pack invoicing',
'summary': 'GOLEM resources pack invoicing',
'description': ''' GOLEM resources pack invoicing ''',
'version': '10.0.0.0.0',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',
'application': True,
'installable': True,
'depends': ['golem_resource_pack', 'account'],
'data': ['views/golem_resource_pack_views.xml']
#'security/ir.model.access.csv']
}

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import golem_resource_pack

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Resource Pack Invoicing """
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class GolemResourcePack(models.Model):
""" GOLEM Resource Pack invoice extention """
_inherit = 'golem.resource.pack'
invoice_id = fields.Many2one('account.invoice', string="Invoice")
invoice_state = fields.Selection(related='invoice_id.state', store=True,
copy=False)
invoice_amount_total = fields.Monetary(related='invoice_id.amount_total')
currency_id = fields.Many2one(related='invoice_id.currency_id')
@api.multi
def create_invoice(self):
""" create invoice """
pass
@api.multi
def show_invoice(self):
""" show invoice """
pass

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Resource Reservation """
from math import modf
from datetime import timedelta
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class GolemResourceReservation(models.Model):
""" GOLEM Resource Reservation Model """
_inherit = 'golem.resource.reservation'
pack_id = fields.Many2one('golem_resource_reservation', 'Reservation Pack')

View File

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_resource_pack_user,Access GOLEM Resource Pack User,model_golem_resource_pack,golem_base.group_golem_user,1,0,0,0
access_golem_resource_pack_manager,Access GOLEM Resource Pack Manager,model_golem_resource_pack,golem_base.group_golem_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_resource_pack_user Access GOLEM Resource Pack User model_golem_resource_pack golem_base.group_golem_user 1 0 0 0
3 access_golem_resource_pack_manager Access GOLEM Resource Pack Manager model_golem_resource_pack golem_base.group_golem_manager 1 1 1 1

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="golem_resource_pack_inherit_account_form">
<field name="name">GOLEM Resource Pack Account extentionForm</field>
<field name="model">golem.resource.pack</field>
<field name="inherit_id" ref="golem_resource_pack.golem_resource_pack_view_form"/>
<field name="arch" type="xml">
<button name="state_rejected" position="after">
<button name="create_invoice" type="object" string="Create Invoice" class="oe_highlight"
attrs="{'invisible': ['|', ('state', '!=', 'validated'), ('invoice_id', '!=', False)]}" />
<button name="show_invoice" type="object" string="Show invoice" class="oe_highlight"
attrs="{'invisible': [('invoice_id', '=', False)]}" />
</button>
<group name="general" position="after">
<group name="invoicing" string="Invoicing"
attrs="{'invisible': [('invoice_id', '=', False)]}">
<field name="invoice_id" />
<field name="invoice_state" />
<field name="invoice_amount_total" />
</group>
</group>
</field>
</record>
</data>
</odoo>