Skip to content

Commit

Permalink
[MIG] sale_layout_multi_company: Migration to 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoRubi committed Apr 21, 2018
1 parent e5e35fd commit b101acc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 48 deletions.
4 changes: 2 additions & 2 deletions sale_layout_multi_company/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
Sale Layout - Multi company
===========================

This module extends the functionality of sale_layout module adding support for multi company
This module extends the functionality of sale's layout_category model adding support for multi company

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/133/8.0
:target: https://runbot.odoo-community.org/runbot/133/10.0

Bug Tracker
===========
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
{
"name": "Sale Layout - Multi company",
"summary": "Multi company features for sale_layout",
"version": "8.0.1.0.0",
"version": "10.0.1.0.0",
"category": "Sales Management",
"website": "https://www.agilebg.com",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale_layout",
"sale"
],
"data": [
"views/sale_layout_view.xml",
Expand Down
16 changes: 4 additions & 12 deletions sale_layout_multi_company/models/sale_layout.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Lorenzo Battistini - Agile Business Group
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api
from odoo import models


class SaleLayoutCategory(models.Model):
_inherit = 'sale_layout.category'

@api.model
def _default_company_id(self):
company = self.env['res.company']
return company.browse(company._company_default_get(
'sale_layout.category'))

company_id = fields.Many2one(
'res.company', string='Company', change_default=True,
default=_default_company_id)
_inherit = ['multi.company.abstract', 'sale.layout_category']
_name = 'sale.layout_category'
20 changes: 10 additions & 10 deletions sale_layout_multi_company/security/record_rules.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="account_move_comp_rule" model="ir.rule">
<field name="name">Sale layout multi company</field>
<field name="model_id" ref="model_sale_layout_category"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>
<odoo>
<data noupdate="1">
<record id="sale_layout_category_comp_rule" model="ir.rule">
<field name="name">Sale layout category multi company</field>
<field name="model_id" ref="model_sale_layout_category"/>
<field name="global" eval="True"/>
<field name="domain_force">['|', ('company_ids', 'in', user.company_id.ids), ('company_id', '=', False)]</field>
</record>
</data>
</odoo>
43 changes: 21 additions & 22 deletions sale_layout_multi_company/views/sale_layout_view.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="report_configuration_form_view_company" model="ir.ui.view">
<field name="name">report_configuration_form_view_company</field>
<field name="model">sale_layout.category</field>
<field name="inherit_id" ref="sale_layout.report_configuration_form_view"></field>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field name="company_id" groups="base.group_multi_company" widget="selection"></field>
</field>
<odoo>
<record id="report_configuration_form_view_company" model="ir.ui.view">
<field name="name">report_configuration_form_view_company</field>
<field name="model">sale.layout_category</field>
<field name="inherit_id" ref="sale.report_configuration_form_view"/>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</field>
</record>
<record id="report_configuration_tree_view_company" model="ir.ui.view">
<field name="name">report_configuration_tree_view_company</field>
<field name="model">sale_layout.category</field>
<field name="inherit_id" ref="sale_layout.report_configuration_tree_view"></field>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field name="company_id" groups="base.group_multi_company"></field>
</field>
</field>
</record>

<record id="report_configuration_tree_view_company" model="ir.ui.view">
<field name="name">report_configuration_tree_view_company</field>
<field name="model">sale.layout_category</field>
<field name="inherit_id" ref="sale.report_configuration_tree_view"/>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</record>
</data>
</openerp>
</field>
</record>
</odoo>

0 comments on commit b101acc

Please sign in to comment.