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

View File

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

View File

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

View File

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