Merge lp:~pedro.baeza/purchase-wkfl/7.0-purchase_discount into lp:~purchase-core-editors/purchase-wkfl/7.0

Proposed by Pedro Manuel Baeza
Status: Merged
Merged at revision: 38
Proposed branch: lp:~pedro.baeza/purchase-wkfl/7.0-purchase_discount
Merge into: lp:~purchase-core-editors/purchase-wkfl/7.0
Diff against target: 867 lines (+806/-0)
11 files modified
purchase_discount/__init__.py (+21/-0)
purchase_discount/__openerp__.py (+52/-0)
purchase_discount/i18n/es.po (+43/-0)
purchase_discount/i18n/es_ES.po (+43/-0)
purchase_discount/i18n/pt_BR.po (+43/-0)
purchase_discount/i18n/purchase_discount.pot (+42/-0)
purchase_discount/models/purchase_discount.py (+135/-0)
purchase_discount/report/order.rml (+365/-0)
purchase_discount/report/purchase_discount_report.xml (+11/-0)
purchase_discount/views/account_invoice_view.xml (+16/-0)
purchase_discount/views/purchase_discount_view.xml (+35/-0)
To merge this branch: bzr merge lp:~pedro.baeza/purchase-wkfl/7.0-purchase_discount
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review Approve
Lorenzo Battistini (community) code review Approve
Omar (Pexego) code review no test Approve
Review via email: mp+217030@code.launchpad.net

Description of the change

[ADD] purchase_discount: Module that I ported some time ago to v7 and included in vauxoo-addons. I think this module deserves to be in OCA repositories to have a "standard" way for this common need.

To post a comment you must log in.
32. By Pedro Manuel Baeza

[FIX] purchase_discount: Supplier invoice view with discount

Revision history for this message
Lorenzo Battistini (elbati) wrote :
Download full text (3.3 KiB)

Thanks Pedro,

line 349: I think discount should not be < -100 too
line 399: amount_untaxed and following fields are present 2 times

some PEP8:

purchase_discount/__openerp__.py:21:1: O603 Manifest "license" key is missing
purchase_discount/__openerp__.py:29:5: O600 Warning unknown Manifest key ('contributors')
purchase_discount/__openerp__.py:43:5: O600 Warning unknown Manifest key ('active')
purchase_discount/purchase_discount.py:21:1: O603 Manifest "license" key is missing
purchase_discount/purchase_discount.py:24:1: E302 expected 2 blank lines, found 1
purchase_discount/purchase_discount.py:29:5: O600 Warning unknown Manifest key ('contributors')
purchase_discount/purchase_discount.py:35:75: W291 trailing whitespace
purchase_discount/purchase_discount.py:43:5: O600 Warning unknown Manifest key ('active')
purchase_discount/purchase_discount.py:43:75: W291 trailing whitespace
purchase_discount/purchase_discount.py:44:33: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:52:56: W291 trailing whitespace
purchase_discount/purchase_discount.py:86:29: E127 continuation line over-indented for visual indent
purchase_discount/purchase_discount.py:103:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:104:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:105:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:109:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:110:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:114:17: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:115:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:118:55: W291 trailing whitespace
purchase_discount/purchase_discount.py:119:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:119:28: E251 unexpected spaces around keyword / parameter equals
purchase_discount/purchase_discount.py:119:57: W291 trailing whitespace
purchase_discount/purchase_discount.py:120:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:121:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:123:60: W291 trailing whitespace
purchase_discount/purchase_discount.py:125:51: W291 trailing whitespace
purchase_discount/purchase_discount.py:126:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:126:28: E251 unexpected spaces around keyword / parameter equals
purchase_discount/purchase_discount.py:127:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:130:53: W291 trailing whitespace
purchase_discount/purchase_discount.py:131:13: E128 continuation line under-indented for visual indent
purchase_discount/purchase_discount.py:131:28: E251 unexpected spaces around keyword / parameter equals
purchase_discount/purch...

Read more...

review: Needs Fixing
33. By Pedro Manuel Baeza

PEP8 errors corrected

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

