Avoid models folder since there's no need to update product_uos_qty on move_created_ids2.

This is already done by split method of stock.move (see file stock/stock.py as reference) updating product_uos_qty on move_created_ids
This commit is contained in:
Alex Comba
2016-01-29 15:02:45 +01:00
parent d6ec8f9b9d
commit e882984819
3 changed files with 0 additions and 38 deletions

View File

@@ -2,5 +2,4 @@
# (c) 2015 Alex Comba - Agile Business Group
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
from . import wizard

View File

@@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
# (c) 2015 Alex Comba - Agile Business Group
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import mrp_production

View File

@@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
# (c) 2015 Alex Comba - Agile Business Group
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api
class MrpProduction(models.Model):
_inherit = 'mrp.production'
@api.model
def action_produce(self, production_id, production_qty,
production_mode, wiz=False):
res = super(MrpProduction, self).action_produce(
production_id, production_qty, production_mode, wiz)
mrp_production = self.browse(production_id)
for move in mrp_production.move_created_ids2:
product_uom_qty = move.product_uom_qty
p_qty = mrp_production.product_qty
p_uos_qty = mrp_production.product_uos_qty
product_uos_qty = p_uos_qty * (product_uom_qty / p_qty)
# I used sql to avoid
# https://github.com/odoo/odoo/blob/8.0/addons/stock/stock.py#L1980
self.env.cr.execute(
'UPDATE stock_move SET product_uos_qty = %s '
'WHERE id = %s',
(product_uos_qty, move.id)
)
return res