3
0
Fork 0

[MIG] web_widget_x2many_2d_matrix_example: Migration to 12.0.

12.0
Anand Kansagra 2018-12-31 11:33:16 +05:30
parent 22441ad62f
commit 4aafcfa5a5
13 changed files with 76 additions and 64 deletions

View File

@ -23,7 +23,7 @@ Contributors
------------
* Simone Orsi <simone.orsi@camptocamp.com>
* Anand Kansagra <kansagraanand@hotmail.com>
Maintainer
----------

View File

@ -1,2 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
from . import wizard

View File

@ -1,7 +1,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'web_widget_x2many_2d_matrix example',
'summary': "A small example on how to use `web_widget_x2many_2d_matrix`.",
"version": "11.0.1.0.0",
"version": "12.0.1.0.0",
"author": "Camptocamp, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",

View File

@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"

View File

@ -1 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import x2m_demo

View File

@ -1,8 +1,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api, fields
class X2MDemo(models.Model):
_name = 'x2m.demo'
_description = 'X2Many Demo'
name = fields.Char()
line_ids = fields.One2many('x2m.demo.line', 'demo_id')
@ -24,6 +26,7 @@ class X2MDemo(models.Model):
class X2MDemoLine(models.Model):
_name = 'x2m.demo.line'
_description = 'X2Many Demo Line'
name = fields.Char()
demo_id = fields.Many2one('x2m.demo')

View File

@ -0,0 +1,2 @@
* Simone Orsi <simone.orsi@camptocamp.com>
* Anand Kansagra <kansagraanand@hotmail.com>

View File

@ -0,0 +1 @@
Install it and click on the menu item `Demo x2m matrix widget`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -1,54 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_x2m_demo_form" model="ir.ui.view">
<field name="name">x2m.demo.form</field>
<field name="model">x2m.demo</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name" />
<field name="line_ids">
<tree>
<field name="name" />
<field name="value" />
<field name="user_id" />
</tree>
</field>
</group>
<footer>
<button name="open_x2m_matrix" type="object"
string="Try x2m 2d matrix"
class="oe_stat_button" icon="fa-edit" />
</footer>
</sheet>
</form>
</field>
</record>
<record id="view_x2m_demo_form" model="ir.ui.view">
<field name="name">x2m.demo.form</field>
<field name="model">x2m.demo</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
<field name="line_ids">
<tree>
<field name="name"/>
<field name="value"/>
<field name="user_id"/>
</tree>
</field>
</group>
<footer>
<button name="open_x2m_matrix" type="object"
string="Try x2m 2d matrix"
class="oe_stat_button" icon="fa-edit"/>
</footer>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_x2m_demo_tree">
<field name="name">Demo - Tree</field>
<field name="model">x2m.demo</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_x2m_demo_tree">
<field name="name">Demo - Tree</field>
<field name="model">x2m.demo</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
</tree>
</field>
</record>
<record id="action_x2m_demo" model="ir.actions.act_window">
<field name="name">Demo</field>
<field name="res_model">x2m.demo</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_x2m_demo_tree"/>
</record>
<record id="action_x2m_demo" model="ir.actions.act_window">
<field name="name">Demo</field>
<field name="res_model">x2m.demo</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_x2m_demo_tree"/>
</record>
<menuitem
<menuitem
id="base_matrix_widget_menu"
name="Demo x2m matrix widget"
action="action_x2m_demo"
/>
action="action_x2m_demo"/>
</odoo>

View File

@ -1 +1,2 @@
from . import demo_wizard
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import x2m_matrix

View File

@ -1,8 +1,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class DemoWizard(models.TransientModel):
class X2mMatrixDemoWiz(models.TransientModel):
_name = 'x2m.matrix.demo.wiz'
_description = 'X2Many Matrix Demo Wizard'
line_ids = fields.Many2many(
'x2m.demo.line', default=lambda self: self._default_line_ids())

View File

@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="x2many_2d_matrix_demo" model="ir.ui.view">
<field name="name">x2m.matrix.demo.wiz</field>
<field name="model">x2m.matrix.demo.wiz</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<field name="line_ids" widget="x2many_2d_matrix" field_x_axis="demo_id" field_y_axis="user_id" field_value="value">
<tree>
<field name="demo_id"/>
<field name="user_id"/>
<field name="value"/>
</tree>
<record id="x2many_2d_matrix_demo" model="ir.ui.view">
<field name="name">x2m.matrix.demo.wiz</field>
<field name="model">x2m.matrix.demo.wiz</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<field name="line_ids" widget="x2many_2d_matrix"
field_x_axis="demo_id" field_y_axis="user_id" field_value="value">
<tree>
<field name="demo_id"/>
<field name="user_id"/>
<field name="value"/>
</tree>
</field>
</form>
</field>
</form>
</field>
</record>
</record>
</odoo>