Skip to content

Commit

Permalink
[MERGE] Latest team branches
Browse files Browse the repository at this point in the history
* team/8.0-_conflicts-2015-09-10: (30 commits)
  Migrate stock_available_sale to v8
  Restore the features of stock_available_immediately
  Revert "[DEL] removed references to product.py, not needed anymore, the quant calculations done in product template are fine."
  Revert "[DEL] remove old tests, rewriting"
  Remove loop and use correct decorator
  Revert changes to computation of _immediately_usable_qty
  [FIX] stock_available : update sublocations computation
  Fix translation
  Change translation stock/existencias
  Add Spanish translation of stock reserve modules
  Update travis configuration
  Replaced for loop in release() with mapped()
  [ADD] Tests
  [FIX] searching on products, leaving full calculations not using internal qty_available that seems not to take in consideration reserved quants.
  Multiple reservations can now be released at once. This fixes issue OCA#50.
  [DEL] remove old tests, rewriting
  [DEL] removed references to product.py, not needed anymore, the quant calculations done in product template are fine.
  [FIX] typo
  [ADD} location calculations
  [Fix] Typo
  ...

* team/8.0-stock-available-sale: (30 commits)
  Try another way to quote python in RST to please Travis
  force recomputation of stock.location hierachy
  update travis config, setup transifex
  Add directions to block quotations using sale_exceptions
  'Quoted qty' is now positive. Explain UoM feature drop.
  Migrate stock_available_sale to v8
  [FIX] stock_available : update sublocations computation
  Fix translation
  Change translation stock/existencias
  Add Spanish translation of stock reserve modules
  Update travis configuration
  Replaced for loop in release() with mapped()
  [ADD] Tests
  [FIX] searching on products, leaving full calculations not using internal qty_available that seems not to take in consideration reserved quants.
  Multiple reservations can now be released at once. This fixes issue OCA#50.
  [DEL] remove old tests, rewriting
  [DEL] removed references to product.py, not needed anymore, the quant calculations done in product template are fine.
  [FIX] typo
  [ADD} location calculations
  [Fix] Typo
  ...

* team/8.0-stock_available-based-on-virtual: (34 commits)
  Fix the beta lint checks of Travis
  force recomputation of stock.location hierachy
  update travis config, setup transifex
  PEP8
  Restore the qty avail. to promise on variant treeview
  Restore the features of stock_available_immediately
  Revert "[DEL] removed references to product.py, not needed anymore, the quant calculations done in product template are fine."
  Revert "[DEL] remove old tests, rewriting"
  Remove loop and use correct decorator
  Revert changes to computation of _immediately_usable_qty
  [FIX] stock_available : update sublocations computation
  Fix translation
  Change translation stock/existencias
  Add Spanish translation of stock reserve modules
  Update travis configuration
  Replaced for loop in release() with mapped()
  [ADD] Tests
  [FIX] searching on products, leaving full calculations not using internal qty_available that seems not to take in consideration reserved quants.
  Multiple reservations can now be released at once. This fixes issue OCA#50.
  [DEL] remove old tests, rewriting
  ...
  • Loading branch information
Lionel Sausin committed Oct 6, 2015
4 parents cc49292 + 2974a65 + 117edb6 + aa6478d commit 7ab5b74
Show file tree
Hide file tree
Showing 49 changed files with 2,232 additions and 300 deletions.
26 changes: 17 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# Config file .travis.yml

language: python
python:
- "2.7"

sudo: false
cache: pip

addons:
apt:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow

language: python

python:
- "2.7"

env:
- VERSION="8.0" LINT_CHECK="1"
- VERSION="8.0" ODOO_REPO="odoo/odoo" LINT_CHECK="0"
- VERSION="8.0" ODOO_REPO="OCA/OCB" LINT_CHECK="0"
global:
- VERSION="8.0" TESTS="0" LINT_CHECK="0"
- TRANSIFEX_USER='transbot@odoo-community.org'
- secure: tDsvZaY3JqmnjgyRuKkgQRtlRILkkjnHtZPWWaGg+KBD+BBH4AqX5ACTyu5U/J6Kr/Yb5NIoM3+NYRuASdGXnJb9siZvh/9B58B1wKUbC2umH4Yrpw66CEvG9JY4XMOCZni9kQBwQ7iMk5GfusDWuVuydZjd6dAqkCxz6JdkIco=
matrix:
- LINT_CHECK="1"
- TRANSIFEX="1"
- TESTS=1 ODOO_REPO="odoo/odoo" LINT_CHECK="0"
- TESTS=1 ODOO_REPO="OCA/OCB" LINT_CHECK="0"

virtualenv:
system_site_packages: true
Expand All @@ -30,4 +38,4 @@ script:
- travis_run_tests

after_success:
coveralls
- travis_after_tests_success
File renamed without changes.
232 changes: 0 additions & 232 deletions __unported__/stock_available_sale/product.py

This file was deleted.

3 changes: 1 addition & 2 deletions stock_available/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
#
##############################################################################

from . import product
from . import res_config
from . import models
5 changes: 3 additions & 2 deletions stock_available/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
'depends': ['stock'],
'license': 'AGPL-3',
'data': [
'product_view.xml',
'res_config_view.xml',
'views/product_template_view.xml',
'views/product_product_view.xml',
'views/res_config_view.xml',
]
}
23 changes: 23 additions & 0 deletions stock_available/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
#
# 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_template
from . import product_product
from . import res_config
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,27 @@
from openerp.addons import decimal_precision as dp


class ProductTemplate(models.Model):
class ProductProduct(models.Model):
"""Add a field for the stock available to promise.
Useful implementations need to be installed through the Settings menu or by
installing one of the modules stock_available_*
"""
_inherit = 'product.template'
_inherit = 'product.product'

@api.one
@api.depends('virtual_available')
def _product_available(self):
def _immediately_usable_qty(self):
"""No-op implementation of the stock available to promise.
By default, available to promise = forecasted quantity.
Must be overridden by another module that actually implement
computations."""
for product in self:
product.immediately_usable_qty = product.virtual_available
self.immediately_usable_qty = self.virtual_available

immediately_usable_qty = fields.Float(
digits=dp.get_precision('Product Unit of Measure'),
compute='_product_available',
compute='_immediately_usable_qty',
string='Available to promise',
help="Stock for this Product that can be safely proposed "
"for sale to Customers.\n"
Expand Down
42 changes: 42 additions & 0 deletions stock_available/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
#
# 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
from openerp.addons import decimal_precision as dp


class ProductTemplate(models.Model):
_inherit = 'product.template'

@api.one
@api.depends('virtual_available')
def _immediately_usable_qty(self):
"""Compute the quantity using all the variants"""
self.immediately_usable_qty = sum(
[v.immediately_usable_qty for v in self.product_variant_ids])

immediately_usable_qty = fields.Float(
digits=dp.get_precision('Product Unit of Measure'),
compute='_immediately_usable_qty',
string='Available to promise',
help="Stock for this Product that can be safely proposed "
"for sale to Customers.\n"
"The definition of this value can be configured to suit "
"your needs")
Loading

0 comments on commit 7ab5b74

Please sign in to comment.