[10.0][MIG] stock_quant_manual_assign: Migration to 10.0

This commit is contained in:
Fanha Giang
2017-07-26 15:29:25 +07:00
committed by Tony Gu
parent 344d61b8a1
commit b352454add
11 changed files with 39 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:target: http://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
===============================
@@ -14,12 +14,17 @@ Usage
To use this module, you need to:
#. Select a stock move or a stock picking.
#. Click on the tab "Initial Demand".
#. Click on the line which you need to select quants.
#. Open the wizard with the button "Manual Quants".
#. Select the quants to assign (reserve).
#. Select the quants to assign (reserve), then Confirm.
#. Close the stock move line windows (which is popup by step 3).
#. Click on the tab "Operations"
#. Click on the "Recompute" to update the stock move info.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/153/9.0
:target: https://runbot.odoo-community.org/runbot/153/10.0
Bug Tracker
===========
@@ -32,6 +37,11 @@ help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
@@ -39,6 +49,7 @@ Contributors
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Ana Juaristi <anajuaristi@avanzosc.es>
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
* Fanha Giang <fanha99@hotmail.com>
Maintainer
----------

View File

@@ -1,19 +1,20 @@
# -*- coding: utf-8 -*-
# (c) 2015 Mikel Arregi - AvanzOSC
# (c) 2016 Tecnativa - Pedro M. Baeza
# (c) 2017 Eficent - Jordi Ballester
# Copyright 2015 Mikel Arregi - AvanzOSC
# Copyright 2016 Tecnativa - Pedro M. Baeza
# Copyright 2017 Eficent - Jordi Ballester
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Stock - Manual Quant Assignment",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"category": "Warehouse Management",
"license": "AGPL-3",
"author": "AvanzOSC, "
"Tecnativa, "
"Eficent, "
"Fanha Giang, "
"Odoo Community Association (OCA)",
"website": "http://www.odoomrp.com",
"website": "https://odoo-community.org",
"depends": [
"stock",
],

View File

@@ -2,7 +2,7 @@
# (c) 2015 Mikel Arregi - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import fields, models
from odoo import fields, models
class StockMove(models.Model):

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -2,8 +2,8 @@
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common
from openerp import exceptions
import odoo.tests.common as common
from odoo import exceptions
class TestStockQuantManualAssign(common.TransactionCase):

View File

@@ -31,4 +31,4 @@
</field>
</field>
</record>
</odoo>
</odoo>

View File

@@ -3,9 +3,9 @@
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import api, exceptions, fields, models, _
import openerp.addons.decimal_precision as dp
from openerp.tools.float_utils import float_compare
from odoo import _, api, exceptions, fields, models
import odoo.addons.decimal_precision as dp
from odoo.tools.float_utils import float_compare
class AssignManualQuants(models.TransientModel):
@@ -14,13 +14,13 @@ class AssignManualQuants(models.TransientModel):
@api.multi
@api.constrains('quants_lines')
def check_qty(self):
precision_digits = dp.get_precision('Product Unit of Measure'
)(self.env.cr)[1]
precision_digits = self.env[
'decimal.precision'].precision_get('Product Unit of Measure')
move = self.env['stock.move'].browse(self.env.context['active_id'])
for record in self.filtered(lambda x: x.quants_lines):
for record in self.filtered('quants_lines'):
if float_compare(record.lines_qty, move.product_qty,
precision_digits=precision_digits) > 0:
raise exceptions.Warning(
raise exceptions.UserError(
_('Quantity is higher than the needed one'))
@api.depends('quants_lines', 'quants_lines.qty')
@@ -51,11 +51,9 @@ class AssignManualQuants(models.TransientModel):
move.picking_id.recompute_pack_op = True
for quant_id in move.reserved_quant_ids.ids:
move.write({'reserved_quant_ids': [[3, quant_id]]})
for line in self.quants_lines:
if line.selected:
quants.append([line.quant, line.qty])
self.pool['stock.quant'].quants_reserve(
self.env.cr, self.env.uid, quants, move, context=self.env.context)
for line in self.quants_lines.filtered('selected'):
quants.append([line.quant, line.qty])
self.env['stock.quant'].quants_reserve(quants, move)
return {}
@api.model
@@ -73,6 +71,7 @@ class AssignManualQuants(models.TransientModel):
quants_lines = [{
'quant': x.id,
'lot_id': x.lot_id.id,
'in_date': x.in_date,
'package_id': x.package_id.id,
'selected': x in move.reserved_quant_ids,
'qty': x.qty if x in move.reserved_quant_ids else 0,
@@ -112,6 +111,8 @@ class AssignManualQuantsLines(models.TransientModel):
comodel_name='stock.production.lot', string='Lot',
related='quant.lot_id', readonly=True,
groups="stock.group_production_lot")
in_date = fields.Date(
string='Incoming Date', readonly=True)
package_id = fields.Many2one(
comodel_name='stock.quant.package', string='Package',
related='quant.package_id', readonly=True,

View File

@@ -10,6 +10,7 @@
<tree editable="top" delete="0" create="0">
<field name="quant" />
<field name="location_id" />
<field name="in_date" />
<field name="lot_id" />
<field name="package_id" />
<field name="selected" />
@@ -32,4 +33,4 @@
<act_window name="Manual quants" res_model="assign.manual.quants"
src_model="stock.move" view_mode="form" target="new"
id="assign_manual_quants_action" />
</odoo>
</odoo>