From 2b0eb7e7b57a02fdebe7582668589ac9d83cf549 Mon Sep 17 00:00:00 2001
From: Nicolas Martinelli <nim@odoo.com>
Date: Thu, 27 Aug 2015 12:28:11 +0200
Subject: [PATCH] [DEL] sale_journal: deprecated module

Reason: complete rewrite of the Sale module. Invoicing is now managed through
Sale.

Responsible: fp, dbo, nim
---
 addons/sale_journal/__init__.py               |   4 -
 addons/sale_journal/__openerp__.py            |  44 -------
 addons/sale_journal/sale_journal.py           |  79 -----------
 addons/sale_journal/sale_journal_data.xml     |  12 --
 addons/sale_journal/sale_journal_demo.xml     |  18 ---
 addons/sale_journal/sale_journal_view.xml     | 124 ------------------
 .../sale_journal/security/ir.model.access.csv |   6 -
 7 files changed, 287 deletions(-)
 delete mode 100644 addons/sale_journal/__init__.py
 delete mode 100644 addons/sale_journal/__openerp__.py
 delete mode 100644 addons/sale_journal/sale_journal.py
 delete mode 100644 addons/sale_journal/sale_journal_data.xml
 delete mode 100644 addons/sale_journal/sale_journal_demo.xml
 delete mode 100644 addons/sale_journal/sale_journal_view.xml
 delete mode 100644 addons/sale_journal/security/ir.model.access.csv

