diff --git a/__manifest__.py b/__manifest__.py index 27cac261ff14468714eea5dc30f62ae26154557a..933aba260d9a141b0f219442c4883b2e6c6c792b 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -2,7 +2,7 @@ { 'name': 'Le Filament - Training', - 'version': '10.0.1.0', + 'version': '13.0.1.0.0', 'summary': 'Training sessions managment', 'license': 'AGPL-3', 'author': 'LE FILAMENT', @@ -17,7 +17,7 @@ 'security/training_security.xml', 'security/ir.model.access.csv', 'data/training_data.xml', - 'views/account_invoice_view.xml', + 'views/account_move_view.xml', 'views/assets.xml', 'views/partner_view.xml', 'views/sale_order_view.xml', diff --git a/models/__init__.py b/models/__init__.py index 4c05e4ec0fc1baf64bc0e0f4dceecc8f7444cbf3..6a8b0891b4e5d8b2be95e3ca78ea47e231a5ff7f 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -2,7 +2,7 @@ # © 2019 Le Filament (<http://www.le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import account_invoice +from . import account_move from . import partner from . import sale_order from . import training_course diff --git a/models/account_invoice.py b/models/account_move.py similarity index 90% rename from models/account_invoice.py rename to models/account_move.py index 8010643862224edf554b1bd34b3addbf063aea11..a31462324f3b488f45cb928687a25dff2f71cff4 100644 --- a/models/account_invoice.py +++ b/models/account_move.py @@ -6,7 +6,7 @@ from odoo import models, fields class AccountInvoiceTraining(models.Model): - _inherit = ['account.invoice'] + _inherit = ['account.move'] training_id = fields.Many2one( comodel_name='training.training', diff --git a/models/training_training.py b/models/training_training.py index bd3e3379ea38b7084af95c256bc051615e231ab7..c862e86ccbb80692eec8fa33204a572a7474027b 100644 --- a/models/training_training.py +++ b/models/training_training.py @@ -86,7 +86,7 @@ class Training(models.Model): inverse_name='training_id', string='Commandes',) invoice_ids = fields.One2many( - comodel_name='account.invoice', + comodel_name='account.move', inverse_name='training_id', string='Factures',) state = fields.Selection( @@ -123,7 +123,6 @@ class Training(models.Model): }) return record - @api.multi def write(self, vals): record = super(Training, self).write(vals) if vals.get('course_id', False): @@ -171,23 +170,19 @@ class Training(models.Model): # ------------------------------------------------------ # Buttons # ------------------------------------------------------ - @api.multi def action_valid(self): for training in self: training.state = 'current' training.agreement_number = self.env['ir.sequence'].next_by_code('training.training') - @api.multi def action_done(self): for training in self: training.state = 'done' - @api.multi def action_draft(self): for training in self: training.state = 'draft' - @api.multi def _get_trainers(self): for training in self: trainers = training.session_ids.mapped('user_id') diff --git a/views/account_invoice_view.xml b/views/account_move_view.xml similarity index 85% rename from views/account_invoice_view.xml rename to views/account_move_view.xml index 807403ba395f5855d6b91089facc4b0ab9bcf530..4d32af89f3aad9748adb6bf3f64b4f46ab6b49b1 100644 --- a/views/account_invoice_view.xml +++ b/views/account_move_view.xml @@ -6,8 +6,8 @@ <!-- Client Form View --> <record id="account_invoice_training_form_view" model="ir.ui.view"> <field name="name">Invoice Training Form View</field> - <field name="model">account.invoice</field> - <field name="inherit_id" ref="account.invoice_form"/> + <field name="model">account.move</field> + <field name="inherit_id" ref="account.view_move_form"/> <field name="arch" type="xml" > <xpath expr="//page[@name='other_info']/group/group[2]" position="inside"> <field diff --git a/views/assets.xml b/views/assets.xml index 59882acb9397d26ce5f97dd02c4eb9bec7e08923..65aa2159c4992fb67887f9313283459f2758fcbd 100644 --- a/views/assets.xml +++ b/views/assets.xml @@ -3,7 +3,7 @@ <odoo> <data> - <template id="training_assets" inherit_id="web.report_assets_editor"> + <template id="training_assets" inherit_id="web.report_assets_common"> <xpath expr="." position="inside"> <link rel="stylesheet" href="/lefilament_training/static/src/less/style.less"/> </xpath> diff --git a/views/sale_order_view.xml b/views/sale_order_view.xml index 69d05763da01e4362473722facdada7973c3b2cb..6b2d9ac6e1348d464f541ff4164836db3ef21ef2 100644 --- a/views/sale_order_view.xml +++ b/views/sale_order_view.xml @@ -9,8 +9,8 @@ <field name="model">sale.order</field> <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml" > - <xpath expr="//group[@name='sale_pay']" position="inside"> - <field + <xpath expr="//group[@name='sale_info']" position="inside"> + <field name="training_id" domain="['|', ('customer_id', '=', partner_id), ('opco_id', '=', partner_id)]" options="{ 'no_create_edit': True, }" />