openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #01650
lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse.
Requested reviews:
Stock and Logistic Core Editors (stock-logistic-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi/+merge/196530
[ADD] stock_location_ownership.
See https://code.launchpad.net/~sale-core-editors/sale-wkfl/7.0-add-sale_sourced_and_stock_ownership/+merge/194527 for more details
--
https://code.launchpad.net/~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi/+merge/196530
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse.
=== added directory 'stock_location_ownership'
=== added file 'stock_location_ownership/__init__.py'
--- stock_location_ownership/__init__.py 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/__init__.py 2013-11-25 12:45:08 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Guewen Baconnier
+# Copyright 2013 Camptocamp SA
+#
+# 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 model
=== added file 'stock_location_ownership/__openerp__.py'
--- stock_location_ownership/__openerp__.py 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/__openerp__.py 2013-11-25 12:45:08 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Guewen Baconnier
+# Copyright 2013 Camptocamp SA
+#
+# 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': 'Stock Location Ownership',
+ 'version': '0.1',
+ 'author': 'Camptocamp',
+ 'category': 'Warehouse',
+ 'license': 'AGPL-3',
+ 'complexity': 'normal',
+ 'images': [],
+ 'website': "http://www.camptocamp.com",
+ 'description': """
+Stock Location Ownership
+========================
+
+Adds an ownership on the stock locations
+""",
+ 'depends': ['stock',
+ ],
+ 'demo': [],
+ 'data': ['view/stock_view.xml',
+ ],
+ 'test': [],
+ 'auto_install': False,
+ 'installable': True,
+ }
=== added directory 'stock_location_ownership/i18n'
=== added directory 'stock_location_ownership/model'
=== added file 'stock_location_ownership/model/__init__.py'
--- stock_location_ownership/model/__init__.py 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/model/__init__.py 2013-11-25 12:45:08 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Guewen Baconnier
+# Copyright 2013 Camptocamp SA
+#
+# 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 stock
=== added file 'stock_location_ownership/model/sale.py'
--- stock_location_ownership/model/sale.py 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/model/sale.py 2013-11-25 12:45:08 +0000
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Guewen Baconnier
+# Copyright 2013 Camptocamp SA
+#
+# 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 orm, fields
+
+
+class sale_order(orm.Model):
+ _inherit = 'sale.order'
+
+ def _prepare_order_line_move(self, cr, uid, order, line, picking_id,
+ date_planned, context=None):
+ values = super(sale_order, self)._prepare_order_line_move(
+ cr, uid, order, line, picking_id, date_planned, context=context)
+ if line.location_id:
+ values['location_id'] = line.location_id.id
+ return values
+
+ def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned,
+ context=None):
+ values = super(sale_order, self)._prepare_order_line_procurement(
+ cr, uid, order, line, move_id, date_planned, context=context)
+ if line.location_id:
+ values['location_id'] = line.location_id.id
+ return values
+
+
+class sale_order_line(orm.Model):
+ _inherit = 'sale.order.line'
+
+ _columns = {
+ 'location_id': fields.many2one(
+ 'stock.location',
+ 'Source Location',
+ help="If a source location is selected, "
+ "it will be used as source of the stock moves. "),
+ }
=== added file 'stock_location_ownership/model/stock.py'
--- stock_location_ownership/model/stock.py 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/model/stock.py 2013-11-25 12:45:08 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Guewen Baconnier
+# Copyright 2013 Camptocamp SA
+#
+# 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 orm, fields
+
+
+class stock_location(orm.Model):
+ _inherit = 'stock.location'
+
+ _columns = {
+ 'owner_id': fields.many2one(
+ 'res.partner',
+ 'Owner',
+ help="Owner of the location if different from the company "
+ "or address."),
+ }
=== added directory 'stock_location_ownership/test'
=== added file 'stock_location_ownership/test/sale_order_not_sourced.yml'
--- stock_location_ownership/test/sale_order_not_sourced.yml 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/test/sale_order_not_sourced.yml 2013-11-25 12:45:08 +0000
@@ -0,0 +1,38 @@
+-
+ In order to check if the source location of a sale order line
+ still use the location of the shop if not specified on the
+ sale order line.
+-
+ !record {model: sale.order, id: sale_notsourced_01}:
+ partner_id: base.res_partner_2
+ note: Invoice after delivery
+ order_line:
+ - product_id: product.product_product_7
+ product_uom_qty: 8
+-
+ When I confirm the sale order
+-
+ !workflow {model: sale.order, action: order_confirm, ref: sale_notsourced_01}
+-
+ Then a delivery order should have been generated
+-
+ !python {model: sale.order}: |
+ sale_order = self.browse(cr, uid, ref("sale_notsourced_01"))
+ assert len(sale_order.picking_ids) == 1, (
+ "1 delivery order expected, got %d" % len(sale_order.picking_ids))
+-
+ And the source location of the stock move should be the one of
+ the sales order's shop
+-
+ !python {model: sale.order}: |
+ sale_order = self.browse(cr, uid, ref("sale_notsourced_01"))
+ picking = sale_order.picking_ids[0]
+ location_id = sale_order.shop_id.warehouse_id.lot_stock_id
+ for move in picking.move_lines:
+ assert move.location_id == location_id, (
+ "Wrong location_id, expected %s, got %s" %
+ (location_id, move.location_id))
+ for procurement in move.procurements:
+ assert procurement.location_id == location_id, (
+ "Wrong location_id in procurement.order, expected %s, got %s" %
+ (location_id, procurement.location_id))
=== added file 'stock_location_ownership/test/sale_order_source.yml'
--- stock_location_ownership/test/sale_order_source.yml 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/test/sale_order_source.yml 2013-11-25 12:45:08 +0000
@@ -0,0 +1,40 @@
+-
+ In order to check if the source location of a sale order line
+ becomes the source location of the delivery stock move.
+ I create a sale order.
+-
+ !record {model: sale.order, id: sale_source_01}:
+ partner_id: base.res_partner_2
+ note: Invoice after delivery
+ order_line:
+ - product_id: product.product_product_7
+ product_uom_qty: 8
+ location_id: stock.stock_location_shop1
+-
+ When I confirm the sale order
+-
+ !workflow {model: sale.order, action: order_confirm, ref: sale_source_01}
+-
+ Then a delivery order should have been generated
+-
+ !python {model: sale.order}: |
+ sale_order = self.browse(cr, uid, ref("sale_source_01"))
+ assert len(sale_order.picking_ids) == 1, (
+ "1 delivery order expected, got %d" % len(sale_order.picking_ids))
+-
+ And the source location of the stock move should be the one of
+ the sale order line
+-
+ !python {model: sale.order}: |
+ sale_order = self.browse(cr, uid, ref("sale_source_01"))
+ picking = sale_order.picking_ids[0]
+ for move in picking.move_lines:
+ expected_location_id = move.sale_line_id.location_id
+ assert move.location_id == expected_location_id, (
+ "Wrong location_id in stock.move, expected %s, got %s" %
+ (expected_location_id, move.location_id))
+ for procurement in move.procurements:
+ assert procurement.location_id == expected_location_id, (
+ "Wrong location_id in procurement.order, expected %s, got %s" %
+ (expected_location_id, procurement.location_id))
+
=== added directory 'stock_location_ownership/view'
=== added file 'stock_location_ownership/view/sale_view.xml'
--- stock_location_ownership/view/sale_view.xml 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/view/sale_view.xml 2013-11-25 12:45:08 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data noupdate="0">
+ <record id="view_order_form" model="ir.ui.view">
+ <field name="name">sale.order.form</field>
+ <field name="model">sale.order</field>
+ <field name="inherit_id" ref="sale.view_order_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='order_line']/tree/field[@name='price_subtotal']"
+ position="after">
+ <field name="location_id"/>
+ </xpath>
+ </field>
+ </record>
+ <record id="view_order_form_form" model="ir.ui.view">
+ <field name="name">sale.order.form</field>
+ <field name="model">sale.order</field>
+ <field name="inherit_id" ref="sale.view_order_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='order_line']/form/group/group/field[@name='product_id']"
+ position="after">
+ <field name="location_id"/>
+ </xpath>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added file 'stock_location_ownership/view/stock_view.xml'
--- stock_location_ownership/view/stock_view.xml 1970-01-01 00:00:00 +0000
+++ stock_location_ownership/view/stock_view.xml 2013-11-25 12:45:08 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data noupdate="0">
+ <record id="view_stock_location_form" model="ir.ui.view">
+ <field name="name">stock.location.form</field>
+ <field name="model">stock.location</field>
+ <field name="inherit_id" ref="stock.view_location_form"/>
+ <field name="arch" type="xml">
+ <field name="partner_id" position="after">
+ <field name="owner_id"/>
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
Follow ups
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Alexandre Fayolle - camptocamp, 2014-03-13
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Pedro Manuel Baeza, 2014-03-13
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Yannick Vaucher @ Camptocamp, 2014-03-13
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Guewen Baconnier @ Camptocamp, 2014-03-13
-
[Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Yannick Vaucher @ Camptocamp, 2014-03-13
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Pedro Manuel Baeza, 2014-03-13
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Yannick Vaucher @ Camptocamp, 2014-03-13
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Pedro Manuel Baeza, 2014-02-06
-
[Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: noreply, 2014-02-06
-
Re: [Merge] lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Pedro Manuel Baeza, 2014-01-31
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Lionel Sausin - Numérigraphe, 2014-01-24
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Lionel Sausin - Numérigraphe, 2014-01-24
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Lionel Sausin - Numérigraphe, 2014-01-24
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Romain Deheele - Camptocamp, 2014-01-10
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Guewen Baconnier @ Camptocamp, 2014-01-10
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Guewen Baconnier @ Camptocamp, 2013-12-11
-
Re: lp:~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi into lp:stock-logistic-warehouse
From: Romain Deheele - Camptocamp, 2013-11-27