Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] product_customer_code_picking module v.7.0 #2

Merged
merged 34 commits into from
Oct 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8fce27d
[FIX] Add product_customer_code_picking
Dec 18, 2013
0b9cb10
[FIX] Modified __openerp__ file
Dec 19, 2013
d764c3d
[FIX] Mod view
Dec 19, 2013
4f5a279
[FIX] Mod view
Dec 19, 2013
b856c5e
[FIX] View Mod
Dec 19, 2013
55ff3dd
[FIX] Move bug fix
Dec 19, 2013
8316ec7
[FIX] More fix problem
Dec 19, 2013
fc65e0a
[FIX] mod to view
Dec 19, 2013
e226a6d
[FIX] field bug fix
Dec 19, 2013
6538923
[FIX] Changed view
Dec 19, 2013
20ccc37
[FIX] Mod view
Dec 19, 2013
e21e5ea
[FIX] Picking View Fix
Dec 19, 2013
eb5d66d
[FIX] fix product_code problem
Dec 20, 2013
3b6331f
[FIX] Conflict in view
Dec 20, 2013
6500715
[FIX] Added some Flake8 fix
Jan 10, 2014
3ea6bfc
[FIX] Added i18n
Jan 15, 2014
0e74e68
[FIX] Deleted .mo
Jan 16, 2014
2ed05aa
[FIX] added pot
Jan 20, 2014
82ab210
[FIX] how to get partner inside of _get_product_customer_code method
tafaRU Jun 20, 2014
1980c73
[FIX] Removed context assignement because not needed
tafaRU Jun 20, 2014
c506552
[IMP] Better practices
tafaRU Jun 20, 2014
9d39539
[IMP] better readibility
tafaRU Jun 20, 2014
9ad6f38
[IMP] Replaced browse by read to improve performance
tafaRU Jun 20, 2014
a32321f
[FIX] keys in manifest file
tafaRU Jun 20, 2014
7f53727
[FIX] Applies some PEP8 cleanup
tafaRU Jun 20, 2014
9954751
[ADD] contributors section
tafaRU Jun 20, 2014
bd42b80
[FIX] Added retrieve of parentd_id
tafaRU Jun 22, 2014
8ca8423
[FIX] W291 trailing whitespace
eLBati Sep 8, 2014
8dddffa
Merge pull request #2 from eLBati/fix_adding_product_customer_code_pi…
tafaRU Sep 8, 2014
447243e
[FIX] generic partner structure
eLBati Sep 9, 2014
f20a8bc
[FIX] using
eLBati Sep 13, 2014
248de45
Merge pull request #3 from eLBati/imp_adding_product_customer_code_pi…
tafaRU Sep 15, 2014
baac3c1
Merge remote-tracking branch 'origin/7.0' into HEAD
tafaRU Oct 7, 2014
a2ea807
[IMP] module description
tafaRU Oct 7, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions product_customer_code_picking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
#
# 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 stock_picking
49 changes: 49 additions & 0 deletions product_customer_code_picking/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
#
# 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/>.
#
##############################################################################
{
"name": "Product Customer code for stock picking",
"version": "1.0",
"author": "Agile Business Group",
"website": "http://www.agilebg.com",
"license": 'AGPL-3',
"category": "Stock",
"depends": [
'base',
'product',
'stock',
'product_customer_code'
],
"description": """
This module makes the product customer code visible in the stock moves
of a picking.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested description improvement:

"This module makes the product customer code visible in the stock moves of a picking. "

Contributors
------------
* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
* Alex Comba <alex.comba@agilebg.com>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
""",
"demo": [],
"data": [
'stock_picking_view.xml',
],
"installable": True,
}
33 changes: 33 additions & 0 deletions product_customer_code_picking/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_customer_code_picking
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-15 14:28+0000\n"
"PO-Revision-Date: 2014-01-15 15:29+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: it\n"
"X-Generator: Poedit 1.6.2\n"

#. module: product_customer_code_picking
#: field:stock.move,product_customer_code:0
msgid "Product Customer Code"
msgstr "Codice Prodotto Cliente"

#. module: product_customer_code_picking
#: model:ir.model,name:product_customer_code_picking.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"

#. module: product_customer_code_picking
#: model:ir.model,name:product_customer_code_picking.model_stock_picking
msgid "Picking List"
msgstr "Documento di trasporto"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_customer_code_picking
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-15 14:28+0000\n"
"PO-Revision-Date: 2014-01-15 14:28+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_customer_code_picking
#: field:stock.move,product_customer_code:0
msgid "Product Customer Code"
msgstr ""

#. module: product_customer_code_picking
#: model:ir.model,name:product_customer_code_picking.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: product_customer_code_picking
#: model:ir.model,name:product_customer_code_picking.model_stock_picking
msgid "Picking List"
msgstr ""

58 changes: 58 additions & 0 deletions product_customer_code_picking/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
#
# 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.osv import fields, orm


class stock_move(orm.Model):
_inherit = 'stock.move'

def _get_product_customer_code(
self, cr, uid, ids, name, args, context=None
):
res = {}
product_customer_code_obj = self.pool['product.customer.code']
for move in self.browse(cr, uid, ids, context=context):
res[move.id] = ''
main_partner_id = (
move.picking_id.partner_id.commercial_partner_id.id)
product = move.product_id
if product and main_partner_id:
code_ids = product_customer_code_obj.search(cr, uid, [
('product_id', '=', product.id),
('partner_id', '=', main_partner_id),
], limit=1, context=context)
if code_ids:
data = product_customer_code_obj.read(
cr, uid, code_ids[0],
['product_code'], context=context
)
res[move.id] = (
'product_code' in data
and data['product_code']
or ''
)
return res

_columns = {
'product_customer_code': fields.function(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this field needs storing especially since you then include it in a tree view. It would seem 'product_id', 'partner_id' on the move are the important fields as well as on the customer code object.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gdgellatly actually the involved views are stock.view_move_picking_tree and stock.view_move_picking_form that are used within the picking form only.
This is why we did not make the field stored

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact if we had the new field in the pure tree view of stock moves, we would be temped to search on that field but we couldn't because the field is not stored and has no search method.

On the other hand, as @eLBati remarks, the field is not added to such a view, so we can consider that a missing feature and not a bug, which is OK by me.

_get_product_customer_code,
string='Product Customer Code', type='char', size=64),
}
36 changes: 36 additions & 0 deletions product_customer_code_picking/stock_picking_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
product customer code picking for OpenERP
Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>).
Authors, Nicola Malcontenti, nicola.malcontenti@agilebg.com
The licence is in the file __openerp__.py
-->
<openerp>
<data>

<record id="view_move_picking_tree" model="ir.ui.view">
<field name="name">stock.move.product.code.tree</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_picking_tree"/>
<field eval="16" name="priority"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_customer_code" />
</field>
</field>
</record>

<record id="view_move_picking_form" model="ir.ui.view">
<field name="name">stock.move.product.code.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_picking_form"/>
<field eval="16" name="priority"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_customer_code" />
</field>
</field>
</record>

</data>
</openerp>