Merge lp:~agilebg/stock-logistic-flows/adding_product_customer_code_picking into lp:stock-logistic-flows

Proposed by Nicola Malcontenti - Agile BG
Status: Needs review
Proposed branch: lp:~agilebg/stock-logistic-flows/adding_product_customer_code_picking
Merge into: lp:stock-logistic-flows
Diff against target: 260 lines (+229/-0)
6 files modified
product_customer_code_picking/__init__.py (+21/-0)
product_customer_code_picking/__openerp__.py (+48/-0)
product_customer_code_picking/i18n/it.po (+33/-0)
product_customer_code_picking/i18n/product_customer_code_picking.pot (+32/-0)
product_customer_code_picking/stock_picking.py (+59/-0)
product_customer_code_picking/stock_picking_view.xml (+36/-0)
To merge this branch: bzr merge lp:~agilebg/stock-logistic-flows/adding_product_customer_code_picking
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp Needs Resubmitting
Lorenzo Battistini (community) Needs Fixing
Pedro Manuel Baeza code review Needs Fixing
Raphaël Valyi - http://www.akretion.com Approve
Joël Grand-Guillaume @ camptocamp depends on an mp work in progress Needs Fixing
Review via email: mp+202472@code.launchpad.net

Description of the change

Based on product_customer_code,this module loads in every stock picking the customer code defined in the product.
This module depends on https://code.launchpad.net/~akretion-team/openerp-product-attributes/7.0-product-customer-code-extraction/+merge/198296.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Do not merge until other MP is ready

review: Needs Fixing (depends on an mp work in progress)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

LGTM, pending merges have been processed now

review: Approve
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I have made some comments inline, and I wonder if the module name wouldn't be better as stock_picking_product_customer_code to follow current core conventions (more or less, you know that there is no written rules).

Regards.

review: Needs Fixing (code review)
58. By Alex Comba - Agile BG

[FIX] how to get partner inside of _get_product_customer_code method

59. By Alex Comba - Agile BG

[FIX] Removed context assignement because not needed

60. By Alex Comba - Agile BG

[IMP] Better practices

61. By Alex Comba - Agile BG

[IMP] better readibility

62. By Alex Comba - Agile BG

[IMP] Replaced browse by read to improve performance

63. By Alex Comba - Agile BG

[FIX] keys in manifest file

64. By Alex Comba - Agile BG

[FIX] Applies some PEP8 cleanup

65. By Alex Comba - Agile BG

[ADD] contributors section

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Hi Pedro,

thank you for your review and for your precious hints!

I made the changes as you suggested us. In addition I fixed a bug in rev.58.

Cheers.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Including 1 diff comment

About the module name: in general I agree with Pedro.
In this case, the other modules follow the same naming as this: see
http://bazaar.launchpad.net/~account-core-editors/account-invoicing/7.0/files/47/product_customer_code_invoice/
So, for now, I would keep the current name

review: Needs Fixing
66. By Alex Comba - Agile BG

[FIX] Added retrieve of parentd_id

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Lorenzo,

please have a look at my last commit, now it should be ok.

Cheers.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

2014-06-22 23:10 GMT+02:00 Alex Comba - Agile BG <email address hidden>:

> Lorenzo,
>
> please have a look at my last commit, now it should be ok.
>
>
Thanks Alex,

maybe we could handle even more particular cases by using the address_get
method to retrieve the company?

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

The source code management for this project has been moved to https://github.com/OCA/stock-logistics-workflow

Could you resubmit this MP on the new site?

review: Needs Resubmitting
Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Alexandre, I'll do it asap.

Cheers.

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Alexandre,

you can find the related PR on github here: https://github.com/OCA/stock-logistics-workflow/pull/2

Unmerged revisions

66. By Alex Comba - Agile BG

[FIX] Added retrieve of parentd_id

65. By Alex Comba - Agile BG

[ADD] contributors section

64. By Alex Comba - Agile BG

[FIX] Applies some PEP8 cleanup

63. By Alex Comba - Agile BG

[FIX] keys in manifest file

62. By Alex Comba - Agile BG

[IMP] Replaced browse by read to improve performance

61. By Alex Comba - Agile BG

[IMP] better readibility

60. By Alex Comba - Agile BG

[IMP] Better practices

59. By Alex Comba - Agile BG

[FIX] Removed context assignement because not needed

58. By Alex Comba - Agile BG

[FIX] how to get partner inside of _get_product_customer_code method

57. By Nicola Malcontenti - Agile BG

[FIX] added pot

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'product_customer_code_picking'
=== added file 'product_customer_code_picking/__init__.py'
--- product_customer_code_picking/__init__.py 1970-01-01 00:00:00 +0000
+++ product_customer_code_picking/__init__.py 2014-06-22 21:01:44 +0000
@@ -0,0 +1,21 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from . import stock_picking
022
=== added file 'product_customer_code_picking/__openerp__.py'
--- product_customer_code_picking/__openerp__.py 1970-01-01 00:00:00 +0000
+++ product_customer_code_picking/__openerp__.py 2014-06-22 21:01:44 +0000
@@ -0,0 +1,48 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 "name": "Product Customer code for stock picking",
23 "version": "1.0",
24 "author": "Agile Business Group",
25 "website": "http://www.agilebg.com",
26 "license": 'AGPL-3',
27 "category": "Stock",
28 "depends": [
29 'base',
30 'product',
31 'stock',
32 'product_customer_code'
33 ],
34 "description": """
35Based on product_customer_code, this module loads in every stock picking
36the customer code defined in the product.
37
38Contributors
39------------
40* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
41* Alex Comba <alex.comba@agilebg.com>
42""",
43 "demo": [],
44 "data": [
45 'stock_picking_view.xml',
46 ],
47 "installable": True,
48}
049
=== added directory 'product_customer_code_picking/i18n'
=== added file 'product_customer_code_picking/i18n/it.po'
--- product_customer_code_picking/i18n/it.po 1970-01-01 00:00:00 +0000
+++ product_customer_code_picking/i18n/it.po 2014-06-22 21:01:44 +0000
@@ -0,0 +1,33 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * product_customer_code_picking
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-15 14:28+0000\n"
10"PO-Revision-Date: 2014-01-15 15:29+0100\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"Language: it\n"
18"X-Generator: Poedit 1.6.2\n"
19
20#. module: product_customer_code_picking
21#: field:stock.move,product_customer_code:0
22msgid "Product Customer Code"
23msgstr "Codice Prodotto Cliente"
24
25#. module: product_customer_code_picking
26#: model:ir.model,name:product_customer_code_picking.model_stock_move
27msgid "Stock Move"
28msgstr "Movimento di magazzino"
29
30#. module: product_customer_code_picking
31#: model:ir.model,name:product_customer_code_picking.model_stock_picking
32msgid "Picking List"
33msgstr "Documento di trasporto"
034
=== added file 'product_customer_code_picking/i18n/product_customer_code_picking.pot'
--- product_customer_code_picking/i18n/product_customer_code_picking.pot 1970-01-01 00:00:00 +0000
+++ product_customer_code_picking/i18n/product_customer_code_picking.pot 2014-06-22 21:01:44 +0000
@@ -0,0 +1,32 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * product_customer_code_picking
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-15 14:28+0000\n"
10"PO-Revision-Date: 2014-01-15 14:28+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: product_customer_code_picking
19#: field:stock.move,product_customer_code:0
20msgid "Product Customer Code"
21msgstr ""
22
23#. module: product_customer_code_picking
24#: model:ir.model,name:product_customer_code_picking.model_stock_move
25msgid "Stock Move"
26msgstr ""
27
28#. module: product_customer_code_picking
29#: model:ir.model,name:product_customer_code_picking.model_stock_picking
30msgid "Picking List"
31msgstr ""
32
033
=== added file 'product_customer_code_picking/stock_picking.py'
--- product_customer_code_picking/stock_picking.py 1970-01-01 00:00:00 +0000
+++ product_customer_code_picking/stock_picking.py 2014-06-22 21:01:44 +0000
@@ -0,0 +1,59 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
5# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import fields, orm
22
23
24class stock_move(orm.Model):
25 _inherit = 'stock.move'
26
27 def _get_product_customer_code(
28 self, cr, uid, ids, name, args, context=None
29 ):
30 res = {}
31 product_customer_code_obj = self.pool['product.customer.code']
32 for move in self.browse(cr, uid, ids, context=context):
33 res[move.id] = ''
34 partner = move.picking_id.partner_id
35 if move.picking_id.partner_id.parent_id:
36 partner = move.picking_id.partner_id.parent_id
37 product = move.product_id
38 if product and partner:
39 code_ids = product_customer_code_obj.search(cr, uid, [
40 ('product_id', '=', product.id),
41 ('partner_id', '=', partner.id),
42 ], limit=1, context=context)
43 if code_ids:
44 data = product_customer_code_obj.read(
45 cr, uid, code_ids[0],
46 ['product_code'], context=context
47 )
48 res[move.id] = (
49 'product_code' in data
50 and data['product_code']
51 or ''
52 )
53 return res
54
55 _columns = {
56 'product_customer_code': fields.function(
57 _get_product_customer_code,
58 string='Product Customer Code', type='char', size=64),
59 }
060
=== added file 'product_customer_code_picking/stock_picking_view.xml'
--- product_customer_code_picking/stock_picking_view.xml 1970-01-01 00:00:00 +0000
+++ product_customer_code_picking/stock_picking_view.xml 2014-06-22 21:01:44 +0000
@@ -0,0 +1,36 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 product customer code picking for OpenERP
4 Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>).
5 Authors, Nicola Malcontenti, nicola.malcontenti@agilebg.com
6 The licence is in the file __openerp__.py
7-->
8<openerp>
9 <data>
10
11 <record id="view_move_picking_tree" model="ir.ui.view">
12 <field name="name">stock.move.product.code.tree</field>
13 <field name="model">stock.move</field>
14 <field name="inherit_id" ref="stock.view_move_picking_tree"/>
15 <field eval="16" name="priority"/>
16 <field name="arch" type="xml">
17 <field name="product_id" position="after">
18 <field name="product_customer_code" />
19 </field>
20 </field>
21 </record>
22
23 <record id="view_move_picking_form" model="ir.ui.view">
24 <field name="name">stock.move.product.code.form</field>
25 <field name="model">stock.move</field>
26 <field name="inherit_id" ref="stock.view_move_picking_form"/>
27 <field eval="16" name="priority"/>
28 <field name="arch" type="xml">
29 <field name="product_id" position="after">
30 <field name="product_customer_code" />
31 </field>
32 </field>
33 </record>
34
35 </data>
36</openerp>

Subscribers

People subscribed via source and target branches