FIX only get supplier code, not default code to avoid confusing

This commit is contained in:
David Beal
2016-11-11 21:58:03 +01:00
parent 64cb3d44ad
commit 7948193fe0
4 changed files with 25 additions and 22 deletions

View File

@@ -1,19 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_usability
# * stock_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-10 13:46+0000\n"
"PO-Revision-Date: 2016-11-10 13:46+0000\n"
"POT-Creation-Date: 2016-11-11 20:54+0000\n"
"PO-Revision-Date: 2016-11-11 21:56+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: fr\n"
"X-Generator: Poedit 1.8.7.1\n"
#. module: stock_usability
#: view:stock.picking:stock_usability.view_picking_internal_search
@@ -215,14 +217,14 @@ msgid "Stock Moves"
msgstr "Mouvements de stock"
#. module: stock_usability
#: field:stock.move,product_code:0
#: field:stock.move,product_supplier_code:0
msgid "Supplier Code"
msgstr "Code Fournisseur"
#. module: stock_usability
#: help:stock.move,product_code:0
msgid "Supplier product code if exist else product Internal Reference if exist"
msgstr "Code article fournisseur si existant sinon référence interne de l'article si existant"
#: help:stock.move,product_supplier_code:0
msgid "Supplier product code if Partner is the supplier"
msgstr "Code produit du fournisseur si le partenaire est le fournisseur"
#. module: stock_usability
#: model:ir.model,name:stock_usability.model_stock_picking_type
@@ -254,4 +256,3 @@ msgstr "Unité de Mesure"
#: view:stock.move:stock_usability.view_move_picking_tree
msgid "Unreserve"
msgstr "Déréserver"

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-11 17:22+0000\n"
"PO-Revision-Date: 2016-11-11 17:22+0000\n"
"POT-Creation-Date: 2016-11-11 20:54+0000\n"
"PO-Revision-Date: 2016-11-11 20:54+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -215,13 +215,13 @@ msgid "Stock Moves"
msgstr ""
#. module: stock_usability
#: field:stock.move,product_code:0
#: field:stock.move,product_supplier_code:0
msgid "Supplier Code"
msgstr ""
#. module: stock_usability
#: help:stock.move,product_code:0
msgid "Supplier product code if exist else product Internal Reference if exist"
#: help:stock.move,product_supplier_code:0
msgid "Supplier product code if Partner is the supplier"
msgstr ""
#. module: stock_usability

View File

@@ -77,11 +77,10 @@ class StockWarehouseOrderpoint(models.Model):
class StockMove(models.Model):
_inherit = 'stock.move'
product_code = fields.Char(
string='Supplier Code', compute='_compute_product_code',
product_supplier_code = fields.Char(
string='Supplier Code', compute='_compute_supplier_code',
store=True, readonly=True,
help="Supplier product code if exist else product "
"Internal Reference if exist")
help="Supplier product code if Partner is the supplier")
# It seems that it is not necessary any more to
# have the digits= on these 2 fields to fix the bug
@@ -93,11 +92,14 @@ class StockMove(models.Model):
@api.multi
@api.depends('product_id', 'picking_id.partner_id')
def _compute_product_code(self):
def _compute_supplier_code(self):
for rec in self:
supplier_code = False
if rec.picking_id.partner_id and rec.product_id:
rec.product_code = rec.with_context(
partner_id=rec.picking_id.partner_id.id).product_id.code
for supplier_info in rec.product_id.seller_ids:
if supplier_info.name == rec.picking_id.partner_id:
supplier_code = supplier_info.product_code
rec.product_supplier_code = supplier_code
def name_get(self, cr, uid, ids, context=None):
'''name_get of stock_move is important for the reservation of the

View File

@@ -162,7 +162,7 @@
states="confirmed,assigned"/>
</field>
<field name="product_id" position="after">
<field name="product_code"/>
<field name="product_supplier_code"/>
</field>
</field>
</record>