Merge lp:~mikel-martin/purchase-wkfl/6.1-purchase_landed_costs into lp:~purchase-core-editors/purchase-wkfl/6.1

Proposed by mikel
Status: Merged
Merged at revision: 10
Proposed branch: lp:~mikel-martin/purchase-wkfl/6.1-purchase_landed_costs
Merge into: lp:~purchase-core-editors/purchase-wkfl/6.1
Diff against target: 1922 lines (+1863/-0)
11 files modified
purchase_landed_costs/__init__.py (+29/-0)
purchase_landed_costs/__openerp__.py (+53/-0)
purchase_landed_costs/i18n/de.po (+333/-0)
purchase_landed_costs/i18n/es.po (+337/-0)
purchase_landed_costs/i18n/purchase_landed_costs.pot (+320/-0)
purchase_landed_costs/product.py (+40/-0)
purchase_landed_costs/purchase.py (+298/-0)
purchase_landed_costs/purchase_view.xml (+104/-0)
purchase_landed_costs/security/ir.model.access.csv (+3/-0)
purchase_landed_costs/stock.py (+297/-0)
purchase_landed_costs/stock_view.xml (+49/-0)
To merge this branch: bzr merge lp:~mikel-martin/purchase-wkfl/6.1-purchase_landed_costs
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Sandy Carter (http://www.savoirfairelinux.com) code review, no test Approve
Guewen Baconnier @ Camptocamp Needs Information
Review via email: mp+199587@code.launchpad.net

Description of the change

[ADD] purchase_landed_cost from c2c-rd-addons fixed

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello, what do you mean by "purchase_landed_cost from c2c-rd-addons fixed"?
Is it an extraction of the module from c2c-rd-addons, with some fixes?
My concern is that there is only 1 revision, so we can't see what is part of the extraction and what are your fixes.

review: Needs Information
Revision history for this message
mikel (mikel-martin) wrote :

Yes, that is.

The costs were not properly calculated in the stock picking if there was more than one order line. This fix has already been done in the v7 of this module.

If you have a look at the MP in c2c-rd-addons https://code.launchpad.net/~mikel-martin/c2c-rd-addons/6.1/+merge/199583 you'll see the diff, it is quite clear what the problem was.

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Lots of PEP8 issues to fix

osv.osv is depricated in 6.1, use orm.Model
functions that have context as a parameter need to start with:
    if context is None:
        context = dict()
Many browse calls should have context=context in their parameters, the same applies to other self calls which include context=None in their parameters

Code issues:
purchase_landed_costs/purchase.py:224:65: should be context=context

Minor code issues:
purchase_landed_costs/product.py:23:1: should be importing from openerp.osv
purchase_landed_costs/product.py:24:1: unused import
purchase_landed_costs/product.py:34:132: unnecessary backslash
purchase_landed_costs/product.py:41:131: unnecessary backslash
purchase_landed_costs/purchase.py:23:1: should be importing from openerp.osv
purchase_landed_costs/purchase.py:24:1: should be importing openerp.decimal_precision
purchase_landed_costs/purchase.py:25:1: unused import
purchase_landed_costs/purchase.py:229-236: could be a single statement (val = {'product_id': order_cost.product_id.id, ... }

Spelling:
purchase_landed_costs/stock.py 34:18: costss -> costs
purchase_landed_costs/stock.py 49:18: costss -> costs
purchase_landed_costs/stock.py:52:15: distrubution -> distribution
purchase_landed_costs/stock.py 65:18: costss -> costs
purchase_landed_costs/stock.py 124:18: costss -> costs
purchase_landed_costs/product.py:44:155: catgory -> category
purchase_landed_costs/purchase.py:68:18: costss -> costs
purchase_landed_costs/purchase.py:102:18: costss -> costs

review: Needs Fixing (code review, no test)
Revision history for this message
mikel (mikel-martin) wrote :

Thanks for your review.

Which tool do you use for the code review it would com in handy.

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

There isn't really a tool

pep8-python2 for pep8
pycharm for code inspection and spelling
the rest is by hand

11. By mikel <mikel@hide>

[FIX] Codign standards

12. By mikel <mikel@hide>

[FIX] Invoice unit price calculation from picking

Revision history for this message
mikel (mikel-martin) wrote :

Fixed the code issues

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

PEP8:
purchase_landed_costs/__init__.py:3:2: W291 trailing whitespace
purchase_landed_costs/__init__.py:19:75: W291 trailing whitespace

purchase_landed_costs/__openerp__.py:30:40: W291 trailing whitespace
purchase_landed_costs/__openerp__.py:42:27: E202 whitespace before ']'

purchase_landed_costs/product.py:19:13: E128 continuation line under-indented for visual indent
purchase_landed_costs/product.py:31:13: E128 continuation line under-indented for visual indent

purchase_landed_costs/purchase.py: 37 PEP8 errors
purchase_landed_costs/stock.py: 25 PEP8 errors

Code:
purchase_landed_costs/purchase.py 62:9: you have the same two lines twice
purchase_landed_costs/purchase.py 82:9: you have the same two lines twice
purchase_landed_costs/purchase.py 280:57: should be context=context
purchase_landed_costs/purchase.py 294:57: should be context=context

purchase_landed_costs/stock.py:20:21: missing context=context
purchase_landed_costs/stock.py:38:21: missing context=context
purchase_landed_costs/stock.py:40:15: distrubution -> distribution
purchase_landed_costs/stock.py:62:21: missing context=context
purchase_landed_costs/stock.py:73:21: missing context=context
purchase_landed_costs/stock.py:113:21: missing context=context
purchase_landed_costs/stock.py:128:21: missing context=context
purchase_landed_costs/stock.py 143:18: costss -> costs
purchase_landed_costs/stock.py:144:21: missing context=context
purchase_landed_costs/stock.py:159:21: missing context=context
purchase_landed_costs/stock.py:173:21: missing context=context
purchase_landed_costs/stock.py:188:21: missing context=context

review: Needs Fixing (code review, no test)
Revision history for this message
Graeme Gellatly (gdgellatly) wrote :

Hi sorry, I disagree with

> functions that have context as a parameter need to start with:
> if context is None:
> context = dict()

As per openerp coding guidelines this is not necessary if you are only passing context downstream and not accessing it anywhere in your function. Convention for some maybe, but not required and ultimately just adds unneeded LOC.

https://doc.openerp.com/6.0/contribute/15_guidelines/coding_guidelines_framework/#the-infamous-context

13. By mikel <mikel@hide>

[FIX] recalculate landed_cost in picking when landed_cost_line changes.
[FIX] unit_price_net calculation so that it takes into acount purchase_order_line discounts
[FIX] landed cost value distribution based
[FIX] Coding standard issues

Revision history for this message
mikel (mikel-martin) wrote :

Yet another try with some more fixes.

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Still about 38 PEP8 errors, run the following command to see them all.
$ find purchase_landed_costs/ -name \*.py -exec pep8-python2 --show-source --ignore E501 {} \;
or
$ pep8-python2 --show-source --ignore E501 purchase_landed_costs/purchase.py
$ pep8-python2 --show-source --ignore E501 purchase_landed_costs/stock.py

review: Needs Fixing
14. By mikel <mikel@hide>

[FIX] landed costs per line calculation when the invoice method is picking

Revision history for this message
mikel (mikel-martin) wrote :

Yet another try.

Does anyone know why eclipse doesn't complain about E121 and E127?

I've configured eclipse to use pep8 in this way http://stackoverflow.com/questions/399956/how-to-integrate-pep8-py-in-eclipse/8532188#8532188

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Your code passes my PEP8 check.

One more thing
purchase_landed_costs/stock.py:3:1: F401 'itemgetter' imported but unused

review: Approve (code review, no test)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Thanks for the contribution. I approve this MP's, but I'm also in-line with Guewen. You should have sued the extraction tools located here : https://launchpad.net/bazaar-extractor to replay the commit of this module in that branch. This way we don't lose all the commit. But well, as it is on a old 6.1 branch I think it's ok not to block this MP for that.

Note that I ported the same module and add some improvements for the 7.0 serie.

Regards,

Joël

review: Approve (code review, no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'purchase_landed_costs'
2=== added file 'purchase_landed_costs/__init__.py'
3--- purchase_landed_costs/__init__.py 1970-01-01 00:00:00 +0000
4+++ purchase_landed_costs/__init__.py 2014-01-08 21:27:15 +0000
5@@ -0,0 +1,29 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
11+# Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+
29+import product
30+import stock
31+import purchase
32+
33+
34+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
35
36=== added file 'purchase_landed_costs/__openerp__.py'
37--- purchase_landed_costs/__openerp__.py 1970-01-01 00:00:00 +0000
38+++ purchase_landed_costs/__openerp__.py 2014-01-08 21:27:15 +0000
39@@ -0,0 +1,53 @@
40+# -*- coding: utf-8 -*-
41+##############################################################################
42+#
43+# OpenERP, Open Source Management Solution
44+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
45+# Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
46+#
47+# This program is free software: you can redistribute it and/or modify
48+# it under the terms of the GNU Affero General Public License as
49+# published by the Free Software Foundation, either version 3 of the
50+# License, or (at your option) any later version.
51+#
52+# This program is distributed in the hope that it will be useful,
53+# but WITHOUT ANY WARRANTY; without even the implied warranty of
54+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55+# GNU Affero General Public License for more details.
56+#
57+# You should have received a copy of the GNU Affero General Public License
58+# along with this program. If not, see <http://www.gnu.org/licenses/>.
59+#
60+##############################################################################
61+
62+
63+{
64+ 'name': 'Landed Costs',
65+ 'version': '0.8',
66+ 'category': 'Warehouse Management',
67+ 'description': """
68+ This module add the possibility to include landed costs in the average
69+ price computation.
70+ The landed costs can be defined for:
71+ * purchase orders
72+ * purchase order lines
73+ * pickings
74+ * picking lines (stock moves)
75+ costs defined for purchase orders and pickings will be distributed
76+ according to the distribution type
77+ defined in landed cost category
78+ * value - example custom fees
79+ * quantity - example freight
80+ """,
81+ 'author': 'Camptocamp',
82+ 'contributors': 'Mikel Martin <mikel@zhenit.com>',
83+ 'depends': ['purchase'],
84+ 'update_xml': ['security/ir.model.access.csv',
85+ 'purchase_view.xml',
86+ 'stock_view.xml',
87+ ],
88+ 'demo_xml': [],
89+ 'installable': True,
90+ 'active': False,
91+}
92+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
93
94=== added directory 'purchase_landed_costs/i18n'
95=== added file 'purchase_landed_costs/i18n/de.po'
96--- purchase_landed_costs/i18n/de.po 1970-01-01 00:00:00 +0000
97+++ purchase_landed_costs/i18n/de.po 2014-01-08 21:27:15 +0000
98@@ -0,0 +1,333 @@
99+# Translation of OpenERP Server.
100+# This file contains the translation of the following modules:
101+# * purchase_landed_costs
102+#
103+msgid ""
104+msgstr ""
105+"Project-Id-Version: OpenERP Server 6.1rc1\n"
106+"Report-Msgid-Bugs-To: \n"
107+"POT-Creation-Date: 2012-02-12 08:57+0000\n"
108+"PO-Revision-Date: 2012-02-13 09:37+0000\n"
109+"Last-Translator: Ferdinand @ Camptocamp <Unknown>\n"
110+"Language-Team: \n"
111+"MIME-Version: 1.0\n"
112+"Content-Type: text/plain; charset=UTF-8\n"
113+"Content-Transfer-Encoding: 8bit\n"
114+"X-Launchpad-Export-Date: 2013-08-18 04:56+0000\n"
115+"X-Generator: Launchpad (build 16723)\n"
116+
117+#. module: purchase_landed_costs
118+#: field:product.category,landed_cost:0 field:product.template,landed_cost:0
119+msgid "Calculate Landed Costs"
120+msgstr "Berechnete Einstandskosten"
121+
122+#. module: purchase_landed_costs
123+#: sql_constraint:purchase.order:0
124+msgid "Order Reference must be unique per Company!"
125+msgstr "Bestellbezug muss je Unternehmen eindeutig sein!"
126+
127+#. module: purchase_landed_costs
128+#: model:ir.model,name:purchase_landed_costs.model_purchase_order_line
129+#: field:landed.cost.position,purchase_order_line_id:0
130+msgid "Purchase Order Line"
131+msgstr "Einkaufspositionen"
132+
133+#. module: purchase_landed_costs
134+#: field:landed.cost.position,move_line_id:0
135+msgid "Picking Line"
136+msgstr "Lieferscheinzeile"
137+
138+#. module: purchase_landed_costs
139+#: field:stock.move,sub_total:0
140+msgid "Line Sub Total"
141+msgstr "Zeile Teilsumme"
142+
143+#. module: purchase_landed_costs
144+#: help:landed.cost.position,partner_id:0
145+msgid "The supplier of this cost component ."
146+msgstr "Der Lieferant dieser Kostenkomponente"
147+
148+#. module: purchase_landed_costs
149+#: constraint:product.template:0
150+msgid ""
151+"Error: The default UOM and the purchase UOM must be in the same category."
152+msgstr ""
153+"Fehler: Die Standard Mengeneinheit (ME) sowie die Mengeneinheit (ME) bei der "
154+"Beschaffung muss in derselben Kategorie sein."
155+
156+#. module: purchase_landed_costs
157+#: constraint:stock.move:0
158+msgid "You must assign a production lot for this product"
159+msgstr "Sie müssen zwingend eine Losnummer für dieses Produkt angeben"
160+
161+#. module: purchase_landed_costs
162+#: help:landed.cost.position,amount_currency:0
163+msgid "The amount expressed in an optional other currency."
164+msgstr "optionaler Betrag in anderer Währung"
165+
166+#. module: purchase_landed_costs
167+#: help:product.template,landed_cost_type:0
168+msgid ""
169+"Used if this product is landed costs: If landed costs are defined for "
170+"purchase orders or pickings, this indicates how the costs are distributed to "
171+"the lines"
172+msgstr ""
173+"Aktivieren, wenn dieses Produkt als Bestellnebenkosten für die "
174+"Durschnittspreisberechung verfügbar sein soll. Wenn die Nebenkosten für den "
175+"Lieferschein definiert sind, gibt dies an, welcher Schüssel (Mengen, Wert) "
176+"für die Verteilung verwendet werden soll."
177+
178+#. module: purchase_landed_costs
179+#: selection:landed.cost.position,price_type:0
180+msgid "Per Unit"
181+msgstr "Je Einheit"
182+
183+#. module: purchase_landed_costs
184+#: model:ir.model,name:purchase_landed_costs.model_stock_picking
185+msgid "Picking List"
186+msgstr "Lieferschein"
187+
188+#. module: purchase_landed_costs
189+#: model:ir.model,name:purchase_landed_costs.model_landed_cost_position
190+msgid "landed.cost.position"
191+msgstr "landed.cost.position"
192+
193+#. module: purchase_landed_costs
194+#: field:stock.move,landing_costs_picking:0
195+msgid "Landing Costs from Picking"
196+msgstr "Einstandsnebenkosten vom Lieferschien"
197+
198+#. module: purchase_landed_costs
199+#: selection:landed.cost.position,price_type:0
200+msgid "Absolute Value"
201+msgstr "Absoluter Wert"
202+
203+#. module: purchase_landed_costs
204+#: help:product.template,landed_cost:0
205+msgid ""
206+"Checck this if you want to use landed cost calculation for average price for "
207+"this product"
208+msgstr ""
209+
210+#. module: purchase_landed_costs
211+#: field:purchase.order,landed_cost_line_ids:0
212+#: field:purchase.order.line,landed_costs:0 field:stock.move,landed_cost:0
213+msgid "Landed Costs"
214+msgstr "Einstandskosten"
215+
216+#. module: purchase_landed_costs
217+#: constraint:stock.move:0
218+msgid "You try to assign a lot which is not from the same product"
219+msgstr ""
220+"Sie versuchen eine Losnummer ohne Bezug zu diesem Produkt zuzuweisen."
221+
222+#. module: purchase_landed_costs
223+#: constraint:stock.move:0
224+msgid "You can not move products from or to a location of the type view."
225+msgstr "Sie können keine Buchungen auf Sichten machen"
226+
227+#. module: purchase_landed_costs
228+#: view:landed.cost.position:0 view:purchase.order:0
229+#: view:purchase.order.line:0 field:purchase.order.line,landing_costs:0
230+#: view:stock.picking:0
231+msgid "Landing Costs"
232+msgstr "Einstandsnebenkosten"
233+
234+#. module: purchase_landed_costs
235+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_picking_line
236+msgid "stock.partial.picking.line"
237+msgstr "pstock.partial.picking.line"
238+
239+#. module: purchase_landed_costs
240+#: field:purchase.order,quantity_total:0 field:stock.picking,quantity_total:0
241+msgid "Total Quantity"
242+msgstr "Gesamtmenge"
243+
244+#. module: purchase_landed_costs
245+#: help:landed.cost.position,currency_id:0
246+msgid "Optional other currency."
247+msgstr "Optional andere Währung"
248+
249+#. module: purchase_landed_costs
250+#: field:purchase.order,landed_cost_base_value:0
251+#: field:stock.picking,landed_cost_base_value:0
252+msgid "Landed Costs Base Value"
253+msgstr "Einstandskosten Basis Wert"
254+
255+#. module: purchase_landed_costs
256+#: field:landed.cost.position,picking_id:0
257+msgid "Picking"
258+msgstr "Lieferschein"
259+
260+#. module: purchase_landed_costs
261+#: field:stock.picking,total_amount:0
262+msgid "Total Product Price"
263+msgstr "Gesamter Produktpreis"
264+
265+#. module: purchase_landed_costs
266+#: field:stock.move,price_unit_net:0
267+msgid "Purchase Price"
268+msgstr "Kaufpreis"
269+
270+#. module: purchase_landed_costs
271+#: field:purchase.order,landing_cost_lines:0
272+#: field:stock.picking,landing_cost_lines:0
273+msgid "Landing Cost Lines"
274+msgstr "Einstandsnebenkostenzeilen"
275+
276+#. module: purchase_landed_costs
277+#: constraint:stock.move:0
278+msgid ""
279+"Error: Negative quantities for location and/or lots are not allowed for this "
280+"product or product category"
281+msgstr "Fehler: negative Mengen sind für diesen Lagerort / Los nicht erlaubt"
282+
283+#. module: purchase_landed_costs
284+#: selection:product.template,landed_cost_type:0
285+msgid "None"
286+msgstr "Keine"
287+
288+#. module: purchase_landed_costs
289+#: field:product.template,landed_cost_type:0
290+msgid "Distribution Type"
291+msgstr "Verteilungsart"
292+
293+#. module: purchase_landed_costs
294+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_move
295+msgid "Partial Move Processing Wizard"
296+msgstr "Assistent für Teillieferungen"
297+
298+#. module: purchase_landed_costs
299+#: view:stock.picking:0
300+msgid "Notes"
301+msgstr "Notizen"
302+
303+#. module: purchase_landed_costs
304+#: field:landed.cost.position,currency_id:0
305+msgid "Secondary Currency"
306+msgstr "Alternative Währung"
307+
308+#. module: purchase_landed_costs
309+#: selection:product.template,landed_cost_type:0
310+msgid "Value"
311+msgstr "Betrag"
312+
313+#. module: purchase_landed_costs
314+#: model:ir.model,name:purchase_landed_costs.model_purchase_order
315+#: field:landed.cost.position,purchase_order_id:0
316+msgid "Purchase Order"
317+msgstr "Einkaufsauftrag"
318+
319+#. module: purchase_landed_costs
320+#: field:purchase.order.line,landed_cost_line_ids:0
321+#: field:stock.move,landed_cost_line_ids:0
322+#: field:stock.picking,landed_cost_line_ids:0
323+msgid "Landed Costs Positions"
324+msgstr "Nebenkostenpositionen"
325+
326+#. module: purchase_landed_costs
327+#: field:purchase.order.line,landing_costs_order:0
328+msgid "Landing Costs from Order"
329+msgstr "Nebenkosten vom Einkaufsauftrag"
330+
331+#. module: purchase_landed_costs
332+#: field:landed.cost.position,amount:0
333+msgid "Amount"
334+msgstr "Betrag"
335+
336+#. module: purchase_landed_costs
337+#: model:ir.model,name:purchase_landed_costs.model_product_category
338+msgid "Product Category"
339+msgstr "Produktkategorie"
340+
341+#. module: purchase_landed_costs
342+#: sql_constraint:stock.picking:0
343+msgid "Reference must be unique per Company!"
344+msgstr "Referenz muss je Unternehmen eindeutig sein"
345+
346+#. module: purchase_landed_costs
347+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_picking
348+msgid "Partial Picking Processing Wizard"
349+msgstr "Teillieferungsassistent"
350+
351+#. module: purchase_landed_costs
352+#: help:landed.cost.position,price_type:0
353+msgid ""
354+"Defines if the amount is to be calculated for each quantity or an absolute "
355+"value"
356+msgstr ""
357+"Definiert, ob der Wert je Mengeneinheit oder absolut gerechnet werden muss"
358+
359+#. module: purchase_landed_costs
360+#: selection:product.template,landed_cost_type:0
361+msgid "Quantity"
362+msgstr "Menge"
363+
364+#. module: purchase_landed_costs
365+#: field:landed.cost.position,product_id:0
366+msgid "Landed Cost Name"
367+msgstr "Nebenkosten Bezeichnung"
368+
369+#. module: purchase_landed_costs
370+#: field:purchase.order,landed_cost_base_quantity:0
371+#: field:stock.picking,landed_cost_base_quantity:0
372+msgid "Landed Costs Base Quantity"
373+msgstr "Nebenkosten - Megnenbasis"
374+
375+#. module: purchase_landed_costs
376+#: help:product.category,landed_cost:0
377+msgid ""
378+"Checck this if you want to use landed cost calculation for average price for "
379+"this catgory"
380+msgstr ""
381+"Aktivieren, wenn für diese Produktkategorie Einstandsnebenkosten berechnet "
382+"werden sollen"
383+
384+#. module: purchase_landed_costs
385+#: model:ir.model,name:purchase_landed_costs.model_product_template
386+msgid "Product Template"
387+msgstr "Produktvorlage"
388+
389+#. module: purchase_landed_costs
390+#: model:ir.model,name:purchase_landed_costs.model_stock_move
391+msgid "Stock Move"
392+msgstr "Lagerbuchung"
393+
394+#. module: purchase_landed_costs
395+#: constraint:product.category:0
396+msgid "Error ! You cannot create recursive categories."
397+msgstr "Fehler ! Sie dürfen keine rekurisven Kategorien anlegen."
398+
399+#. module: purchase_landed_costs
400+#: field:landed.cost.position,amount_currency:0
401+msgid "Amount Currency"
402+msgstr "Währungsbetrag"
403+
404+#. module: purchase_landed_costs
405+#: field:stock.move,landing_costs:0
406+msgid "Line Landing Costs"
407+msgstr "Nebenkosten Zeilen"
408+
409+#. module: purchase_landed_costs
410+#: help:landed.cost.position,amount:0
411+msgid ""
412+"Landed cost for stock valuation. It will be added to the price of the "
413+"supplier price."
414+msgstr ""
415+"Einstandskosten für die Produktbewertung. Diese werden zu dem Produktpreis "
416+"hinzugerechnet."
417+
418+#. module: purchase_landed_costs
419+#: field:landed.cost.position,partner_id:0
420+msgid "Partner"
421+msgstr "Partner"
422+
423+#. module: purchase_landed_costs
424+#: field:purchase.order,landed_cost:0 field:stock.picking,landed_cost:0
425+msgid "Landed Costs Total Untaxed"
426+msgstr "EInstandspreise ohne Umsatzsteuer"
427+
428+#. module: purchase_landed_costs
429+#: field:landed.cost.position,price_type:0
430+msgid "Amount Type"
431+msgstr "Berechnungsart"
432
433=== added file 'purchase_landed_costs/i18n/es.po'
434--- purchase_landed_costs/i18n/es.po 1970-01-01 00:00:00 +0000
435+++ purchase_landed_costs/i18n/es.po 2014-01-08 21:27:15 +0000
436@@ -0,0 +1,337 @@
437+# Spanish translation for c2c-rd-addons
438+# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013
439+# This file is distributed under the same license as the c2c-rd-addons package.
440+# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
441+#
442+msgid ""
443+msgstr ""
444+"Project-Id-Version: c2c-rd-addons\n"
445+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
446+"POT-Creation-Date: 2012-02-12 08:57+0000\n"
447+"PO-Revision-Date: 2013-12-30 01:40+0100\n"
448+"Last-Translator: Mikel Martin <mikel@ZhenIT.com>\n"
449+"Language-Team: Spanish <es@li.org>\n"
450+"MIME-Version: 1.0\n"
451+"Content-Type: text/plain; charset=UTF-8\n"
452+"Content-Transfer-Encoding: 8bit\n"
453+"X-Launchpad-Export-Date: 2013-12-16 05:26+0000\n"
454+"X-Generator: Poedit 1.5.4\n"
455+
456+#. module: purchase_landed_costs
457+#: field:product.category,landed_cost:0 field:product.template,landed_cost:0
458+msgid "Calculate Landed Costs"
459+msgstr "Costos de importación"
460+
461+#. module: purchase_landed_costs
462+#: sql_constraint:purchase.order:0
463+msgid "Order Reference must be unique per Company!"
464+msgstr "Orden de referencia debe ser única por Empresa!"
465+
466+#. module: purchase_landed_costs
467+#: model:ir.model,name:purchase_landed_costs.model_purchase_order_line
468+#: field:landed.cost.position,purchase_order_line_id:0
469+msgid "Purchase Order Line"
470+msgstr "Líneas de pedido de compra"
471+
472+#. module: purchase_landed_costs
473+#: field:landed.cost.position,move_line_id:0
474+msgid "Picking Line"
475+msgstr "Línea de movimiento"
476+
477+#. module: purchase_landed_costs
478+#: field:stock.move,sub_total:0
479+msgid "Line Sub Total"
480+msgstr "Subtotal de línea"
481+
482+#. module: purchase_landed_costs
483+#: help:landed.cost.position,partner_id:0
484+msgid "The supplier of this cost component ."
485+msgstr "Proveedor de componente de costos"
486+
487+#. module: purchase_landed_costs
488+#: constraint:product.template:0
489+msgid ""
490+"Error: The default UOM and the purchase UOM must be in the same category."
491+msgstr ""
492+"Error: La UdM por defecto y la UdM de compra deben estar en la misma "
493+"categoría."
494+
495+#. module: purchase_landed_costs
496+#: constraint:stock.move:0
497+msgid "You must assign a production lot for this product"
498+msgstr "Debe asignar un lote de producción para este producto"
499+
500+#. module: purchase_landed_costs
501+#: help:landed.cost.position,amount_currency:0
502+msgid "The amount expressed in an optional other currency."
503+msgstr "Importe expresado en otra divisa. Opcional."
504+
505+#. module: purchase_landed_costs
506+#: help:product.template,landed_cost_type:0
507+msgid ""
508+"Used if this product is landed costs: If landed costs are defined for "
509+"purchase orders or pickings, this indicates how the costs are distributed to "
510+"the lines"
511+msgstr ""
512+"Usado si el producto es un costo de importación. Indica como se distribuye "
513+"el costo de importación en la orden de compra o de movimiento interno."
514+
515+#. module: purchase_landed_costs
516+#: selection:landed.cost.position,price_type:0
517+msgid "Per Unit"
518+msgstr "Unidad"
519+
520+#. module: purchase_landed_costs
521+#: model:ir.model,name:purchase_landed_costs.model_stock_picking
522+msgid "Picking List"
523+msgstr "Lista de Envios"
524+
525+#. module: purchase_landed_costs
526+#: model:ir.model,name:purchase_landed_costs.model_landed_cost_position
527+msgid "landed.cost.position"
528+msgstr "landed.cost.position"
529+
530+#. module: purchase_landed_costs
531+#: field:stock.move,landing_costs_picking:0
532+msgid "Landing Costs from Picking"
533+msgstr "Costos de entrega de Envios"
534+
535+#. module: purchase_landed_costs
536+#: selection:landed.cost.position,price_type:0
537+msgid "Absolute Value"
538+msgstr "Valor absoluto"
539+
540+#. module: purchase_landed_costs
541+#: help:product.template,landed_cost:0
542+msgid ""
543+"Checck this if you want to use landed cost calculation for average price for "
544+"this product"
545+msgstr ""
546+"Marcar para definir el precio promedio del producto/servicio en el cálculo "
547+"del costo de importación."
548+
549+#. module: purchase_landed_costs
550+#: field:purchase.order,landed_cost_line_ids:0
551+#: field:purchase.order.line,landed_costs:0 field:stock.move,landed_cost:0
552+msgid "Landed Costs"
553+msgstr "Costos de importación"
554+
555+#. module: purchase_landed_costs
556+#: constraint:stock.move:0
557+msgid "You try to assign a lot which is not from the same product"
558+msgstr "Está intentando asignar un lote que no es del mismo producto"
559+
560+#. module: purchase_landed_costs
561+#: constraint:stock.move:0
562+msgid "You can not move products from or to a location of the type view."
563+msgstr "No puede mover producto desde o hacia una localización de tipo vista."
564+
565+#. module: purchase_landed_costs
566+#: view:landed.cost.position:0 view:purchase.order:0
567+#: view:purchase.order.line:0 field:purchase.order.line,landing_costs:0
568+#: view:stock.picking:0
569+msgid "Landing Costs"
570+msgstr "Costos de importación"
571+
572+#. module: purchase_landed_costs
573+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_picking_line
574+msgid "stock.partial.picking.line"
575+msgstr "Línea de entrega parcial"
576+
577+#. module: purchase_landed_costs
578+#: field:purchase.order,quantity_total:0 field:stock.picking,quantity_total:0
579+msgid "Total Quantity"
580+msgstr "Cantidad total"
581+
582+#. module: purchase_landed_costs
583+#: help:landed.cost.position,currency_id:0
584+msgid "Optional other currency."
585+msgstr "Otra divisa opcional"
586+
587+#. module: purchase_landed_costs
588+#: field:purchase.order,landed_cost_base_value:0
589+#: field:stock.picking,landed_cost_base_value:0
590+msgid "Landed Costs Base Value"
591+msgstr "Valor base de costo de Importación"
592+
593+#. module: purchase_landed_costs
594+#: field:landed.cost.position,picking_id:0
595+msgid "Picking"
596+msgstr "Albarán"
597+
598+#. module: purchase_landed_costs
599+#: field:stock.picking,total_amount:0
600+msgid "Total Product Price"
601+msgstr "Precio total de productos"
602+
603+#. module: purchase_landed_costs
604+#: field:stock.move,price_unit_net:0
605+msgid "Purchase Price"
606+msgstr "Precio de compra"
607+
608+#. module: purchase_landed_costs
609+#: field:purchase.order,landing_cost_lines:0
610+#: field:stock.picking,landing_cost_lines:0
611+msgid "Landing Cost Lines"
612+msgstr "Lineas de costos de importación"
613+
614+#. module: purchase_landed_costs
615+#: constraint:stock.move:0
616+msgid ""
617+"Error: Negative quantities for location and/or lots are not allowed for this "
618+"product or product category"
619+msgstr ""
620+"Error: No se permiten cantidades negativas para la ubicación y/o lotes no "
621+"están permitidas para este producto o categoría de producto."
622+
623+#. module: purchase_landed_costs
624+#: selection:product.template,landed_cost_type:0
625+msgid "None"
626+msgstr "Ninguno"
627+
628+#. module: purchase_landed_costs
629+#: field:product.template,landed_cost_type:0
630+msgid "Distribution Type"
631+msgstr "Tipo de distribución"
632+
633+#. module: purchase_landed_costs
634+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_move
635+msgid "Partial Move Processing Wizard"
636+msgstr "Asistente para procesado de movimientos parciales"
637+
638+#. module: purchase_landed_costs
639+#: view:stock.picking:0
640+msgid "Notes"
641+msgstr "Notas:"
642+
643+#. module: purchase_landed_costs
644+#: field:landed.cost.position,currency_id:0
645+msgid "Secondary Currency"
646+msgstr "Divisa secundaria"
647+
648+#. module: purchase_landed_costs
649+#: selection:product.template,landed_cost_type:0
650+msgid "Value"
651+msgstr "Valor"
652+
653+#. module: purchase_landed_costs
654+#: model:ir.model,name:purchase_landed_costs.model_purchase_order
655+#: field:landed.cost.position,purchase_order_id:0
656+msgid "Purchase Order"
657+msgstr "Orden de Compra"
658+
659+#. module: purchase_landed_costs
660+#: field:purchase.order.line,landed_cost_line_ids:0
661+#: field:stock.move,landed_cost_line_ids:0
662+#: field:stock.picking,landed_cost_line_ids:0
663+msgid "Landed Costs Positions"
664+msgstr "Posicion de costos de importación"
665+
666+#. module: purchase_landed_costs
667+#: field:purchase.order.line,landing_costs_order:0
668+msgid "Landing Costs from Order"
669+msgstr "Costos de importación desde la orden"
670+
671+#. module: purchase_landed_costs
672+#: field:landed.cost.position,amount:0
673+msgid "Amount"
674+msgstr "Monto"
675+
676+#. module: purchase_landed_costs
677+#: model:ir.model,name:purchase_landed_costs.model_product_category
678+msgid "Product Category"
679+msgstr "Categoría de producto"
680+
681+#. module: purchase_landed_costs
682+#: sql_constraint:stock.picking:0
683+msgid "Reference must be unique per Company!"
684+msgstr "Referencia debe ser única por compañía!"
685+
686+#. module: purchase_landed_costs
687+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_picking
688+msgid "Partial Picking Processing Wizard"
689+msgstr "Asistente Procesamiento Parcial de un Albaran"
690+
691+#. module: purchase_landed_costs
692+#: help:landed.cost.position,price_type:0
693+msgid ""
694+"Defines if the amount is to be calculated for each quantity or an absolute "
695+"value"
696+msgstr ""
697+"Defines if the amount is to be calculated for each quantity or an absolute "
698+"value\r\n"
699+"Define si el monto debe calcularse para cada cantidad o un valor absoluto"
700+
701+#. module: purchase_landed_costs
702+#: selection:product.template,landed_cost_type:0
703+msgid "Quantity"
704+msgstr "Cantidad"
705+
706+#. module: purchase_landed_costs
707+#: field:landed.cost.position,product_id:0
708+msgid "Landed Cost Name"
709+msgstr "Nombre del costo de importación"
710+
711+#. module: purchase_landed_costs
712+#: field:purchase.order,landed_cost_base_quantity:0
713+#: field:stock.picking,landed_cost_base_quantity:0
714+msgid "Landed Costs Base Quantity"
715+msgstr "Cantidad básica par el costo de importación"
716+
717+#. module: purchase_landed_costs
718+#: help:product.category,landed_cost:0
719+msgid ""
720+"Checck this if you want to use landed cost calculation for average price for "
721+"this catgory"
722+msgstr ""
723+"Marcar para calcular el costo de importación por precio promedio para la "
724+"categoría"
725+
726+#. module: purchase_landed_costs
727+#: model:ir.model,name:purchase_landed_costs.model_product_template
728+msgid "Product Template"
729+msgstr "Plantilla de producto"
730+
731+#. module: purchase_landed_costs
732+#: model:ir.model,name:purchase_landed_costs.model_stock_move
733+msgid "Stock Move"
734+msgstr "Movimiento stock"
735+
736+#. module: purchase_landed_costs
737+#: constraint:product.category:0
738+msgid "Error ! You cannot create recursive categories."
739+msgstr "¡Error! No puede crear categorías recursivas"
740+
741+#. module: purchase_landed_costs
742+#: field:landed.cost.position,amount_currency:0
743+msgid "Amount Currency"
744+msgstr "Importe divisa"
745+
746+#. module: purchase_landed_costs
747+#: field:stock.move,landing_costs:0
748+msgid "Line Landing Costs"
749+msgstr "Línea de costos de importación"
750+
751+#. module: purchase_landed_costs
752+#: help:landed.cost.position,amount:0
753+msgid ""
754+"Landed cost for stock valuation. It will be added to the price of the "
755+"supplier price."
756+msgstr ""
757+"Costos de importación para stock valorado. Será agregado al precio del "
758+"proveedor."
759+
760+#. module: purchase_landed_costs
761+#: field:landed.cost.position,partner_id:0
762+msgid "Partner"
763+msgstr "Partner"
764+
765+#. module: purchase_landed_costs
766+#: field:purchase.order,landed_cost:0 field:stock.picking,landed_cost:0
767+msgid "Landed Costs Total Untaxed"
768+msgstr "Costos de importación sin impuestos"
769+
770+#. module: purchase_landed_costs
771+#: field:landed.cost.position,price_type:0
772+msgid "Amount Type"
773+msgstr "Tipo de importe"
774
775=== added file 'purchase_landed_costs/i18n/purchase_landed_costs.pot'
776--- purchase_landed_costs/i18n/purchase_landed_costs.pot 1970-01-01 00:00:00 +0000
777+++ purchase_landed_costs/i18n/purchase_landed_costs.pot 2014-01-08 21:27:15 +0000
778@@ -0,0 +1,320 @@
779+# Translation of OpenERP Server.
780+# This file contains the translation of the following modules:
781+# * purchase_landed_costs
782+#
783+msgid ""
784+msgstr ""
785+"Project-Id-Version: OpenERP Server 6.1rc1\n"
786+"Report-Msgid-Bugs-To: \n"
787+"POT-Creation-Date: 2012-02-12 08:57+0000\n"
788+"PO-Revision-Date: 2012-02-12 08:57+0000\n"
789+"Last-Translator: <>\n"
790+"Language-Team: \n"
791+"MIME-Version: 1.0\n"
792+"Content-Type: text/plain; charset=UTF-8\n"
793+"Content-Transfer-Encoding: \n"
794+"Plural-Forms: \n"
795+
796+#. module: purchase_landed_costs
797+#: field:product.category,landed_cost:0 field:product.template,landed_cost:0
798+msgid "Calculate Landed Costs"
799+msgstr ""
800+
801+#. module: purchase_landed_costs
802+#: sql_constraint:purchase.order:0
803+msgid "Order Reference must be unique per Company!"
804+msgstr ""
805+
806+#. module: purchase_landed_costs
807+#: model:ir.model,name:purchase_landed_costs.model_purchase_order_line
808+#: field:landed.cost.position,purchase_order_line_id:0
809+msgid "Purchase Order Line"
810+msgstr ""
811+
812+#. module: purchase_landed_costs
813+#: field:landed.cost.position,move_line_id:0
814+msgid "Picking Line"
815+msgstr ""
816+
817+#. module: purchase_landed_costs
818+#: field:stock.move,sub_total:0
819+msgid "Line Sub Total"
820+msgstr ""
821+
822+#. module: purchase_landed_costs
823+#: help:landed.cost.position,partner_id:0
824+msgid "The supplier of this cost component ."
825+msgstr ""
826+
827+#. module: purchase_landed_costs
828+#: constraint:product.template:0
829+msgid ""
830+"Error: The default UOM and the purchase UOM must be in the same category."
831+msgstr ""
832+
833+#. module: purchase_landed_costs
834+#: constraint:stock.move:0
835+msgid "You must assign a production lot for this product"
836+msgstr ""
837+
838+#. module: purchase_landed_costs
839+#: help:landed.cost.position,amount_currency:0
840+msgid "The amount expressed in an optional other currency."
841+msgstr ""
842+
843+#. module: purchase_landed_costs
844+#: help:product.template,landed_cost_type:0
845+msgid ""
846+"Used if this product is landed costs: If landed costs are defined for "
847+"purchase orders or pickings, this indicates how the costs are distributed to "
848+"the lines"
849+msgstr ""
850+
851+#. module: purchase_landed_costs
852+#: selection:landed.cost.position,price_type:0
853+msgid "Per Unit"
854+msgstr ""
855+
856+#. module: purchase_landed_costs
857+#: model:ir.model,name:purchase_landed_costs.model_stock_picking
858+msgid "Picking List"
859+msgstr ""
860+
861+#. module: purchase_landed_costs
862+#: model:ir.model,name:purchase_landed_costs.model_landed_cost_position
863+msgid "landed.cost.position"
864+msgstr ""
865+
866+#. module: purchase_landed_costs
867+#: field:stock.move,landing_costs_picking:0
868+msgid "Landing Costs from Picking"
869+msgstr ""
870+
871+#. module: purchase_landed_costs
872+#: selection:landed.cost.position,price_type:0
873+msgid "Absolute Value"
874+msgstr ""
875+
876+#. module: purchase_landed_costs
877+#: help:product.template,landed_cost:0
878+msgid ""
879+"Checck this if you want to use landed cost calculation for average price for "
880+"this product"
881+msgstr ""
882+
883+#. module: purchase_landed_costs
884+#: field:purchase.order,landed_cost_line_ids:0
885+#: field:purchase.order.line,landed_costs:0 field:stock.move,landed_cost:0
886+msgid "Landed Costs"
887+msgstr ""
888+
889+#. module: purchase_landed_costs
890+#: constraint:stock.move:0
891+msgid "You try to assign a lot which is not from the same product"
892+msgstr ""
893+
894+#. module: purchase_landed_costs
895+#: constraint:stock.move:0
896+msgid "You can not move products from or to a location of the type view."
897+msgstr ""
898+
899+#. module: purchase_landed_costs
900+#: view:landed.cost.position:0 view:purchase.order:0
901+#: view:purchase.order.line:0 field:purchase.order.line,landing_costs:0
902+#: view:stock.picking:0
903+msgid "Landing Costs"
904+msgstr ""
905+
906+#. module: purchase_landed_costs
907+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_picking_line
908+msgid "stock.partial.picking.line"
909+msgstr ""
910+
911+#. module: purchase_landed_costs
912+#: field:purchase.order,quantity_total:0 field:stock.picking,quantity_total:0
913+msgid "Total Quantity"
914+msgstr ""
915+
916+#. module: purchase_landed_costs
917+#: help:landed.cost.position,currency_id:0
918+msgid "Optional other currency."
919+msgstr ""
920+
921+#. module: purchase_landed_costs
922+#: field:purchase.order,landed_cost_base_value:0
923+#: field:stock.picking,landed_cost_base_value:0
924+msgid "Landed Costs Base Value"
925+msgstr ""
926+
927+#. module: purchase_landed_costs
928+#: field:landed.cost.position,picking_id:0
929+msgid "Picking"
930+msgstr ""
931+
932+#. module: purchase_landed_costs
933+#: field:stock.picking,total_amount:0
934+msgid "Total Product Price"
935+msgstr ""
936+
937+#. module: purchase_landed_costs
938+#: field:stock.move,price_unit_net:0
939+msgid "Purchase Price"
940+msgstr ""
941+
942+#. module: purchase_landed_costs
943+#: field:purchase.order,landing_cost_lines:0
944+#: field:stock.picking,landing_cost_lines:0
945+msgid "Landing Cost Lines"
946+msgstr ""
947+
948+#. module: purchase_landed_costs
949+#: constraint:stock.move:0
950+msgid ""
951+"Error: Negative quantities for location and/or lots are not allowed for this "
952+"product or product category"
953+msgstr ""
954+
955+#. module: purchase_landed_costs
956+#: selection:product.template,landed_cost_type:0
957+msgid "None"
958+msgstr ""
959+
960+#. module: purchase_landed_costs
961+#: field:product.template,landed_cost_type:0
962+msgid "Distribution Type"
963+msgstr ""
964+
965+#. module: purchase_landed_costs
966+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_move
967+msgid "Partial Move Processing Wizard"
968+msgstr ""
969+
970+#. module: purchase_landed_costs
971+#: view:stock.picking:0
972+msgid "Notes"
973+msgstr ""
974+
975+#. module: purchase_landed_costs
976+#: field:landed.cost.position,currency_id:0
977+msgid "Secondary Currency"
978+msgstr ""
979+
980+#. module: purchase_landed_costs
981+#: selection:product.template,landed_cost_type:0
982+msgid "Value"
983+msgstr ""
984+
985+#. module: purchase_landed_costs
986+#: model:ir.model,name:purchase_landed_costs.model_purchase_order
987+#: field:landed.cost.position,purchase_order_id:0
988+msgid "Purchase Order"
989+msgstr ""
990+
991+#. module: purchase_landed_costs
992+#: field:purchase.order.line,landed_cost_line_ids:0
993+#: field:stock.move,landed_cost_line_ids:0
994+#: field:stock.picking,landed_cost_line_ids:0
995+msgid "Landed Costs Positions"
996+msgstr ""
997+
998+#. module: purchase_landed_costs
999+#: field:purchase.order.line,landing_costs_order:0
1000+msgid "Landing Costs from Order"
1001+msgstr ""
1002+
1003+#. module: purchase_landed_costs
1004+#: field:landed.cost.position,amount:0
1005+msgid "Amount"
1006+msgstr ""
1007+
1008+#. module: purchase_landed_costs
1009+#: model:ir.model,name:purchase_landed_costs.model_product_category
1010+msgid "Product Category"
1011+msgstr ""
1012+
1013+#. module: purchase_landed_costs
1014+#: sql_constraint:stock.picking:0
1015+msgid "Reference must be unique per Company!"
1016+msgstr ""
1017+
1018+#. module: purchase_landed_costs
1019+#: model:ir.model,name:purchase_landed_costs.model_stock_partial_picking
1020+msgid "Partial Picking Processing Wizard"
1021+msgstr ""
1022+
1023+#. module: purchase_landed_costs
1024+#: help:landed.cost.position,price_type:0
1025+msgid ""
1026+"Defines if the amount is to be calculated for each quantity or an absolute "
1027+"value"
1028+msgstr ""
1029+
1030+#. module: purchase_landed_costs
1031+#: selection:product.template,landed_cost_type:0
1032+msgid "Quantity"
1033+msgstr ""
1034+
1035+#. module: purchase_landed_costs
1036+#: field:landed.cost.position,product_id:0
1037+msgid "Landed Cost Name"
1038+msgstr ""
1039+
1040+#. module: purchase_landed_costs
1041+#: field:purchase.order,landed_cost_base_quantity:0
1042+#: field:stock.picking,landed_cost_base_quantity:0
1043+msgid "Landed Costs Base Quantity"
1044+msgstr ""
1045+
1046+#. module: purchase_landed_costs
1047+#: help:product.category,landed_cost:0
1048+msgid ""
1049+"Checck this if you want to use landed cost calculation for average price for "
1050+"this catgory"
1051+msgstr ""
1052+
1053+#. module: purchase_landed_costs
1054+#: model:ir.model,name:purchase_landed_costs.model_product_template
1055+msgid "Product Template"
1056+msgstr ""
1057+
1058+#. module: purchase_landed_costs
1059+#: model:ir.model,name:purchase_landed_costs.model_stock_move
1060+msgid "Stock Move"
1061+msgstr ""
1062+
1063+#. module: purchase_landed_costs
1064+#: constraint:product.category:0
1065+msgid "Error ! You cannot create recursive categories."
1066+msgstr ""
1067+
1068+#. module: purchase_landed_costs
1069+#: field:landed.cost.position,amount_currency:0
1070+msgid "Amount Currency"
1071+msgstr ""
1072+
1073+#. module: purchase_landed_costs
1074+#: field:stock.move,landing_costs:0
1075+msgid "Line Landing Costs"
1076+msgstr ""
1077+
1078+#. module: purchase_landed_costs
1079+#: help:landed.cost.position,amount:0
1080+msgid ""
1081+"Landed cost for stock valuation. It will be added to the price of the "
1082+"supplier price."
1083+msgstr ""
1084+
1085+#. module: purchase_landed_costs
1086+#: field:landed.cost.position,partner_id:0
1087+msgid "Partner"
1088+msgstr ""
1089+
1090+#. module: purchase_landed_costs
1091+#: field:purchase.order,landed_cost:0 field:stock.picking,landed_cost:0
1092+msgid "Landed Costs Total Untaxed"
1093+msgstr ""
1094+
1095+#. module: purchase_landed_costs
1096+#: field:landed.cost.position,price_type:0
1097+msgid "Amount Type"
1098+msgstr ""
1099
1100=== added file 'purchase_landed_costs/product.py'
1101--- purchase_landed_costs/product.py 1970-01-01 00:00:00 +0000
1102+++ purchase_landed_costs/product.py 2014-01-08 21:27:15 +0000
1103@@ -0,0 +1,40 @@
1104+# -*- coding: utf-8 -*-
1105+from osv import orm, fields
1106+#----------------------------------------------------------
1107+# Product INHERIT
1108+#----------------------------------------------------------
1109+
1110+
1111+class product_template(orm.Model):
1112+ _inherit = "product.template"
1113+
1114+ _columns = {
1115+ 'landed_cost_type': fields.selection(
1116+ [('value', 'Value'), ('per_unit', 'Quantity'), ('none', 'None')],
1117+ 'Distribution Type',
1118+ help="Used if this product is landed costs: If landed costs are \
1119+ defined for purchase orders or pickings, this indicates how the \
1120+ costs are distributed to the lines"
1121+ ),
1122+ 'landed_cost': fields.boolean(
1123+ 'Calculate Landed Costs',
1124+ help="Check this if you want to use landed cost calculation for \
1125+ average price for this product"
1126+ )
1127+ }
1128+
1129+product_template()
1130+
1131+
1132+class product_category(orm.Model):
1133+
1134+ _inherit = 'product.category'
1135+ _columns = {
1136+ 'landed_cost': fields.boolean(
1137+ 'Calculate Landed Costs',
1138+ help="Check this if you want to use landed cost calculation for \
1139+ average price for this category"
1140+ )
1141+ }
1142+
1143+product_category()
1144
1145=== added file 'purchase_landed_costs/purchase.py'
1146--- purchase_landed_costs/purchase.py 1970-01-01 00:00:00 +0000
1147+++ purchase_landed_costs/purchase.py 2014-01-08 21:27:15 +0000
1148@@ -0,0 +1,298 @@
1149+# -*- coding: utf-8 -*-
1150+from osv import orm, fields
1151+import decimal_precision as dp
1152+import logging
1153+
1154+
1155+class landed_cost_position(orm.Model):
1156+ _name = "landed.cost.position"
1157+ _columns = {
1158+ 'product_id': fields.many2one(
1159+ 'product.product',
1160+ 'Landed Cost Name',
1161+ required=True,
1162+ domain=[('landed_cost_type', '!=', False)]
1163+ ),
1164+ 'amount': fields.float(
1165+ 'Amount',
1166+ required=True,
1167+ digits_compute=dp.get_precision('Purchase Price'),
1168+ help="Landed cost for stock valuation. It will be added to the \
1169+ price of the supplier price."
1170+ ),
1171+ 'amount_currency': fields.float(
1172+ 'Amount Currency',
1173+ help="The amount expressed in an optional other currency."
1174+ ),
1175+ 'currency_id': fields.many2one('res.currency', 'Secondary Currency',
1176+ help="Optional other currency."),
1177+ 'partner_id': fields.many2one(
1178+ 'res.partner',
1179+ 'Partner',
1180+ help="The supplier of this cost component."
1181+ ),
1182+ 'price_type': fields.selection(
1183+ [('per_unit', 'Per Quantity'), ('value', 'Absolute Value')],
1184+ 'Amount Type',
1185+ required=True,
1186+ help="Defines if the amount is to be calculated for each quantity \
1187+ or an absolute value"
1188+ ),
1189+ 'purchase_order_line_id': fields.many2one('purchase.order.line',
1190+ 'Purchase Order Line'),
1191+ 'purchase_order_id': fields.many2one('purchase.order',
1192+ 'Purchase Order'),
1193+ 'move_line_id': fields.many2one('stock.move', 'Picking Line'),
1194+ 'picking_id': fields.many2one('stock.picking', 'Picking')
1195+ }
1196+
1197+ def onchange_product_id(self, cr, uid, ids, product_id, context=None):
1198+ if product_id:
1199+ prod_obj = self.pool.get('product.product')
1200+ prod = prod_obj.browse(cr, uid, [product_id], context=context)[0]
1201+ v = {'price_type': prod.landed_cost_type}
1202+ return {'value': v}
1203+ return {}
1204+
1205+
1206+landed_cost_position()
1207+
1208+#----------------------------------------------------------
1209+# Purchase Line INHERIT
1210+#----------------------------------------------------------
1211+
1212+
1213+class purchase_order_line(orm.Model):
1214+ _inherit = "purchase.order.line"
1215+
1216+ def _landing_cost(self, cr, uid, ids, name, args, context=None):
1217+ if not ids:
1218+ return {}
1219+ result = {}
1220+ # landed costs for the line
1221+ for line in self.browse(cr, uid, ids, context=context):
1222+ landed_costs = 0.0
1223+ if line.landed_cost_line_ids:
1224+ for costs in line.landed_cost_line_ids:
1225+ if costs.price_type == 'value':
1226+ landed_costs += costs.amount
1227+ else:
1228+ landed_costs += costs.amount * line.product_qty
1229+ result[line.id] = landed_costs
1230+ return result
1231+
1232+ def _landing_cost_order(self, cr, uid, ids, name, args, context=None):
1233+ if not ids:
1234+ return {}
1235+ result = {}
1236+ lines = self.browse(cr, uid, ids, context=context)
1237+ # Landed costs line by line
1238+ for line in lines:
1239+ landed_costs = 0.0
1240+ # distribution of landed costs of PO
1241+ if line.order_id.landed_cost_line_ids:
1242+ # Base value (Absolute Value)
1243+ landed_costs += line.order_id.landed_cost_base_value \
1244+ / line.order_id.amount_untaxed * line.price_subtotal
1245+
1246+ # Base quantity (Per Quantity)
1247+ landed_costs += line.order_id.landed_cost_base_quantity \
1248+ / line.order_id.quantity_total * line.product_qty
1249+ result[line.id] = landed_costs
1250+
1251+ return result
1252+
1253+ def _landed_cost(self, cr, uid, ids, name, args, context=None):
1254+ if not ids:
1255+ return {}
1256+ result = {}
1257+ # landed costs for the line
1258+ for line in self.browse(cr, uid, ids, context=context):
1259+ result[line.id] = line.price_subtotal + line.landing_costs + \
1260+ line.landing_costs_order
1261+
1262+ return result
1263+
1264+ _columns = {
1265+ 'landed_cost_line_ids': fields.one2many('landed.cost.position',
1266+ 'purchase_order_line_id',
1267+ 'Landed Costs Positions'),
1268+ 'landing_costs': fields.function(
1269+ _landing_cost,
1270+ digits_compute=dp.get_precision('Account'),
1271+ string='Landing Costs'
1272+ ),
1273+ 'landing_costs_order': fields.function(
1274+ _landing_cost_order,
1275+ digits_compute=dp.get_precision('Account'),
1276+ string='Landing Costs from Order'
1277+ ),
1278+ 'landed_costs': fields.function(
1279+ _landed_cost,
1280+ digits_compute=dp.get_precision('Account'),
1281+ string='Landed Costs'
1282+ )
1283+ }
1284+
1285+
1286+purchase_order_line()
1287+
1288+
1289+class purchase_order(orm.Model):
1290+ _inherit = "purchase.order"
1291+ _logger = logging.getLogger(__name__)
1292+
1293+ def _landed_cost_base_value(self, cr, uid, ids, name, args, context=None):
1294+ if not ids:
1295+ return {}
1296+ result = {}
1297+
1298+ for line in self.browse(cr, uid, ids, context=context):
1299+ landed_costs_base_value = 0.0
1300+ if line.landed_cost_line_ids:
1301+ for costs in line.landed_cost_line_ids:
1302+ if costs.product_id.landed_cost_type == 'value':
1303+ landed_costs_base_value += costs.amount
1304+ result[line.id] = landed_costs_base_value
1305+ return result
1306+
1307+ def _landed_cost_base_quantity(self, cr, uid, ids, name, args,
1308+ context=None):
1309+ if not ids:
1310+ return {}
1311+ result = {}
1312+
1313+ for line in self.browse(cr, uid, ids, context=context):
1314+ landed_costs_base_quantity = 0.0
1315+ if line.landed_cost_line_ids:
1316+ for costs in line.landed_cost_line_ids:
1317+ if costs.product_id.landed_cost_type == 'quantity':
1318+ landed_costs_base_quantity += costs.amount
1319+ result[line.id] = landed_costs_base_quantity
1320+ return result
1321+
1322+ def _quantity_total(self, cr, uid, ids, name, args, context):
1323+ if not ids:
1324+ return {}
1325+ result = {}
1326+
1327+ for line in self.browse(cr, uid, ids, context=context):
1328+ quantity_total = 0.0
1329+ if line.order_line:
1330+ for pol in line.order_line:
1331+ if pol.product_qty > 0.0:
1332+ quantity_total += pol.product_qty
1333+ result[line.id] = quantity_total
1334+ return result
1335+
1336+ def _landed_cost(self, cr, uid, ids, name, args, context=None):
1337+ if not ids:
1338+ return {}
1339+ result = {}
1340+ # landed costs for the line
1341+ for line in self.browse(cr, uid, ids,
1342+ context=context):
1343+ result[line.id] = line.landing_cost_lines + line.amount_untaxed
1344+
1345+ return result
1346+
1347+ def _landing_cost_lines(self, cr, uid, ids, name, args, context=None):
1348+ if not ids:
1349+ return {}
1350+ result = {}
1351+ landed_cost_lines = 0.0
1352+ for line in self.browse(cr, uid, ids, context=context):
1353+ if line.order_line:
1354+ for pol in line.order_line:
1355+ if pol.product_qty > 0.0:
1356+ landed_cost_lines += pol.landing_costs
1357+ result[line.id] = landed_cost_lines
1358+ return result
1359+
1360+ _columns = {
1361+ 'landed_cost_line_ids': fields.one2many('landed.cost.position',
1362+ 'purchase_order_id',
1363+ 'Landed Costs'),
1364+ 'landed_cost_base_value': fields.function(
1365+ _landed_cost_base_value,
1366+ digits_compute=dp.get_precision('Account'),
1367+ string='Landed Costs Base Value'
1368+ ),
1369+ 'landed_cost_base_quantity': fields.function(
1370+ _landed_cost_base_quantity,
1371+ digits_compute=dp.get_precision('Account'),
1372+ string='Landed Costs Base Quantity'
1373+ ),
1374+ 'landing_cost_lines': fields.function(
1375+ _landing_cost_lines,
1376+ digits_compute=dp.get_precision('Account'),
1377+ string='Landing Cost Lines'
1378+ ),
1379+ 'landed_cost': fields.function(
1380+ _landed_cost,
1381+ digits_compute=dp.get_precision('Account'),
1382+ string='Landed Costs Total Untaxed'
1383+ ),
1384+ 'quantity_total': fields.function(
1385+ _quantity_total,
1386+ digits_compute=dp.get_precision('Product UoM'),
1387+ string='Total Quantity')
1388+ }
1389+
1390+ def _prepare_order_line_move(self, cr, uid, order, order_line, picking_id,
1391+ context=None):
1392+ res = super(purchase_order, self)._prepare_order_line_move(
1393+ cr, uid, order, order_line, picking_id, context
1394+ )
1395+ res['price_unit_net'] = order_line.price_subtotal / order_line.product_qty
1396+ res['price_unit'] = order_line.landed_costs / order_line.product_qty
1397+ return res
1398+
1399+ def _prepare_order_picking(self, cr, uid, order, context=None):
1400+ res = super(purchase_order, self)._prepare_order_picking(
1401+ cr, uid, order, context
1402+ )
1403+ return res
1404+
1405+ def _create_pickings(self, cr, uid, order, order_lines, picking_id=False,
1406+ context=None):
1407+ res = super(purchase_order, self)._create_pickings(
1408+ cr, uid, order, order_lines, picking_id, context)
1409+ pick_id = int(res[0])
1410+ # landing costs for PICK from PO
1411+ cost_obj = self.pool.get('landed.cost.position')
1412+ for order_cost in order.landed_cost_line_ids:
1413+ vals = {}
1414+ vals['product_id'] = order_cost.product_id.id
1415+ vals['partner_id'] = order_cost.partner_id.id
1416+ vals['amount'] = order_cost.amount
1417+ vals['amount_currency'] = order_cost.amount_currency
1418+ vals['currency_id'] = order_cost.currency_id.id
1419+ vals['price_type'] = order_cost.price_type
1420+ vals['picking_id'] = pick_id
1421+ self._logger.debug('vals `%s`', vals)
1422+ cost_obj.create(cr, uid, vals, context=context)
1423+
1424+ # landing costs for PICK Lines from PO
1425+ pick_obj = self.pool.get('stock.picking')
1426+ for pick in pick_obj.browse(cr, uid, [pick_id], context=context):
1427+ self._logger.debug('pick `%s`', pick)
1428+ for line in pick.move_lines:
1429+ self._logger.debug('line `%s`', line)
1430+ for order_cost in line.purchase_line_id.landed_cost_line_ids:
1431+ vals = {}
1432+ vals['product_id'] = order_cost.product_id.id
1433+ vals['partner_id'] = order_cost.partner_id.id
1434+ vals['amount'] = order_cost.amount
1435+ vals['amount_currency'] = order_cost.amount_currency
1436+ vals['currency_id'] = order_cost.currency_id.id
1437+ vals['price_type'] = order_cost.price_type
1438+ vals['move_line_id'] = line.id
1439+ self._logger.debug('vals `%s`', vals)
1440+ cost_obj.create(cr, uid, vals, context=context)
1441+ self._logger.debug('cost created')
1442+
1443+ return res
1444+
1445+
1446+purchase_order()
1447
1448=== added file 'purchase_landed_costs/purchase_view.xml'
1449--- purchase_landed_costs/purchase_view.xml 1970-01-01 00:00:00 +0000
1450+++ purchase_landed_costs/purchase_view.xml 2014-01-08 21:27:15 +0000
1451@@ -0,0 +1,104 @@
1452+<?xml version="1.0" encoding="UTF-8"?>
1453+<openerp>
1454+ <data>
1455+
1456+ <record model="ir.ui.view" id="c2c_landed_cost_tree">
1457+ <field name="name">c2clanded.cost.tree</field>
1458+ <field name="model">landed.cost.position</field>
1459+ <field name="priority">1</field>
1460+ <field name="type">tree</field>
1461+ <field name="arch" type="xml">
1462+ <tree string="Landing Costs" editable="bottom">
1463+ <field name="product_id" on_change="onchange_product_id(product_id)"/>
1464+ <field name="partner_id"/>
1465+ <field name="amount"/>
1466+ <field name="price_type"/>
1467+ <field name="amount_currency"/>
1468+ <field name="currency_id"/>
1469+ </tree>
1470+ </field>
1471+ </record>
1472+
1473+ <record model="ir.ui.view" id="c2c_landed_cost_form">
1474+ <field name="name">c2clanded.cost.form</field>
1475+ <field name="model">landed.cost.position</field>
1476+ <field name="priority">1</field>
1477+ <field name="type">form</field>
1478+ <field name="arch" type="xml">
1479+ <form string="Landing Costs">
1480+ <field name="product_id" on_change="onchange_product_id(product_id)"/>
1481+ <field name="partner_id"/>
1482+ <field name="amount"/>
1483+ <field name="price_type"/>
1484+ <field name="amount_currency"/>
1485+ <field name="currency_id"/>
1486+ </form>
1487+ </field>
1488+ </record>
1489+
1490+
1491+
1492+ <!-- ******************
1493+ Landed cost definition in product form
1494+ ******************-->
1495+ <record model="ir.ui.view" id="c2c_product_landed_cost_view">
1496+ <field name="name">c2c_product.landed.cost.view</field>
1497+ <field name="model">product.product</field>
1498+ <field name="inherit_id" ref="product.product_normal_form_view"/>
1499+ <field name="type">form</field>
1500+ <field name="arch" type="xml">
1501+ <field name="active" position="after">
1502+ <field name="landed_cost_type"/>
1503+ <field name="landed_cost"/>
1504+ </field>
1505+ </field>
1506+ </record>
1507+
1508+ <!-- Landed costs Purchase Form-->
1509+ <record model="ir.ui.view" id="c2c_purchase_order_landed_cost_view">
1510+ <field name="name">c2c_purchase.order.landed.cost.form.view</field>
1511+ <field name="model">purchase.order</field>
1512+ <field name="inherit_id" ref="purchase.purchase_order_form"/>
1513+ <field name="type">form</field>
1514+ <field name="arch" type="xml">
1515+ <notebook position="inside">
1516+ <page string="Landing Costs" attrs="{'readonly':[('state','=','done')]}">
1517+ <group colspan="2" col="2">
1518+ <field name="quantity_total"/>
1519+ <field name="landed_cost_base_quantity"/>
1520+ <field name="landed_cost_base_value"/>
1521+ </group>
1522+ <group colspan="2" col="2">
1523+
1524+ <field name="landing_cost_lines"/>
1525+ <field name="landed_cost"/>
1526+ </group>
1527+ <field name="landed_cost_line_ids" colspan="4" nolabel="1" widget="one2many_list"/>
1528+
1529+ </page>
1530+ </notebook>
1531+ </field>
1532+ </record>
1533+
1534+ <!-- Landed costs Purchase Line Form-->
1535+ <record model="ir.ui.view" id="purchase_oder_line_landed_cost_view">
1536+ <field name="name">purchase.oder.line.landed.cost.view</field>
1537+ <field name="model">purchase.order.line</field>
1538+ <field name="inherit_id" ref="purchase.purchase_order_line_form"/>
1539+ <field name="type">form</field>
1540+ <field name="arch" type="xml">
1541+ <notebook position="inside">
1542+ <page string="Landing Costs" >
1543+ <group colspan="2" col="2">
1544+ <field name="landing_costs"/>
1545+ <field name="landing_costs_order"/>
1546+ <field name="landed_costs"/>
1547+ <field name="landed_cost_line_ids" colspan="4" nolabel="1" widget="one2many_list"/>
1548+ </group>
1549+ </page>
1550+ </notebook>
1551+ </field>
1552+ </record>
1553+
1554+ </data>
1555+</openerp>
1556
1557=== added directory 'purchase_landed_costs/security'
1558=== added file 'purchase_landed_costs/security/ir.model.access.csv'
1559--- purchase_landed_costs/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
1560+++ purchase_landed_costs/security/ir.model.access.csv 2014-01-08 21:27:15 +0000
1561@@ -0,0 +1,3 @@
1562+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1563+access_landed_cost,landed.cost.position,model_landed_cost_position,purchase.group_purchase_user,1,1,1,1
1564+access_landed_cost_manager,landed.cost.position,model_landed_cost_position,purchase.group_purchase_manager,1,1,1,1
1565
1566=== added file 'purchase_landed_costs/stock.py'
1567--- purchase_landed_costs/stock.py 1970-01-01 00:00:00 +0000
1568+++ purchase_landed_costs/stock.py 2014-01-08 21:27:15 +0000
1569@@ -0,0 +1,297 @@
1570+# -*- coding: utf-8 -*-
1571+from osv import orm, fields
1572+from operator import itemgetter
1573+import decimal_precision as dp
1574+import logging
1575+#----------------------------------------------------------
1576+# Stock Move
1577+#----------------------------------------------------------
1578+
1579+
1580+class stock_move(orm.Model):
1581+ _inherit = "stock.move"
1582+
1583+ def _landing_cost(self, cr, uid, ids, name, args, context=None):
1584+ if not ids:
1585+ return {}
1586+ result = {}
1587+ # landed costs for the line
1588+ for line in self.browse(cr, uid, ids, context=context):
1589+ landed_costs = 0.0
1590+ if line.landed_cost_line_ids:
1591+ for costs in line.landed_cost_line_ids:
1592+ if costs.price_type == 'value':
1593+ landed_costs += costs.amount
1594+ else:
1595+ landed_costs += costs.amount * line.product_qty
1596+ result[line.id] = landed_costs
1597+ return result
1598+
1599+ def _landing_cost_order(self, cr, uid, ids, name, args, context=None):
1600+ if not ids:
1601+ return {}
1602+ result = {}
1603+ # landed costs for the line
1604+ for line in self.browse(cr, uid, ids, context=context):
1605+ landed_costs = 0.0
1606+ # distribution of landed costs of PO
1607+ if line.picking_id.landed_cost_line_ids:
1608+ if line.picking_id.total_amount \
1609+ and line.picking_id.total_amount > 0.0:
1610+ landed_costs += line.picking_id.landed_cost_base_value \
1611+ / line.picking_id.total_amount \
1612+ * line.sub_total
1613+ if line.picking_id.quantity_total \
1614+ and line.picking_id.quantity_total > 0.0:
1615+ landed_costs += line.picking_id.landed_cost_base_quantity \
1616+ / line.picking_id.quantity_total * line.product_qty
1617+ result[line.id] = landed_costs
1618+
1619+ return result
1620+
1621+ def _landed_cost(self, cr, uid, ids, name, args, context=None):
1622+ if not ids:
1623+ return {}
1624+ result = {}
1625+ # landed costs for the line
1626+ for line in self.browse(cr, uid, ids, context=context):
1627+ result[line.id] = line.product_qty * line.price_unit
1628+
1629+ return result
1630+
1631+ def _sub_total(self, cr, uid, ids, name, args, context=None):
1632+ if not ids:
1633+ return {}
1634+ result = {}
1635+ for line in self.browse(cr, uid, ids, context=context):
1636+ result[line.id] = line.product_qty * line.price_unit_net or 0.0
1637+
1638+ return result
1639+
1640+ _columns = {
1641+ 'landed_cost_line_ids': fields.one2many('landed.cost.position',
1642+ 'move_line_id',
1643+ 'Landed Costs Positions'),
1644+ 'landing_costs': fields.function(
1645+ _landing_cost,
1646+ digits_compute=dp.get_precision('Account'),
1647+ string='Line Landing Costs'
1648+ ),
1649+ 'landing_costs_picking': fields.function(
1650+ _landing_cost_order,
1651+ digits_compute=dp.get_precision('Account'),
1652+ string='Landing Costs from Picking'
1653+ ),
1654+ 'landed_cost': fields.function(
1655+ _landed_cost,
1656+ digits_compute=dp.get_precision('Account'),
1657+ string='Landed Costs'
1658+ ),
1659+ 'sub_total': fields.function(
1660+ _sub_total,
1661+ digits_compute=dp.get_precision('Account'),
1662+ string='Line Sub Total'
1663+ ),
1664+ 'price_unit_net': fields.float(
1665+ 'Purchase Price',
1666+ digits_compute=dp.get_precision('Account')
1667+ )
1668+ }
1669+
1670+stock_move()
1671+
1672+#----------------------------------------------------------
1673+# Stock Picking
1674+#----------------------------------------------------------
1675+
1676+
1677+class stock_picking(orm.Model):
1678+ _inherit = "stock.picking"
1679+
1680+ def _landed_cost_base_value(self, cr, uid, ids, name, args, context=None):
1681+ if not ids:
1682+ return {}
1683+ result = {}
1684+ for line in self.browse(cr, uid, ids, context=context):
1685+ landed_costs_base_value = 0.0
1686+ if line.landed_cost_line_ids:
1687+ for costs in line.landed_cost_line_ids:
1688+ if costs.product_id.landed_cost_type == 'value':
1689+ landed_costs_base_value += costs.amount
1690+ result[line.id] = landed_costs_base_value
1691+ return result
1692+
1693+ def _landed_cost_base_quantity(self, cr, uid, ids,
1694+ name, args, context=None):
1695+ if not ids:
1696+ return {}
1697+ result = {}
1698+ for line in self.browse(cr, uid, ids, context=context):
1699+ landed_costs_base_quantity = 0.0
1700+ if line.landed_cost_line_ids:
1701+ for costs in line.landed_cost_line_ids:
1702+ if costs.product_id.landed_cost_type == 'quantity':
1703+ landed_costs_base_quantity += costs.amount
1704+ result[line.id] = landed_costs_base_quantity
1705+ return result
1706+
1707+ def _landed_cost(self, cr, uid, ids, name, args, context=None):
1708+ if not ids:
1709+ return {}
1710+ result = {}
1711+ # landed costs for the line
1712+ for line in self.browse(cr, uid, ids, context=context):
1713+ landed_costs = 0.0
1714+ if line.move_lines:
1715+ for ml in line.move_lines:
1716+ landed_costs += ml.landed_cost
1717+ result[line.id] = landed_costs
1718+
1719+ return result
1720+
1721+ def _landing_cost_lines(self, cr, uid, ids, name, args, context=None):
1722+ if not ids:
1723+ return {}
1724+ result = {}
1725+ for picking in self.browse(cr, uid, ids, context=context):
1726+ landed_cost_lines = 0.0
1727+ if picking.move_lines:
1728+ for ml in picking.move_lines:
1729+ if ml.product_qty > 0.0:
1730+ landed_cost_lines += ml.landing_costs + \
1731+ ml.landing_costs_picking
1732+ result[picking.id] = landed_cost_lines
1733+ return result
1734+
1735+ def _quantity_total(self, cr, uid, ids, name, args, context=None):
1736+ if not ids:
1737+ return {}
1738+ result = {}
1739+ for line in self.browse(cr, uid, ids, context=context):
1740+ quantity_total = 0.0
1741+ if line.move_lines:
1742+ for ml in line.move_lines:
1743+ if ml.product_qty > 0.0:
1744+ quantity_total += ml.product_qty
1745+ result[line.id] = quantity_total
1746+ return result
1747+
1748+ def _amount_total(self, cr, uid, ids, name, args, context=None):
1749+ if not ids:
1750+ return {}
1751+ result = {}
1752+ stock_pickings = self.browse(cr, uid, ids, context=context)
1753+ for picking in stock_pickings:
1754+ amount_total = 0.0
1755+ if picking.move_lines:
1756+ for ml in picking.move_lines:
1757+ if ml.product_qty > 0.0 and ml.price_unit:
1758+ amount_total += ml.sub_total
1759+ result[picking.id] = amount_total
1760+ return result
1761+
1762+ def _get_price_unit_invoice(self, cursor, user, move_line,
1763+ type):
1764+ if move_line.purchase_line_id:
1765+ return move_line.purchase_line_id.price_unit
1766+ return super(stock_picking, self)._get_price_unit_invoice(
1767+ cursor, user, move_line, type
1768+ )
1769+
1770+ def write(self, cr, uid, ids, values, context=None):
1771+ if 'landed_cost_line_ids' in values:
1772+ sps = self.browse(cr, uid, ids, context=context)
1773+ old_picking = {}
1774+ for picking in sps:
1775+ old_picking[picking.id] = {
1776+ 'landed_cost_base_value':
1777+ picking.landed_cost_base_value or 0.0,
1778+ 'landed_cost_base_quantity':
1779+ picking.landed_cost_base_quantity or 0.0
1780+ }
1781+
1782+ ml_obj = self.pool.get('stock.move')
1783+ res = super(stock_picking, self).write(
1784+ cr, uid, ids, values, context=context
1785+ )
1786+ if res and 'landed_cost_line_ids' in values:
1787+ for picking in sps:
1788+ nsp = self.browse(cr, uid, [picking.id], context=context)
1789+ new_picking = nsp[0]
1790+ prev = old_picking[picking.id]
1791+ chg_landed_cost_base_quantity = \
1792+ new_picking.landed_cost_base_quantity - \
1793+ prev['landed_cost_base_quantity']
1794+ chg_landed_cost_base_value = \
1795+ new_picking.landed_cost_base_value - \
1796+ prev['landed_cost_base_value']
1797+ if picking.move_lines:
1798+ for ml in picking.move_lines:
1799+ qty_ratio = ml.product_qty / \
1800+ new_picking.quantity_total
1801+ value_ratio = ml.sub_total / \
1802+ new_picking.total_amount
1803+ price_unit = (
1804+ ml.landed_cost +
1805+ qty_ratio * chg_landed_cost_base_quantity +
1806+ value_ratio * chg_landed_cost_base_value
1807+ ) / ml.product_qty
1808+ ml_obj.write(
1809+ cr, uid, [ml.id],
1810+ {'price_unit': price_unit},
1811+ context=context
1812+ )
1813+ return res
1814+
1815+ _columns = {
1816+ 'landed_cost_line_ids': fields.one2many('landed.cost.position',
1817+ 'picking_id',
1818+ 'Landed Costs Positions'),
1819+ 'landed_cost_base_value': fields.function(
1820+ _landed_cost_base_value,
1821+ digits_compute=dp.get_precision('Account'),
1822+ string='Landed Costs Base Value'
1823+ ),
1824+ 'landed_cost_base_quantity': fields.function(
1825+ _landed_cost_base_quantity,
1826+ digits_compute=dp.get_precision('Account'),
1827+ string='Landed Costs Base Quantity'
1828+ ),
1829+ 'landing_cost_lines': fields.function(
1830+ _landing_cost_lines,
1831+ digits_compute=dp.get_precision('Account'),
1832+ string='Landing Cost Lines'
1833+ ),
1834+ 'landed_cost': fields.function(
1835+ _landed_cost,
1836+ digits_compute=dp.get_precision('Account'),
1837+ string='Landed Costs Total Untaxed'
1838+ ),
1839+ 'total_amount': fields.function(
1840+ _amount_total,
1841+ digits_compute=dp.get_precision('Account'),
1842+ string='Total Product Price'
1843+ ),
1844+ 'quantity_total': fields.function(
1845+ _quantity_total,
1846+ digits_compute=dp.get_precision('Product UoM'),
1847+ string='Total Quantity'
1848+ )
1849+ }
1850+
1851+stock_picking()
1852+
1853+
1854+class stock_partial_picking(orm.TransientModel):
1855+ _inherit = "stock.partial.picking"
1856+ _logger = logging.getLogger(__name__)
1857+
1858+ def _product_cost_for_average_update(self, cr, uid, move):
1859+ res = super(stock_partial_picking, self).\
1860+ _product_cost_for_average_update(cr, uid, move)
1861+ self._logger.debug('res stock_partial_picking `%s`', res)
1862+ res['cost'] = move.landed_cost / move.product_qty
1863+ self._logger.debug('res stock_partial_picking `%s`', res)
1864+ return res
1865+
1866+stock_partial_picking()
1867
1868=== added file 'purchase_landed_costs/stock_view.xml'
1869--- purchase_landed_costs/stock_view.xml 1970-01-01 00:00:00 +0000
1870+++ purchase_landed_costs/stock_view.xml 2014-01-08 21:27:15 +0000
1871@@ -0,0 +1,49 @@
1872+<?xml version="1.0" encoding="UTF-8"?>
1873+<openerp>
1874+ <data>
1875+
1876+ <!-- Landed costs Picking In Form-->
1877+ <record model="ir.ui.view" id="c2c_stock_picking_landed_cost_view">
1878+ <field name="name">c2c_stock.picking.landed.cost.form.view</field>
1879+ <field name="model">stock.picking</field>
1880+ <field name="inherit_id" ref="stock.view_picking_in_form"/>
1881+ <field name="type">form</field>
1882+ <field name="arch" type="xml">
1883+ <page string="Notes" position="after">
1884+ <page string="Landing Costs" attrs="{'readonly':[('state','=','done')]}">
1885+ <group colspan="2" col="2">
1886+ <field name="quantity_total"/>
1887+ <field name="landed_cost_base_quantity"/>
1888+ <field name="landed_cost_base_value"/>
1889+ </group>
1890+ <group colspan="2" col="2">
1891+ <field name="total_amount"/>
1892+ <field name="landing_cost_lines"/>
1893+ <field name="landed_cost"/>
1894+ </group>
1895+ <field name="landed_cost_line_ids" colspan="4" nolabel="1" widget="one2many_list"/>
1896+ </page>
1897+ </page>
1898+ </field>
1899+ </record>
1900+
1901+ <!-- Landed costs Picking In Line Form-->
1902+ <record model="ir.ui.view" id="ic2c_stock_picking_landed_cost_line_view">
1903+ <field name="name">move.line.landed.cost.line.view</field>
1904+ <field name="model">stock.picking</field>
1905+ <field name="inherit_id" ref="stock.view_picking_in_form"/>
1906+ <field name="type">form</field>
1907+ <field name="arch" type="xml">
1908+ <xpath expr="/form/notebook/page[@string='General Information']/field/form/label" position="before">
1909+ <group string="Landing Costs" colspan="4">
1910+ <field name="landing_costs"/>
1911+ <field name="landing_costs_picking"/>
1912+ <field name="sub_total"/>
1913+ <field name="landed_cost"/>
1914+ <field name="landed_cost_line_ids" colspan="4" nolabel="1" widget="one2many_list"/>
1915+ </group>
1916+ </xpath>
1917+ </field>
1918+ </record>
1919+ </data>
1920+</openerp>
1921
1922=== added directory 'purchase_landed_costs/wizard'

Subscribers

People subscribed via source and target branches

to all changes: