← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~akretion-team/sale-wkfl/sale-wkfl-sale-multi-journal into lp:sale-wkfl

 

Sébastien BEAU - http://www.akretion.com has proposed merging lp:~akretion-team/sale-wkfl/sale-wkfl-sale-multi-journal into lp:sale-wkfl.

Requested reviews:
  Sale Core Editors (sale-core-editors)

For more details, see:
https://code.launchpad.net/~akretion-team/sale-wkfl/sale-wkfl-sale-multi-journal/+merge/215440

Hi I just port this module on 7. It's allow to have one journal per shop.
It's usefull for customer who sale in multi channel mode (amazon, ebay, magento, prestashop, pos, ....).
Each shop can be linked to his own journal and so his own invoice sequences

-- 
https://code.launchpad.net/~akretion-team/sale-wkfl/sale-wkfl-sale-multi-journal/+merge/215440
Your team Sale Core Editors is requested to review the proposed merge of lp:~akretion-team/sale-wkfl/sale-wkfl-sale-multi-journal into lp:sale-wkfl.
=== added directory 'sale_multi_journal'
=== added file 'sale_multi_journal/__init__.py'
--- sale_multi_journal/__init__.py	1970-01-01 00:00:00 +0000
+++ sale_multi_journal/__init__.py	2014-04-11 15:13:24 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   sale_multi_journal for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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 sale

=== added file 'sale_multi_journal/__openerp__.py'
--- sale_multi_journal/__openerp__.py	1970-01-01 00:00:00 +0000
+++ sale_multi_journal/__openerp__.py	2014-04-11 15:13:24 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   sale_multi_journal for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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': 'sale_multi_journal',
+ 'version': '0.0.1',
+ 'author': 'Akretion',
+ 'website': 'www.akretion.com',
+ 'license': 'AGPL-3',
+ 'category': 'Generic Modules',
+ 'description': """This module will add the field journal id
+    in order to link the sale shop with a sale journal.
+    With this option you will be able to manage correctly the
+    sale journal of each shop.
+ """,
+ 'depends': [
+     'sale',
+ ],
+ 'data': [
+ ],
+ 'installable': True,
+ 'application': True,
+}

=== added file 'sale_multi_journal/sale.py'
--- sale_multi_journal/sale.py	1970-01-01 00:00:00 +0000
+++ sale_multi_journal/sale.py	2014-04-11 15:13:24 +0000
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   sale_multi_journal for OpenERP
+#   Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   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 openerp.osv import fields, orm
+
+
+class SaleShop(orm.Model):
+    _inherit = "sale.shop"
+
+    _columns = {
+        'journal_id': fields.many2one(
+            'account.journal',
+            'Sale Journal',
+            domain=[('type', '=', 'sale')]),
+    }
+
+
+class SaleOrder(orm.Model):
+    _inherit = "sale.order"
+
+    def _prepare_invoice(self, cr, uid, order, lines, context=None):
+        """Prepare the dict of values to create the new invoice for a
+           sale order. This method may be overridden to implement custom
+           invoice generation (making sure to call super() to establish
+           a clean extension chain).
+
+           :param browse_record order: sale.order record to invoice
+           :param list(int) lines: list of invoice line IDs that must be
+                                  attached to the invoice
+           :return: dict of value to create() the invoice
+        """
+        vals = super(SaleOrder, self)._prepare_invoice(
+            cr, uid, order, lines, context=context)
+        if order.shop_id.journal_id:
+            vals['journal_id'] = order.shop_id.journal_id.id
+        return vals

=== added file 'sale_multi_journal/sale_view.xml'
--- sale_multi_journal/sale_view.xml	1970-01-01 00:00:00 +0000
+++ sale_multi_journal/sale_view.xml	2014-04-11 15:13:24 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  sale_multi_journal for OpenERP
+  Copyright (C) 2013-TODAY Akretion <http://www.akretion.com>.
+  The licence is in the file __openerp__.py
+-->
+
+<openerp>
+    <data>
+    
+        <!-- INHERITED VIEW FOR THE OBJECT : sale_shop -->
+
+        <record id="sale_shop_view_form" model="ir.ui.view">
+            <field name="name">sale_multi_journal.sale_shop.view_form</field>
+            <field name="model">sale.shop</field>
+            <field name="inherit_id" ref="sale.view_shop_form" />
+            <field eval="16" name="priority"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <field name="pricelist_id" position="after">
+                    <field name="journal_id" />
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>


Follow ups