Parcourir la source

commit inicial

Rodney Elpidio Enciso Arias il y a 6 ans
commit
f7e8d10a9f

+ 8 - 0
README.md

@@ -0,0 +1,8 @@
+Quick access of quantity available in each warehouse on the Sales Order
+-----------------------------------------------------------------------
+
+This module is a step forward to allow the user to have access to analysed information quickly.
+This module helps specifically for multi warehouse structure, to find the number of quantity available in each of the warehouse.
+The warehoue has the one stock location.
+There may be various child location of each of that stok location. Each of such location may have some quantity of the product.
+This module shows the cumulative sum of total quantity available in each varehosue and shows on the product form view and kanban view.

+ 24 - 0
__init__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#
+#    Odoo, Open Source Management Solution
+#    Copyright (C) 2017 Ascetic Business Solution <www.asceticbs.com>
+#
+#    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 wizard
+from . import models
+

BIN
__init__.pyc


+ 38 - 0
__openerp__.py

@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#
+#    Odoo, Open Source Management Solution
+#    Copyright (C) 2017 Ascetic Business Solution <www.asceticbs.com>
+#
+#    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': "Sales Product Warehouse Quantity",
+    'author': 'Ascetic Business Solution',
+    'category': 'Warehouse',
+    'summary': """Display available product's quantity from all warehouse when sales order created""",
+    'license': 'AGPL-3',
+    'website': 'http://www.asceticbs.com',
+    'description': """
+""",
+    'version': '8.0.1.0.0',
+    'depends': ['sale','stock'],
+    'data': ['wizard/product_warehouse_quantity.xml','views/sale_view.xml'],
+    'images': ['static/description/banner.png'],
+    'installable': True,
+    'application': True,
+    'auto_install': False,
+}

+ 23 - 0
models/__init__.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#
+#    Odoo, Open Source Management Solution
+#    Copyright (C) 2017 B-informed Asia <info@B-informed.id>
+#
+#    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/>.
+#
+#################################################################################
+
+import sale_order
+

BIN
models/__init__.pyc


+ 81 - 0
models/sale_order.py

@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#
+#    Odoo, Open Source Management Solution
+#    Copyright (C) 2017 Ascetic Business Solution <www.asceticbs.com>
+#
+#    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 import api, fields, models, SUPERUSER_ID, _
+from datetime import datetime, timedelta
+import datetime
+from datetime import datetime
+from dateutil import relativedelta
+
+
+class sale_order_line(models.Model):
+    _inherit = "sale.order.line"
+
+    warehouse_quantity = fields.Char('Stock Quantity per Warehouse')
+
+    #For update the onchange of product
+    def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
+            uom=False, qty_uos=0, uos=False, name='', partner_id=False,
+            lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
+        result = {}
+        res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
+            uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
+            lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
+        if res.get('value',False):
+            result = res['value']
+        warehouse_quantity_text = ''
+        quant_ids = self.pool.get('stock.quant').search(cr, SUPERUSER_ID, [('product_id','=',product),('reservation_id','=',None),('location_id.usage','=','internal')], context=context)
+        t_warehouses = {}
+        for quant in quant_ids:
+            quant_obj = self.pool.get('stock.quant').browse(cr, SUPERUSER_ID, quant, context=context)
+            if quant_obj.location_id:
+                if quant_obj.location_id not in t_warehouses:
+                    t_warehouses.update({quant_obj.location_id:0})
+                t_warehouses[quant_obj.location_id] += quant_obj.qty
+
+        tt_warehouses = {}
+        for location in t_warehouses:
+            location_obj = self.pool.get('stock.location').browse(cr, SUPERUSER_ID, location.id, context=context)
+            warehouse = False
+            location1 = location_obj
+            while (not warehouse and location1):
+                warehouse_id = self.pool.get('stock.warehouse').search(cr, SUPERUSER_ID, [('lot_stock_id','=',location1.id)], context=context)
+                warehouse_obj_id = self.pool.get('stock.warehouse').browse(cr, SUPERUSER_ID, warehouse_id, context=context)
+                if len(warehouse_obj_id) > 0:
+                    warehouse = True
+                else:
+                    warehouse = False
+                location1 = location1.location_id
+            if warehouse_obj_id:
+                if warehouse_obj_id.name not in tt_warehouses:
+                    tt_warehouses.update({warehouse_obj_id.name:0})
+                tt_warehouses[warehouse_obj_id.name] += t_warehouses[location]
+
+        for item in tt_warehouses:
+            if tt_warehouses[item] != 0:
+                warehouse_quantity_text = warehouse_quantity_text + ' ** ' + item + ': ' + str(tt_warehouses[item])
+        result['warehouse_quantity'] = warehouse_quantity_text
+        return {'value': result}
+
+
+
+
+