Hi, Lorenzo, thanks for your review.

I have corrected flake8 output.

But about negative restriction in the percentage amount, I don't think it's a good idea, because you can apply a surcharge of whatever percentage you want: for example, -100% to double original price, -200% to triple it, and so on.

Regards.

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

Ok, thanks.

What about the
amount_untaxed, amount_tax, amount_total
fields repeated 2 times?

34. By Pedro Manuel Baeza

[FIX] Duplicated field definition.
[IMP] self.pool[] instead of self.pool.get

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

You're right. I don't know how can I overpassed that!

I have corrected.

Thanks. Regards.

Revision history for this message
Omar (Pexego) (omar7r) wrote :

Thanks Pedro, I had long wanted to propose this module on the branch.

review: Approve (code review no test)
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi,

I left some diff comments.
I'm also annoyed by the incompatibily introduced by this module (override of amount_all and amount_line), but on the other hand there is maybe no other way to do that.

Thanks Pedro

review: Needs Fixing
35. By Pedro Manuel Baeza

Some changes from Guewen's review

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

Hi, Guewen, thanks for the review.

I have fixed your remarks.

I don't like also to overwrite function fields methods, but I assure you that there's no other way for now. I'm going to propose a hook method for purchase line base price on core to see if we can improve this module for next version.