diff --git a/addons/sale_journal/__init__.py b/addons/sale_journal/__init__.py
deleted file mode 100644
index 7ba4f63b16db..000000000000
--- a/addons/sale_journal/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
-import sale_journal
diff --git a/addons/sale_journal/__openerp__.py b/addons/sale_journal/__openerp__.py
deleted file mode 100644
index 1230751149be..000000000000
--- a/addons/sale_journal/__openerp__.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
-{
-    'name': 'Invoicing Journals',
-    'version': '1.0',
-    'category': 'Sales Management',
-    'description': """
-The sales journal modules allows you to categorise your sales and deliveries (picking lists) between different journals.
-========================================================================================================================
-
-This module is very helpful for bigger companies that works by departments.
-
-You can use journal for different purposes, some examples:
-----------------------------------------------------------
-    * isolate sales of different departments
-    * journals for deliveries by truck or by UPS
-
-Journals have a responsible and evolves between different status:
------------------------------------------------------------------
-    * draft, open, cancel, done.
-
-Batch operations can be processed on the different journals to confirm all sales
-at once, to validate or invoice packing.
-
-It also supports batch invoicing methods that can be configured by partners and sales orders, examples:
--------------------------------------------------------------------------------------------------------
-    * daily invoicing
-    * monthly invoicing
-
-Some statistics by journals are provided.
-    """,
-    'website': 'https://www.odoo.com/page/billing',
-    'depends': ['sale_stock'],
-    'data': [
-        'security/ir.model.access.csv',
-        'sale_journal_view.xml',
-        'sale_journal_data.xml'
-    ],
-    'demo': ['sale_journal_demo.xml'],
-    'test': [ ],
-    'installable': True,
-    'auto_install': False,
-}
diff --git a/addons/sale_journal/sale_journal.py b/addons/sale_journal/sale_journal.py
deleted file mode 100644
index 2dff71f92d73..000000000000
--- a/addons/sale_journal/sale_journal.py
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
-from openerp.osv import fields, osv
-
-class sale_journal_invoice_type(osv.osv):
-    _name = 'sale_journal.invoice.type'
-    _description = 'Invoice Types'
-    _columns = {
-        'name': fields.char('Invoice Type', required=True),
-        'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the invoice type without removing it."),
-        'note': fields.text('Note'),
-        'invoicing_method': fields.selection([('simple', 'Non grouped'), ('grouped', 'Grouped')], 'Invoicing method', required=True),
-    }
-    _defaults = {
-        'active': True,
-        'invoicing_method': 'simple'
-    }
-
-#==============================================
-# sale journal inherit
-#==============================================
-
-class res_partner(osv.osv):
-    _inherit = 'res.partner'
-    _columns = {
-        'property_invoice_type': fields.property(
-            type = 'many2one',
-            relation = 'sale_journal.invoice.type',
-            string = "Invoicing Type",
-            group_name = "Accounting Properties",
-            help = "This invoicing type will be used, by default, to invoice the current partner."),
-    }
-
-    def _commercial_fields(self, cr, uid, context=None):
-        return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_invoice_type']
-
-
-class picking(osv.osv):
-    _inherit = "stock.picking"
-    _columns = {
-        'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
-    }
-
-
-class stock_move(osv.osv):
-    _inherit = "stock.move"
-
-    def action_confirm(self, cr, uid, ids, context=None):
-        """
-            Pass the invoice type to the picking from the sales order
-            (Should also work in case of Phantom BoMs when on explosion the original move is deleted, similar to carrier_id on delivery)
-        """
-        procs_to_check = []
-        for move in self.browse(cr, uid, ids, context=context):
-            if move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id.invoice_type_id:
-                procs_to_check += [move.procurement_id]
-        res = super(stock_move, self).action_confirm(cr, uid, ids, context=context)
-        pick_obj = self.pool.get("stock.picking")
-        for proc in procs_to_check:
-            pickings = list(set([x.picking_id.id for x in proc.move_ids if x.picking_id and not x.picking_id.invoice_type_id]))
-            if pickings:
-                pick_obj.write(cr, uid, pickings, {'invoice_type_id': proc.sale_line_id.order_id.invoice_type_id.id}, context=context)
-        return res
-
-
-class sale(osv.osv):
-    _inherit = "sale.order"
-    _columns = {
-        'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', help="Generate invoice based on the selected option.")
-    }
-
-    def onchange_partner_id(self, cr, uid, ids, part, context=None):
-        result = super(sale, self).onchange_partner_id(cr, uid, ids, part, context=context)
-        if part:
-            itype = self.pool.get('res.partner').browse(cr, uid, part, context=context).property_invoice_type
-            if itype:
-                result['value']['invoice_type_id'] = itype.id
-        return result
diff --git a/addons/sale_journal/sale_journal_data.xml b/addons/sale_journal/sale_journal_data.xml
deleted file mode 100644
index 9d305fe9912b..000000000000
--- a/addons/sale_journal/sale_journal_data.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<openerp>
-<data noupdate="1">
-
-    <record model="ir.property" id="property_invoice_type_def">
-        <field name="name">property_invoice_type</field>
-        <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_invoice_type')]"/>
-        <field name="value" eval="False"/>
-    </record>
-
-</data>
-</openerp>
diff --git a/addons/sale_journal/sale_journal_demo.xml b/addons/sale_journal/sale_journal_demo.xml
deleted file mode 100644
index 061a5af85446..000000000000
--- a/addons/sale_journal/sale_journal_demo.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<openerp>
-<data noupdate="1">
-
-    <record model="sale_journal.invoice.type" id="daily">
-        <field name="name">Daily invoicing</field>
-    </record>
-    <record model="sale_journal.invoice.type" id="monthly">
-        <field name="name">Monthly invoicing</field>
-        <field name="invoicing_method">grouped</field>
-    </record>
-
-    <record model="ir.property" id="sale_journal.property_invoice_type_def">
-        <field name="value" eval="'sale_journal.invoice.type,'+str(daily)"/>
-    </record>
-
-</data>
-</openerp>
diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml
deleted file mode 100644
index a0f4e9b72f0c..000000000000
--- a/addons/sale_journal/sale_journal_view.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<openerp>
-   <data>
-   <!--  sale journal invoice Type's Form  view -->
-
-        <record model="ir.ui.view" id="view_sale_journal_invoice_type_form">
-            <field name="name">sale_journal.invoice.type.form</field>
-            <field name="model">sale_journal.invoice.type</field>
-            <field name="arch" type="xml">
-                <form string="Invoice Type">
-                    <group col="4">
-                        <field name="name"/>
-                        <field name="invoicing_method"/>
-                        <field name="active"/>
-                    </group>
-                    <separator string="Notes"/>
-                    <field name="note"/>
-                </form>
-            </field>
-        </record>
-
-      <!--  sale journal invoice Type's tree  view -->
-
-        <record model="ir.ui.view" id="view_sale_journal_invoice_type_tree">
-            <field name="name">sale_journal.invoice.type.tree</field>
-            <field name="model">sale_journal.invoice.type</field>
-            <field name="arch" type="xml">
-                <tree string="Invoice Type">
-                    <field name="name"/>
-                    <field name="invoicing_method"/>
-                </tree>
-            </field>
-        </record>
-
-      <!-- Action for sale journal invoice Type -->
-
-        <record model="ir.actions.act_window" id="action_definition_journal_invoice_type">
-            <field name="name">Invoice Types</field>
-            <field name="res_model">sale_journal.invoice.type</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="help">Invoice types are used for partners, sales orders and delivery orders. You can create a specific invoicing journal to group your invoicing according to your customer's needs: daily, each Wednesday, monthly, etc.</field>
-        </record>
-
-     <menuitem id="menu_definition_journal_invoice_type" sequence="4"
-        parent="base.menu_sales_config" action="action_definition_journal_invoice_type"/>
-
-    <!-- Inherit sales order form view -->
-
-        <record model="ir.ui.view" id="sale_journal_sale_order">
-            <field name="name">sale.order.journal.view.form</field>
-            <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 name="invoice_type_id"/>
-                </xpath>
-            </field>
-        </record>
-
-        <!-- Inherit sales order tree view-->
-
-        <record model="ir.ui.view" id="sale_journal_sale_order_tree">
-            <field name="name">sale.order.journal.view.tree</field>
-            <field name="model">sale.order</field>
-            <field name="inherit_id" ref="sale.view_order_tree" />
-            <field name="arch" type="xml">
-                <field name="state" position="before">
-                    <field name="invoice_type_id"/>
-                </field>
-            </field>
-        </record>
-
-<!--  Inherit stock picking's form view  -->
-
-        <record model="ir.ui.view" id="sale_journal_picking_order">
-            <field name="name">stock.picking.journal.view.form</field>
-            <field name="model">stock.picking</field>
-            <field name="inherit_id" ref="stock.view_picking_form" />
-            <field name="arch" type="xml">
-                <field name="move_type" position="before">
-                    <field name="invoice_type_id"/>
-                </field>
-            </field>
-        </record>
-
-<!--  Inherit stock picking's tree view  -->
-
-        <record id="view_partner_property_form" model="ir.ui.view">
-            <field name="name">res.partner.journal.property.form.inherit</field>
-            <field name="model">res.partner</field>
-            <field name="inherit_id" ref="base.view_partner_form"/>
-            <field name="arch" type="xml">
-                <group name="sale">
-                    <field name="property_invoice_type"/>
-                </group>
-            </field>
-        </record>
-
-        <record id="view_sales_order_search" model="ir.ui.view">
-            <field name="name">sale.order.search.inherit</field>
-            <field name="model">sale.order</field>
-            <field name="inherit_id" ref="sale.view_sales_order_filter"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group/filter[@name='customer']" position="after">
-                    <filter string="Invoice Type" domain="[]" context="{'group_by':'invoice_type_id'}"/>
-                </xpath>
-            </field>
-        </record>
-
-<!--  Inherit stock picking's search view  -->
-
-        <record id="view_picking_internal_search" model="ir.ui.view">
-            <field name="name">stock.picking.internal.search.inherit</field>
-            <field name="model">stock.picking</field>
-            <field name="inherit_id" ref="stock.view_picking_internal_search"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group/filter[@name='picking_type']" position="after">
-                    <filter string="Invoice Type" domain="[]" context="{'group_by':'invoice_type_id'}"/>
-                </xpath>
-            </field>
-        </record>
-
-   </data>
-</openerp>
diff --git a/addons/sale_journal/security/ir.model.access.csv b/addons/sale_journal/security/ir.model.access.csv
deleted file mode 100644
index 377e78b8c372..000000000000
--- a/addons/sale_journal/security/ir.model.access.csv
+++ /dev/null
@@ -1,6 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_sale_journal_invoice_type_finance_invoice,sale_journal.invoice.type invoice,model_sale_journal_invoice_type,account.group_account_invoice,1,1,1,1
-access_sale_journal_invoice_type_partner_manager,sale_journal.invoice.type partner manager,model_sale_journal_invoice_type,base.group_partner_manager,1,0,0,0
-access_sale_journal_invoice_type_salesman,sale_journal.invoice.type salesman,model_sale_journal_invoice_type,base.group_sale_salesman,1,0,0,0
-access_sale_journal_invoice_type_manager,sale_journal.invoice.type.manager,model_sale_journal_invoice_type,base.group_sale_manager,1,1,1,1
-access_sale_journal_invoice_type_stock_worker,sale_journal.invoice_type stock worker,model_sale_journal_invoice_type,stock.group_stock_user,1,0,0,0
-- 
GitLab