BIN
models/sale_order.pyc


BIN
static/description/banner.png


BIN
static/description/company-logo.png


BIN
static/description/icon.png


+ 91 - 0
static/description/index.html

@@ -0,0 +1,91 @@
+<html>
+<body>
+<section class="oe_container oe_dark">
+    <div class="oe_row">
+        <div class="oe_row">
+            <h2 class="oe_slogan oe_span10">Sales Product Warehouse Quantity</h2>
+        </div>
+        <div style="margin: 16px 8%;">
+            <p class='oe_mt32 text-justify' style="font-size: 15px;">
+                To empower the user by providing the decision making knowledge is one of the key areas to focus while implementing ERP. 
+            </p>
+
+            <p class='oe_mt32 text-justify' style="font-size: 15px;">
+                An effort towards providing analysed information mining through the already existed data in Odoo.
+            </p>
+
+            <p class='oe_mt32 text-justify' style="font-size: 15px;">
+                The module gives the available quantity of product on multiple warehouses while placing the sales order in Odoo.
+            </p>
+
+            <p class='oe_mt32 text-justify' style="font-size: 15px;">
+                The total cumulative quantity will be calculated considering not only the stock location of the warehouse but also all the sub-locations of each of the stock location of all warehouses. As an example, in the multi warehouse structure, each of the warehouses has one stock location.
+            </p>
+
+        </div>
+    </div>
+</section>
+
+<section class='oe_container oe_dark'>
+    <div class='oe_row'>
+        <div style="margin: 16px 8%;">
+            <p class='oe_mt32 text-justify' style="font-size: 15px;">
+                 The below image will show the option or button to get the information of the product quantity which was available at the time of placing the order.
+            </p>
+        </div>
+        <div class="col-md-12">
+            <img class="oe_picture oe_screenshot" src="sales_product1.png" width="80%"/>
+        </div>
+        <div style="margin: 16px 8%;">
+            <p class='oe_mt32 text-justify' style="font-size: 15px;">
+                 Below images show the detail of the product quantity which was available in each warehouse while placed the sales order.
+            </p>
+        </div>
+        <div class="col-md-12">
+            <img class="oe_picture oe_screenshot" src="sales_product2.png" width="80%"/>
+        </div>
+    </div>
+</section>
+
+<section class="oe_container">
+
+    <h2 class="oe_slogan" style="margin-top:20px;">Need help?</h2>
+
+    <div style="margin: 16px 8%;">
+            <p class='oe_mt32 center-block' style="font-size: 15px;">
+                 Contact this module maintainer for any question, need support or request for the new feature : <br/>
+                 * Riken Bhorania  <i class="fa fa-whatsapp"></i> +91 9427425799,  <i class="fa fa-skype fa_custom"></i> <a href="skype:riken.bhorania?chat">riken.bhorania, </a> <i class="fa fa-envelope"></i> riken.bhorania@asceticbs.com <br/>
+                 * Bhaumin Chorera  <i class="fa fa-whatsapp"></i> +91 8530000384, <i class="fa fa-skype fa_custom"></i> <a href="skype:bhaumin.chorera?chat">bhaumin.chorera, </a> <i class="fa fa-envelope"></i> bhaumin.chorera@asceticbs.com <br/>
+            </p>
+    </div>
+
+    <div class="oe_slogan" style="margin-top:10px !important;"> 
+         <a class="btn btn-primary btn-lg mt8"
+            style="color: #FFFFFF !important;" href="http://www.asceticbs.com"><i
+            class="fa fa-envelope"></i> Website </a> 
+         <a class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
+            href="http://www.asceticbs.com/contact-us"><i
+            class="fa fa-phone"></i> Contact Us </a> 
+         <a class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
+            href="http://www.asceticbs.com/services"><i
+            class="fa fa-check-square"></i> Services </a> 
+         <a class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
+            href="https://apps.odoo.com/apps/modules/browse?author=Ascetic%20Business%20Solution"><i
+            class="fa fa-binoculars"></i> More Apps </a>
+     </div>
+
+    <div class="oe_slogan" style="margin-top:10px !important;"> 
+      <img src="company-logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
+    </div>
+
+    <div class="oe_slogan" style="margin-top:10px !important;">
+          <a href="https://twitter.com/asceticbs" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
+          <a href="https://www.linkedin.com/company/ascetic-business-solution-llp" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
+          <a href="https://www.facebook.com/asceticbs" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
+          <a href="https://www.youtube.com/channel/UCsozahEAndQ2whjcuDIBNZQ" target="_blank"><i class="fa fa-2x fa-youtube-play" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
+     </div>
+
+</section>
+
+</body>
+</html>