Regards.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Great, thanks!

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'purchase_discount'
=== added file 'purchase_discount/__init__.py'
--- purchase_discount/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_discount/__init__.py 2014-06-20 10:14:35 +0000
@@ -0,0 +1,21 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
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
9# published by the Free Software Foundation, either version 3 of the
10# License, or (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 models
022
=== added file 'purchase_discount/__openerp__.py'
--- purchase_discount/__openerp__.py 1970-01-01 00:00:00 +0000
+++ purchase_discount/__openerp__.py 2014-06-20 10:14:35 +0000
@@ -0,0 +1,52 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
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
9# published by the Free Software Foundation, either version 3 of the
10# License, or (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": "Purchase order lines with discounts",
23 "author": "Tiny, Acysos S.L.",
24 "description": """
25It allows to define a discount per line in the purchase
26orders. This discount can be also negative, interpreting it as an increment.
27
28**REMARK**: This module can be incompatible with other modules that modify
29purchase prices, because it overwrites computation methods.
30
31**Contributors**:
32 * Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
33 """,
34 "version": "1.0",
35 "contributors": [
36 'Pedro M. Baeza',
37 ],
38 "category": "Generic Modules/Sales & Purchases",
39 "depends": [
40 "stock",
41 "purchase",
42 ],
43 "demo": [],
44 "data": [
45 "purchase_discount_view.xml",
46 "account_invoice_view.xml",
47 "report/purchase_discount_report.xml",
48 ],
49 "license": 'AGPL-3',
50 "installable": True
51}
52# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
053
=== added directory 'purchase_discount/i18n'
=== added file 'purchase_discount/i18n/es.po'
--- purchase_discount/i18n/es.po 1970-01-01 00:00:00 +0000
+++ purchase_discount/i18n/es.po 2014-06-20 10:14:35 +0000
@@ -0,0 +1,43 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * purchase_discount
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 5.0.11\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2013-11-07 01:07+0000\n"
10"PO-Revision-Date: 2013-11-08 17:57+0000\n"
11"Last-Translator: hbto [Vauxoo] http://www.vauxoo.com "
12"<humbertoarocha@gmail.com>\n"
13"Language-Team: \n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-01-29 06:04+0000\n"
18"X-Generator: Launchpad (build 16916)\n"
19
20#. module: purchase_discount
21#: model:ir.model,name:purchase_discount.model_purchase_order
22msgid "Purchase Order"
23msgstr "Orden de Compra"
24
25#. module: purchase_discount
26#: model:ir.model,name:purchase_discount.model_stock_picking
27msgid "Picking List"
28msgstr "Albarán"
29
30#. module: purchase_discount
31#: sql_constraint:purchase.order.line:0
32msgid "Discount must be lower than 100%."
33msgstr "El desduento debe ser menor al 100%."
34
35#. module: purchase_discount
36#: model:ir.model,name:purchase_discount.model_purchase_order_line
37msgid "Purchase Order Line"
38msgstr "Línea orden de compra"
39
40#. module: purchase_discount
41#: field:purchase.order.line,discount:0
42msgid "Discount (%)"
43msgstr "(%) Descuento"
044
=== added file 'purchase_discount/i18n/es_ES.po'
--- purchase_discount/i18n/es_ES.po 1970-01-01 00:00:00 +0000
+++ purchase_discount/i18n/es_ES.po 2014-06-20 10:14:35 +0000
@@ -0,0 +1,43 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * purchase_discount
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 5.0.11\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2013-11-07 01:07+0000\n"
10"PO-Revision-Date: 2013-11-07 04:36+0000\n"
11"Last-Translator: Moisés López - http://www.vauxoo.com "
12"<moylop260@vauxoo.com>\n"
13"Language-Team: \n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-01-29 06:04+0000\n"
18"X-Generator: Launchpad (build 16916)\n"
19
20#. module: purchase_discount
21#: model:ir.model,name:purchase_discount.model_purchase_order
22msgid "Purchase Order"
23msgstr ""
24
25#. module: purchase_discount
26#: model:ir.model,name:purchase_discount.model_stock_picking
27msgid "Picking List"
28msgstr ""
29
30#. module: purchase_discount
31#: sql_constraint:purchase.order.line:0
32msgid "Discount must be lower than 100%."
33msgstr ""
34
35#. module: purchase_discount
36#: model:ir.model,name:purchase_discount.model_purchase_order_line
37msgid "Purchase Order Line"
38msgstr ""
39
40#. module: purchase_discount
41#: field:purchase.order.line,discount:0
42msgid "Discount (%)"
43msgstr "(%) Descuento"
044
=== added file 'purchase_discount/i18n/pt_BR.po'
--- purchase_discount/i18n/pt_BR.po 1970-01-01 00:00:00 +0000
+++ purchase_discount/i18n/pt_BR.po 2014-06-20 10:14:35 +0000
@@ -0,0 +1,43 @@
1# Brazilian Portuguese translation for addons-vauxoo
2# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013
3# This file is distributed under the same license as the addons-vauxoo package.
4# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
5#
6msgid ""
7msgstr ""
8"Project-Id-Version: addons-vauxoo\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-07 01:07+0000\n"
11"PO-Revision-Date: 2013-07-28 13:28+0000\n"
12"Last-Translator: Claudio de Araujo Santos <claudioaraujosantos@gmail.com>\n"
13"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2014-01-29 06:04+0000\n"
18"X-Generator: Launchpad (build 16916)\n"
19
20#. module: purchase_discount
21#: model:ir.model,name:purchase_discount.model_purchase_order
22msgid "Purchase Order"
23msgstr "Ordem de Compra"
24
25#. module: purchase_discount
26#: model:ir.model,name:purchase_discount.model_stock_picking
27msgid "Picking List"
28msgstr ""
29
30#. module: purchase_discount
31#: sql_constraint:purchase.order.line:0
32msgid "Discount must be lower than 100%."
33msgstr ""
34
35#. module: purchase_discount
36#: model:ir.model,name:purchase_discount.model_purchase_order_line
37msgid "Purchase Order Line"
38msgstr ""
39
40#. module: purchase_discount
41#: field:purchase.order.line,discount:0
42msgid "Discount (%)"
43msgstr "Desconto (%)"
044
=== added file 'purchase_discount/i18n/purchase_discount.pot'
--- purchase_discount/i18n/purchase_discount.pot 1970-01-01 00:00:00 +0000
+++ purchase_discount/i18n/purchase_discount.pot 2014-06-20 10:14:35 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * purchase_discount
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-11-07 01:07+0000\n"
10"PO-Revision-Date: 2013-11-07 01:07+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: purchase_discount
19#: model:ir.model,name:purchase_discount.model_purchase_order
20msgid "Purchase Order"
21msgstr ""
22
23#. module: purchase_discount
24#: model:ir.model,name:purchase_discount.model_stock_picking
25msgid "Picking List"
26msgstr ""
27
28#. module: purchase_discount
29#: sql_constraint:purchase.order.line:0
30msgid "Discount must be lower than 100%."
31msgstr ""
32
33#. module: purchase_discount
34#: model:ir.model,name:purchase_discount.model_purchase_order_line
35msgid "Purchase Order Line"
36msgstr ""
37
38#. module: purchase_discount
39#: field:purchase.order.line,discount:0
40msgid "Discount (%)"
41msgstr ""
42
043
=== added directory 'purchase_discount/models'
=== added file 'purchase_discount/models/purchase_discount.py'
--- purchase_discount/models/purchase_discount.py 1970-01-01 00:00:00 +0000
+++ purchase_discount/models/purchase_discount.py 2014-06-20 10:14:35 +0000
@@ -0,0 +1,135 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
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
9# published by the Free Software Foundation, either version 3 of the
10# License, or (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
22import openerp.addons.decimal_precision as dp
23
24
25class PurchaseOrderLine(orm.Model):
26 _inherit = "purchase.order.line"
27
28 def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
29 res = {}
30 cur_obj = self.pool['res.currency']
31 tax_obj = self.pool['account.tax']
32 for line in self.browse(cr, uid, ids, context=context):
33 discount = line.discount or 0.0
34 new_price_unit = line.price_unit * (1 - discount / 100.0)
35 taxes = tax_obj.compute_all(cr, uid, line.taxes_id, new_price_unit,
36 line.product_qty, line.product_id,
37 line.order_id.partner_id)
38 currency = line.order_id.pricelist_id.currency_id
39 res[line.id] = cur_obj.round(cr, uid, currency, taxes['total'])
40 return res
41
42 _columns = {
43 'discount': fields.float('Discount (%)', dp.get_precision('Discount'),
44 'price_subtotal': fields.function(
45 _amount_line, string='Subtotal',
46 digits_compute=dp.get_precision('Account')),
47 }
48
49 _defaults = {
50 'discount': 0.0,
51 }
52
53 _sql_constraints = [
54 ('discount_limit', 'CHECK (discount <= 100.0)',
55 'Discount must be lower than 100%.'),
56 ]
57
58
59class PurchaseOrder(orm.Model):
60 _inherit = "purchase.order"
61
62 def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
63 res = {}
64 cur_obj = self.pool['res.currency']
65 tax_obj = self.pool['account.tax']
66 for order in self.browse(cr, uid, ids, context=context):
67 val = {}
68 amount_taxed = amount_untaxed = 0.0
69 currency = order.pricelist_id.currency_id
70 for line in order.order_line:
71 amount_untaxed += line.price_subtotal
72 discount = line.discount or 0.0
73 new_price_unit = line.price_unit * (1 - discount / 100.0)
74 for c in tax_obj.compute_all(cr, uid, line.taxes_id,
75 new_price_unit,
76 line.product_qty,
77 line.product_id.id,
78 order.partner_id)['taxes']:
79 amount_taxed += c.get('amount', 0.0)
80 val['amount_tax'] = cur_obj.round(cr, uid, currency, amount_taxed)
81 val['amount_untaxed'] = cur_obj.round(cr, uid, currency,
82 amount_untaxed)
83 val['amount_total'] = (val['amount_untaxed'] + val['amount_tax'])
84 res[order.id] = val
85 return res
86
87 def _prepare_inv_line(self, cr, uid, account_id, order_line,
88 context=None):
89 result = super(PurchaseOrder, self)._prepare_inv_line(cr, uid,
90 account_id,
91 order_line,
92 context)
93 result['discount'] = order_line.discount or 0.0
94 return result
95
96 def _get_order(self, cr, uid, ids, context=None):
97 result = set()
98 po_line_obj = self.pool['purchase.order.line']
99 for line in po_line_obj.browse(cr, uid, ids, context=context):
100 result.add(line.order_id.id)
101 return list(result)
102
103 _columns = {
104 'amount_untaxed': fields.function(
105 _amount_all, digits_compute=dp.get_precision('Account'),
106 string='Untaxed Amount',
107 store={
108 'purchase.order.line': (_get_order, None, 10),
109 }, multi="sums", help="The amount without tax"),
110 'amount_tax': fields.function(
111 _amount_all, digits_compute=dp.get_precision('Account'),
112 string='Taxes',
113 store={
114 'purchase.order.line': (_get_order, None, 10),
115 }, multi="sums", help="The tax amount"),
116 'amount_total': fields.function(
117 _amount_all, digits_compute=dp.get_precision('Account'),
118 string='Total',
119 store={
120 'purchase.order.line': (_get_order, None, 10),
121 }, multi="sums", help="The total amount"),
122 }
123
124
125class StockPicking(orm.Model):
126 _inherit = 'stock.picking'
127
128 def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
129 if move_line.purchase_line_id:
130 line = {'discount': move_line.purchase_line_id.discount}
131 self.pool['account.invoice.line'].write(cr, uid,
132 [invoice_line_id], line)
133 return super(StockPicking, self)._invoice_line_hook(cr, uid,
134 move_line,
135 invoice_line_id)
0136
=== added directory 'purchase_discount/report'
=== added file 'purchase_discount/report/order.rml'
--- purchase_discount/report/order.rml 1970-01-01 00:00:00 +0000
+++ purchase_discount/report/order.rml 2014-06-20 10:14:35 +0000
@@ -0,0 +1,365 @@
1<?xml version="1.0"?>
2<document filename="test.pdf">
3 <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
4 <pageTemplate id="first">
5 <frame id="first" x1="18.0" y1="42.0" width="535" height="758"/>
6 </pageTemplate>
7 </template>
8 <stylesheet>
9 <blockTableStyle id="Standard_Outline">
10 <blockAlignment value="LEFT"/>
11 <blockValign value="TOP"/>
12 </blockTableStyle>
13 <blockTableStyle id="Tableau1">
14 <blockAlignment value="LEFT"/>
15 <blockValign value="TOP"/>
16 </blockTableStyle>
17 <blockTableStyle id="Tableau2">
18 <blockAlignment value="LEFT"/>
19 <blockValign value="TOP"/>
20 </blockTableStyle>
21 <blockTableStyle id="Header_Order_Reference_Tbl">
22 <blockAlignment value="LEFT"/>
23 <blockValign value="TOP"/>
24 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
25 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
26 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
27 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
28 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
29 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
30 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
31 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
32 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
33 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
34 <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
35 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
36 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
37 </blockTableStyle>
38 <blockTableStyle id="Content_Order_Reference_Table">
39 <blockAlignment value="LEFT"/>
40 <blockValign value="TOP"/>
41 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
42 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
43 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
44 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
45 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
46 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
47 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
48 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
49 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
50 <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
51 <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
52 <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
53 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
54 </blockTableStyle>
55 <blockTableStyle id="Table_Header_Pur_ord_Line">
56 <blockAlignment value="LEFT"/>
57 <blockValign value="TOP"/>
58 <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
59 <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
60 <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
61 <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
62 <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
63 <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
64 <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
65 </blockTableStyle>
66 <blockTableStyle id="Table_Order_Pur_line_Content">
67 <blockAlignment value="LEFT"/>
68 <blockValign value="TOP"/>
69 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
70 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
71 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
72 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
73 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
74 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
75 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
76 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
77 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
78 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
79 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
80 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
81 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
82 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
83 </blockTableStyle>
84 <blockTableStyle id="Table_All_Total_Detail">
85 <blockAlignment value="LEFT"/>
86 <blockValign value="TOP"/>
87 <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
88 <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
89 <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
90 <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/>
91 <lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/>
92 </blockTableStyle>
93 <blockTableStyle id="Table_Outer_Notes">
94 <blockAlignment value="LEFT"/>
95 <blockValign value="TOP"/>
96 </blockTableStyle>
97 <initialize>
98 <paraStyle name="all" alignment="justify"/>
99 </initialize>
100 <paraStyle name="Standard" fontName="Helvetica"/>
101 <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
102 <paraStyle name="Header" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
103 <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
104 <paraStyle name="Table Contents" fontName="Helvetica"/>
105 <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
106 <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
107 <paraStyle name="Index" fontName="Helvetica"/>
108 <paraStyle name="Footer" fontName="Helvetica"/>
109 <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
110 <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
111 <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
112 <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
113 <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
114 <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
115 <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
116 <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
117 <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
118 <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
119 <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
120 <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
121 <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
122 <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
123 <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
124 <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
125 <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
126 <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
127 <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
128 <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
129 <paraStyle name="terp_default_Bold_9_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
130 <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
131 <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
132 <images/>
133 </stylesheet>
134 <story>
135 <para style="terp_default_8">[[repeatIn(objects,'o')]]</para>
136 <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
137 <para style="terp_default_9">
138 <font color="white"> </font>
139 </para>
140 <blockTable colWidths="253.0,59.0,223.0" style="Tableau1">
141 <tr>
142 <td>
143 <blockTable colWidths="253.0" style="Tableau2">
144 <tr>
145 <td>
146 <para style="terp_default_9">
147 <font color="white"> </font>
148 </para>
149 </td>
150 </tr>
151 <tr>
152 <td>
153 <para style="terp_default_9">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
154 <para style="terp_default_Bold_9">Shipping address :</para>
155 <para style="terp_default_9">[[ (o.dest_address_id and o.dest_address_id.name) or (o.warehouse_id and o.warehouse_id.name) or '']] </para>
156 <para style="terp_default_9">[[ (o.dest_address_id and display_address(o.dest_address_id)) or (o.warehouse_id and display_address(o.warehouse_id.partner_address_id)) or '']]</para>
157 </td>
158 </tr>
159 </blockTable>
160 <para style="terp_default_9">
161 <font color="white"> </font>
162 </para>
163 </td>
164 <td>
165 <para style="terp_default_9">
166 <font color="white"> </font>
167 </para>
168 </td>
169 <td>
170 <para style="terp_default_9">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]] </para>
171 <para style="terp_default_9">[[ o.partner_id and display_address(o.partner_id) ]] </para>
172 <para style="terp_default_9">Tél. : [[ (o.partner_address_id and o.partner_address_id.phone) or removeParentNode('para') ]]</para>
173 <para style="terp_default_9">Fax : [[ (o.partner_address_id and o.partner_address_id.fax) or removeParentNode('para') ]]</para>
174 <para style="terp_default_9">TVA : [[ (o.partner_id and o.partner_id.vat) or removeParentNode('para') ]]</para>
175 </td>
176 </tr>
177 </blockTable>
178 <para style="terp_default_9">
179 <font color="white"> </font>
180 </para>
181 <para style="terp_header">[[ o.state=='draft' and removeParentNode('para') ]] Purchase Order Confirmation N° [[ o.name ]]</para>
182 <para style="terp_header">[[ o.state&lt;&gt;'draft' and removeParentNode('para') ]] Request for Quotation N° [[ o.name ]]</para>
183 <para style="terp_default_8">
184 <font color="white"> </font>
185 </para>
186 <blockTable colWidths="136.0,132.0,133.0,133.0" style="Header_Order_Reference_Tbl">
187 <tr>
188 <td>
189 <para style="terp_tblheader_General_Centre">Our Order Reference</para>
190 </td>
191 <td>
192 <para style="terp_tblheader_General_Centre">Your Order Reference</para>
193 </td>
194 <td>
195 <para style="terp_tblheader_General_Centre">Order Date</para>
196 </td>
197 <td>
198 <para style="terp_tblheader_General_Centre">Validated By</para>
199 </td>
200 </tr>
201 </blockTable>
202 <blockTable colWidths="136.0,132.0,133.0,133.0" style="Content_Order_Reference_Table">
203 <tr>
204 <td>
205 <para style="terp_default_Centre_8">[[ o.name or '' ]]</para>
206 </td>
207 <td>
208 <para style="terp_default_Centre_8">[[ o.partner_ref or '' ]]</para>
209 </td>
210 <td>
211 <para style="terp_default_Centre_8">[[formatLang(o.date_order,date=True) ]]</para>
212 </td>
213 <td>
214 <para style="terp_default_Centre_8">[[ (o.validator and o.validator.name) or '' ]]</para>
215 </td>
216 </tr>
217 </blockTable>
218 <para style="terp_default_9">
219 <font color="white"> </font>
220 </para>
221 <blockTable colWidths="163.0,77.0,64.0,64.0,51.0,54.0,61.0" repeatRows="1" style="Table_Header_Pur_ord_Line">
222 <tr>
223 <td>
224 <para style="terp_tblheader_Details">Description</para>
225 </td>
226 <td>
227 <para style="terp_tblheader_Details">Taxes</para>
228 </td>
229 <td>
230 <para style="terp_tblheader_Details_Centre">Date Req.</para>
231 </td>
232 <td>
233 <para style="terp_tblheader_Details_Centre">Qty</para>
234 </td>
235 <td>
236 <para style="terp_tblheader_Details_Right">Unit Price</para>
237 </td>
238 <td>
239 <para style="terp_tblheader_Details_Right">% Discount</para>
240 </td>
241 <td>
242 <para style="terp_tblheader_Details_Right">Net Price</para>
243 </td>
244 </tr>
245 </blockTable>
246 <section>
247 <para style="terp_default_8">[[repeatIn(o.order_line,'line')]]</para>
248 <blockTable colWidths="162.0,77.0,64.0,64.0,51.0,54.0,61.0" style="Table_Order_Pur_line_Content">
249 <tr>
250 <td>
251 <para style="terp_default_9">[[ line.name ]]</para>
252 </td>
253 <td>
254 <para style="terp_default_9">[[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]]</para>
255 </td>
256 <td>
257 <para style="terp_default_Centre_9">[[ formatLang( line.date_planned, date=True) ]]</para>
258 </td>
259 <td>
260 <para style="terp_default_Right_9">[[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] </para>
261 </td>
262 <td>
263 <para style="terp_default_Right_9">[[ formatLang(line.price_unit, digits=get_digits(dp='Account') ) ]]</para>
264 </td>
265 <td>
266 <para style="terp_default_Right_9">[[ formatLang(line.discount, digits=get_digits(dp='Discount')) ]]</para>
267 </td>
268 <td>
269 <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
270 </td>
271 </tr>
272 <tr>
273 <td>
274 <para style="terp_default_8_Italic">[[ line.notes or removeParentNode('tr') ]]</para>
275 </td>
276 <td>
277 <para style="terp_default_9">
278 <font color="white"> </font>
279 </para>
280 </td>
281 <td>
282 <para style="terp_default_Centre_9">
283 <font color="white"> </font>
284 </para>
285 </td>
286 <td>
287 <para style="terp_default_Right_9">
288 <font color="white"> </font>
289 </para>
290 </td>
291 <td>
292 <para style="terp_default_Right_9">
293 <font color="white"> </font>
294 </para>
295 </td>
296 <td>
297 <para style="terp_default_Right_9">
298 <font color="white"> </font>
299 </para>
300 </td>
301 <td>
302 <para style="terp_default_Right_9">
303 <font color="white"> </font>
304 </para>
305 </td>
306 </tr>
307 </blockTable>
308 </section>
309 <blockTable colWidths="394.0,55.0,85.0" style="Table_All_Total_Detail">
310 <tr>
311 <td>
312 <para style="terp_default_9">
313 <font color="white"> </font>
314 </para>
315 </td>
316 <td>
317 <para style="terp_default_9">Net Total :</para>
318 </td>
319 <td>
320 <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
321 </td>
322 </tr>
323 <tr>
324 <td>
325 <para style="terp_default_9">
326 <font color="white"> </font>
327 </para>
328 </td>
329 <td>
330 <para style="terp_default_9">Taxes :</para>
331 </td>
332 <td>
333 <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
334 </td>
335 </tr>
336 <tr>
337 <td>
338 <para style="terp_default_9">
339 <font color="white"> </font>
340 </para>
341 </td>
342 <td>
343 <para style="terp_default_Bold_9">Total :</para>
344 </td>
345 <td>
346 <para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
347 </td>
348 </tr>
349 </blockTable>
350 <para style="terp_default_8">
351 <font color="white"> </font>
352 </para>
353 <blockTable colWidths="535.0" style="Table_Outer_Notes">
354 <tr>
355 <td>
356 <para style="terp_default_9">[[ format(o.notes or '') ]]</para>
357 </td>
358 </tr>
359 </blockTable>
360 <para style="terp_default_9">
361 <font color="white"> </font>
362 </para>
363 </story>
364</document>
365
0366
=== added file 'purchase_discount/report/order.sxw'
1Binary files purchase_discount/report/order.sxw 1970-01-01 00:00:00 +0000 and purchase_discount/report/order.sxw 2014-06-20 10:14:35 +0000 differ367Binary files purchase_discount/report/order.sxw 1970-01-01 00:00:00 +0000 and purchase_discount/report/order.sxw 2014-06-20 10:14:35 +0000 differ
=== added file 'purchase_discount/report/purchase_discount_report.xml'
--- purchase_discount/report/purchase_discount_report.xml 1970-01-01 00:00:00 +0000
+++ purchase_discount/report/purchase_discount_report.xml 2014-06-20 10:14:35 +0000
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <report id="purchase.report_purchase_order"
5 name="purchase.order"
6 string="Print Orders"
7 model="purchase.order"
8 rml="purchase_discount/report/order.rml"
9 />
10 </data>
11</openerp>
012
=== added directory 'purchase_discount/views'
=== added file 'purchase_discount/views/account_invoice_view.xml'
--- purchase_discount/views/account_invoice_view.xml 1970-01-01 00:00:00 +0000
+++ purchase_discount/views/account_invoice_view.xml 2014-06-20 10:14:35 +0000
@@ -0,0 +1,16 @@
1<openerp>
2<data>
3
4 <record id="invoice_supplier_form_discount" model="ir.ui.view">
5 <field name="name">account.invoice.supplier.form.discount</field>
6 <field name="model">account.invoice</field>
7 <field name="inherit_id" ref="account.invoice_supplier_form"/>
8 <field name="arch" type="xml">
9 <field name="price_unit" position="after">
10 <field name="discount"/>
11 </field>
12 </field>
13 </record>
14
15</data>
16</openerp>
017
=== added file 'purchase_discount/views/purchase_discount_view.xml'
--- purchase_discount/views/purchase_discount_view.xml 1970-01-01 00:00:00 +0000
+++ purchase_discount/views/purchase_discount_view.xml 2014-06-20 10:14:35 +0000
@@ -0,0 +1,35 @@
1<openerp>
2<data>
3 <record model="ir.ui.view" id="purchase_discount_order_line_form">
4 <field name="name">purchase_discount.order.line.form</field>
5 <field name="model">purchase.order.line</field>
6 <field name="inherit_id" ref="purchase.purchase_order_line_form"/>
7 <field name="arch" type="xml">
8 <field name="price_unit" position="after">
9 <field name="discount"/>
10 </field>
11 </field>
12 </record>
13 <record model="ir.ui.view" id="purchase_discount_order_line_tree">
14 <field name="name">purchase_discount.order.line.tree</field>
15 <field name="model">purchase.order.line</field>
16 <field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
17 <field name="arch" type="xml">
18 <field name="price_unit" position="after">
19 <field name="discount"/>
20 </field>
21 </field>
22 </record>
23
24 <record model="ir.ui.view" id="purchase_discount_order_form">
25 <field name="name">purchase.discount.order.form</field>
26 <field name="model">purchase.order</field>
27 <field name="inherit_id" ref="purchase.purchase_order_form"/>
28 <field name="arch" type="xml">
29 <xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="after">
30 <field name="discount"/>
31 </xpath>
32 </field>
33 </record>
34</data>
35</openerp>

Subscribers

People subscribed via source and target branches