BIN
static/description/sales_product1.png


BIN
static/description/sales_product2.png


+ 25 - 0
views/sale_view.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<openerp>
+<data>  
+
+       <!-- Extended the sale order line view for get sales warehouse quantity -->
+       <record id="view_sale_order_line_inherit_sale_warehouse_quantity" model="ir.ui.view">
+            <field name="name">view.sale.order.line.inherit.sale.warehouse.quantity</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"> 
+		            <button name="%(action_view_warehouse_quantity)d" type="action" string="stock"/>
+		        </xpath>
+		        <xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after"> 
+		            <field name="warehouse_quantity" invisible="1"/>
+		        </xpath>
+		        <xpath expr="//field[@name='order_line']/form//field[@name='price_unit']" position="after"> 
+		            <field name="warehouse_quantity" invisible="1"/>
+		        </xpath>
+	        </field>
+	   </record>
+
+    </data>
+</openerp>

+ 22 - 0
wizard/__init__.py

@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#
+#    Odoo, Open Source Management Solution
+#    Copyright (C) 2017 Ascetic Business Solution <www.asceticbs.com>
+#
+#    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 product_warehouse_quantity

BIN
wizard/__init__.pyc


+ 39 - 0
wizard/product_warehouse_quantity.py

@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#
+#    Odoo, Open Source Management Solution
+#    Copyright (C) 2017 Ascetic Business Solution <www.asceticbs.com>
+#
+#    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 import models, fields, api, exceptions
+from openerp.tools.translate import _
+
+class SaleProductWarehouseQuantity(models.TransientModel):
+    _name = "sale.product.warehouse.quantity"
+    _description = "Sales Product Warehouse Quantity"
+
+    def _default_warehouse_quantity(self):
+        if self.env.context.get('active_model', '') == 'sale.order.line':
+            ids = self.env.context['active_ids']
+            order_lines = self.env['sale.order.line'].browse(ids)
+            if order_lines:
+                for line in order_lines:
+                    warehouse_quantity = line.warehouse_quantity
+                    return warehouse_quantity
+
+    warehouse_quantity = fields.Char(string = 'Stock Quantity per Warehouse', default=_default_warehouse_quantity, required=True, readonly=True)
+

BIN
wizard/product_warehouse_quantity.pyc


+ 27 - 0
wizard/product_warehouse_quantity.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data> 
+
+        <record id="view_product_wareouse_quantity" model="ir.ui.view">
+            <field name="name">Sales Product Warehouse Quantity</field>
+            <field name="model">sale.product.warehouse.quantity</field>
+            <field name="arch" type="xml">
+                <form string="Sales Product Warehouse Quantity">
+                    <group>
+                        <field name="warehouse_quantity" string="Stock"/>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_view_warehouse_quantity" model="ir.actions.act_window">
+            <field name="name">Stock por Almacen</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">sale.product.warehouse.quantity</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="target">new</field>
+        </record>
+
+    </data>
+</openerp>