openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #07304
Re: [Merge] lp:~pedro.baeza/purchase-wkfl/7.0-purchase_discount into lp:purchase-wkfl
Review: Needs Fixing
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
Diff comments:
> === 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-05-13 08:16:14 +0000
> @@ -0,0 +1,22 @@
> +# -*- encoding: utf-8 -*-
> +##############################################################################
> +#
> +# OpenERP, Open Source Management Solution
> +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU Affero General Public License as
> +# published by the Free Software Foundation, either version 3 of the
> +# License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU Affero General Public License for more details.
> +#
> +# You should have received a copy of the GNU Affero General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +##############################################################################
> +from . import purchase_discount
> +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
>
> === added file 'purchase_discount/__openerp__.py'
> --- purchase_discount/__openerp__.py 1970-01-01 00:00:00 +0000
> +++ purchase_discount/__openerp__.py 2014-05-13 08:16:14 +0000
> @@ -0,0 +1,48 @@
> +# -*- encoding: utf-8 -*-
> +##############################################################################
> +#
> +# OpenERP, Open Source Management Solution
> +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU Affero General Public License as
> +# published by the Free Software Foundation, either version 3 of the
> +# License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU Affero General Public License for more details.
> +#
> +# You should have received a copy of the GNU Affero General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +##############################################################################
> +{
> + "name": "Purchase order lines with discounts",
> + "author": "Tiny, Acysos S.L.",
> + "description": """It allows to define a discount per line in the purchase
> +orders. This discount can be also negative, interpreting it as an increment.
> +
> +**Contributors**:
> + * Pedro Manuel Baeza <pedro.baeza@xxxxxxxxxxxxxxxxxx>
> + """,
> + "version": "1.0",
> + "contributors": [
> + 'Pedro M. Baeza',
> + ],
> + "category": "Generic Modules/Sales & Purchases",
> + "depends": [
> + "stock",
> + "purchase",
> + ],
> + "demo": [],
> + "data": [
> + "purchase_discount_view.xml",
> + "account_invoice_view.xml",
> + "report/purchase_discount_report.xml",
> + ],
> + "license": 'AGPL-3',
> + "installable": True
> +}
> +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
>
> === added file 'purchase_discount/account_invoice_view.xml'
> --- purchase_discount/account_invoice_view.xml 1970-01-01 00:00:00 +0000
> +++ purchase_discount/account_invoice_view.xml 2014-05-13 08:16:14 +0000
> @@ -0,0 +1,17 @@
> +<openerp>
> +<data>
> +
> + <record id="invoice_supplier_form_discount" model="ir.ui.view">
> + <field name="name">account.invoice.supplier.form.discount</field>
> + <field name="model">account.invoice</field>
> + <field name="type">form</field>
> + <field name="inherit_id" ref="account.invoice_supplier_form"/>
> + <field name="arch" type="xml">
> + <field name="price_unit" position="after">
> + <field name="discount"/>
> + </field>
> + </field>
> + </record>
> +
> +</data>
> +</openerp>
>
> === 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-05-13 08:16:14 +0000
> @@ -0,0 +1,43 @@
> +# Translation of OpenERP Server.
> +# This file contains the translation of the following modules:
> +# * purchase_discount
> +#
> +msgid ""
> +msgstr ""
> +"Project-Id-Version: OpenERP Server 5.0.11\n"
> +"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
> +"POT-Creation-Date: 2013-11-07 01:07+0000\n"
> +"PO-Revision-Date: 2013-11-08 17:57+0000\n"
> +"Last-Translator: hbto [Vauxoo] http://www.vauxoo.com "
> +"<humbertoarocha@xxxxxxxxx>\n"
> +"Language-Team: \n"
> +"MIME-Version: 1.0\n"
> +"Content-Type: text/plain; charset=UTF-8\n"
> +"Content-Transfer-Encoding: 8bit\n"
> +"X-Launchpad-Export-Date: 2014-01-29 06:04+0000\n"
> +"X-Generator: Launchpad (build 16916)\n"
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order
> +msgid "Purchase Order"
> +msgstr "Orden de Compra"
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_stock_picking
> +msgid "Picking List"
> +msgstr "Albarán"
> +
> +#. module: purchase_discount
> +#: sql_constraint:purchase.order.line:0
> +msgid "Discount must be lower than 100%."
> +msgstr "El desduento debe ser menor al 100%."
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order_line
> +msgid "Purchase Order Line"
> +msgstr "Línea orden de compra"
> +
> +#. module: purchase_discount
> +#: field:purchase.order.line,discount:0
> +msgid "Discount (%)"
> +msgstr "(%) Descuento"
>
> === 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-05-13 08:16:14 +0000
> @@ -0,0 +1,43 @@
> +# Translation of OpenERP Server.
> +# This file contains the translation of the following modules:
> +# * purchase_discount
> +#
> +msgid ""
> +msgstr ""
> +"Project-Id-Version: OpenERP Server 5.0.11\n"
> +"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
> +"POT-Creation-Date: 2013-11-07 01:07+0000\n"
> +"PO-Revision-Date: 2013-11-07 04:36+0000\n"
> +"Last-Translator: Moisés López - http://www.vauxoo.com "
> +"<moylop260@xxxxxxxxxx>\n"
> +"Language-Team: \n"
> +"MIME-Version: 1.0\n"
> +"Content-Type: text/plain; charset=UTF-8\n"
> +"Content-Transfer-Encoding: 8bit\n"
> +"X-Launchpad-Export-Date: 2014-01-29 06:04+0000\n"
> +"X-Generator: Launchpad (build 16916)\n"
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order
> +msgid "Purchase Order"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_stock_picking
> +msgid "Picking List"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: sql_constraint:purchase.order.line:0
> +msgid "Discount must be lower than 100%."
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order_line
> +msgid "Purchase Order Line"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: field:purchase.order.line,discount:0
> +msgid "Discount (%)"
> +msgstr "(%) Descuento"
>
> === 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-05-13 08:16:14 +0000
> @@ -0,0 +1,43 @@
> +# Brazilian Portuguese translation for addons-vauxoo
> +# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013
> +# This file is distributed under the same license as the addons-vauxoo package.
> +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
> +#
> +msgid ""
> +msgstr ""
> +"Project-Id-Version: addons-vauxoo\n"
> +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
> +"POT-Creation-Date: 2013-11-07 01:07+0000\n"
> +"PO-Revision-Date: 2013-07-28 13:28+0000\n"
> +"Last-Translator: Claudio de Araujo Santos <claudioaraujosantos@xxxxxxxxx>\n"
> +"Language-Team: Brazilian Portuguese <pt_BR@xxxxxx>\n"
> +"MIME-Version: 1.0\n"
> +"Content-Type: text/plain; charset=UTF-8\n"
> +"Content-Transfer-Encoding: 8bit\n"
> +"X-Launchpad-Export-Date: 2014-01-29 06:04+0000\n"
> +"X-Generator: Launchpad (build 16916)\n"
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order
> +msgid "Purchase Order"
> +msgstr "Ordem de Compra"
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_stock_picking
> +msgid "Picking List"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: sql_constraint:purchase.order.line:0
> +msgid "Discount must be lower than 100%."
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order_line
> +msgid "Purchase Order Line"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: field:purchase.order.line,discount:0
> +msgid "Discount (%)"
> +msgstr "Desconto (%)"
>
> === 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-05-13 08:16:14 +0000
> @@ -0,0 +1,42 @@
> +# Translation of OpenERP Server.
> +# This file contains the translation of the following modules:
> +# * purchase_discount
> +#
> +msgid ""
> +msgstr ""
> +"Project-Id-Version: OpenERP Server 7.0\n"
> +"Report-Msgid-Bugs-To: \n"
> +"POT-Creation-Date: 2013-11-07 01:07+0000\n"
> +"PO-Revision-Date: 2013-11-07 01:07+0000\n"
> +"Last-Translator: <>\n"
> +"Language-Team: \n"
> +"MIME-Version: 1.0\n"
> +"Content-Type: text/plain; charset=UTF-8\n"
> +"Content-Transfer-Encoding: \n"
> +"Plural-Forms: \n"
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order
> +msgid "Purchase Order"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_stock_picking
> +msgid "Picking List"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: sql_constraint:purchase.order.line:0
> +msgid "Discount must be lower than 100%."
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: model:ir.model,name:purchase_discount.model_purchase_order_line
> +msgid "Purchase Order Line"
> +msgstr ""
> +
> +#. module: purchase_discount
> +#: field:purchase.order.line,discount:0
> +msgid "Discount (%)"
> +msgstr ""
> +
>
> === added file 'purchase_discount/purchase_discount.py'
> --- purchase_discount/purchase_discount.py 1970-01-01 00:00:00 +0000
> +++ purchase_discount/purchase_discount.py 2014-05-13 08:16:14 +0000
> @@ -0,0 +1,138 @@
> +# -*- encoding: utf-8 -*-
> +##############################################################################
> +#
> +# OpenERP, Open Source Management Solution
> +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU Affero General Public License as
> +# published by the Free Software Foundation, either version 3 of the
> +# License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU Affero General Public License for more details.
> +#
> +# You should have received a copy of the GNU Affero General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +##############################################################################
> +from openerp.osv import fields, orm
> +import openerp.addons.decimal_precision as dp
> +
> +
> +class purchase_order_line(orm.Model):
> + _inherit = "purchase.order.line"
> +
> + def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
> + res = {}
> + cur_obj = self.pool['res.currency']
> + tax_obj = self.pool['account.tax']
> + for line in self.browse(cr, uid, ids, context=context):
> + discount = line.discount or 0.0
> + new_price_unit = line.price_unit * (1 - discount / 100.0)
> + taxes = tax_obj.compute_all(cr, uid, line.taxes_id, new_price_unit,
> + line.product_qty, line.product_id,
> + line.order_id.partner_id)
> + currency = line.order_id.pricelist_id.currency_id
> + res[line.id] = cur_obj.round(cr, uid, currency, taxes['total'])
> + return res
> +
> + _columns = {
> + 'discount': fields.float('Discount (%)', digits=(16, 2)),
It should use the 'Discount' decimal precision
> + 'price_subtotal': fields.function(
> + _amount_line, string='Subtotal',
> + digits_compute=dp.get_precision('Account')),
> + }
> +
> + _defaults = {
> + 'discount': 0.0,
> + }
> +
> + _sql_constraints = [
> + ('discount_limit', 'CHECK (discount <= 100.0)',
> + 'Discount must be lower than 100%.'),
> + ]
> +
> +
> +class purchase_order(orm.Model):
> + _inherit = "purchase.order"
> +
> + def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
> + res = {}
> + cur_obj = self.pool['res.currency']
> + tax_obj = self.pool['account.tax']
> + for order in self.browse(cr, uid, ids, context=context):
> + val = {}
> + amount_taxed = amount_untaxed = 0.0
> + currency = order.pricelist_id.currency_id
> + for line in order.order_line:
> + amount_untaxed += line.price_subtotal
> + discount = line.discount or 0.0
> + new_price_unit = line.price_unit * (1 - discount / 100.0)
> + for c in tax_obj.compute_all(cr, uid, line.taxes_id,
> + new_price_unit,
> + line.product_qty,
> + line.product_id.id,
> + order.partner_id)['taxes']:
> + amount_taxed += c.get('amount', 0.0)
> + val['amount_tax'] = cur_obj.round(cr, uid, currency, amount_taxed)
> + val['amount_untaxed'] = cur_obj.round(cr, uid, currency,
> + amount_untaxed)
> + val['amount_total'] = (val['amount_untaxed'] + val['amount_tax'])
> + res[order.id] = val
> + return res
> +
> + def _prepare_inv_line(self, cr, uid, account_id, order_line,
> + context=None):
> + result = super(purchase_order, self)._prepare_inv_line(cr, uid,
> + account_id,
> + order_line,
> + context)
> + result['discount'] = order_line.discount or 0.0
> + return result
> +
> + def _get_order(self, cr, uid, ids, context=None):
> + result = set()
> + po_line_obj = self.pool['purchase.order.line']
> + for line in po_line_obj.browse(cr, uid, ids, context=context):
> + result.add(line.order_id.id)
> + return list(result)
> +
> + _columns = {
> + 'amount_untaxed': fields.function(
> + _amount_all, method=True,
'method' kwarg is deprecated (same remark for the fields below)
> + digits_compute=dp.get_precision('Account'),
> + string='Untaxed Amount',
> + store={
> + 'purchase.order.line': (_get_order, None, 10),
> + }, multi="sums", help="The amount without tax"),
> + 'amount_tax': fields.function(
> + _amount_all, method=True,
> + digits_compute=dp.get_precision('Account'), string='Taxes',
> + store={
> + 'purchase.order.line': (_get_order, None, 10),
> + }, multi="sums", help="The tax amount"),
> + 'amount_total': fields.function(
> + _amount_all, method=True,
> + digits_compute=dp.get_precision('Account'), string='Total',
> + store={
> + 'purchase.order.line': (_get_order, None, 10),
> + }, multi="sums", help="The total amount"),
> + }
> +
> +
> +class stock_picking(orm.Model):
> + _inherit = 'stock.picking'
> +
> + def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
> + if move_line.purchase_line_id:
> + line = {'discount': move_line.purchase_line_id.discount}
> + self.pool['account.invoice.line'].write(cr, uid,
> + [invoice_line_id], line)
> + return super(stock_picking, self)._invoice_line_hook(cr, uid,
> + move_line,
> + invoice_line_id)
> +
> +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
>
> === added file 'purchase_discount/purchase_discount_view.xml'
> --- purchase_discount/purchase_discount_view.xml 1970-01-01 00:00:00 +0000
> +++ purchase_discount/purchase_discount_view.xml 2014-05-13 08:16:14 +0000
> @@ -0,0 +1,38 @@
> +<openerp>
> +<data>
> + <record model="ir.ui.view" id="purchase_discount_order_line_form">
> + <field name="name">purchase_discount.order.line.form</field>
> + <field name="model">purchase.order.line</field>
> + <field name="type">form</field>
'type' is deprecated (same for the views below)
> + <field name="inherit_id" ref="purchase.purchase_order_line_form"/>
> + <field name="arch" type="xml">
> + <field name="price_unit" position="after">
> + <field name="discount"/>
> + </field>
> + </field>
> + </record>
> + <record model="ir.ui.view" id="purchase_discount_order_line_tree">
> + <field name="name">purchase_discount.order.line.tree</field>
> + <field name="model">purchase.order.line</field>
> + <field name="type">tree</field>
> + <field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
> + <field name="arch" type="xml">
> + <field name="price_unit" position="after">
> + <field name="discount"/>
> + </field>
> + </field>
> + </record>
> +
> + <record model="ir.ui.view" id="purchase_discount_order_form">
> + <field name="name">purchase.discount.order.form</field>
> + <field name="model">purchase.order</field>
> + <field name="type">form</field>
> + <field name="inherit_id" ref="purchase.purchase_order_form"/>
> + <field name="arch" type="xml">
> + <xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="after">
> + <field name="discount"/>
> + </xpath>
> + </field>
> + </record>
> +</data>
> +</openerp>
>
> === 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-05-13 08:16:14 +0000
> @@ -0,0 +1,365 @@
> +<?xml version="1.0"?>
> +<document filename="test.pdf">
> + <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
> + <pageTemplate id="first">
> + <frame id="first" x1="18.0" y1="42.0" width="535" height="758"/>
> + </pageTemplate>
> + </template>
> + <stylesheet>
> + <blockTableStyle id="Standard_Outline">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + </blockTableStyle>
> + <blockTableStyle id="Tableau1">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + </blockTableStyle>
> + <blockTableStyle id="Tableau2">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + </blockTableStyle>
> + <blockTableStyle id="Header_Order_Reference_Tbl">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
> + <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
> + </blockTableStyle>
> + <blockTableStyle id="Content_Order_Reference_Table">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
> + <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
> + </blockTableStyle>
> + <blockTableStyle id="Table_Header_Pur_ord_Line">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
> + </blockTableStyle>
> + <blockTableStyle id="Table_Order_Pur_line_Content">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
> + </blockTableStyle>
> + <blockTableStyle id="Table_All_Total_Detail">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
> + <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
> + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
> + <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/>
> + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/>
> + </blockTableStyle>
> + <blockTableStyle id="Table_Outer_Notes">
> + <blockAlignment value="LEFT"/>
> + <blockValign value="TOP"/>
> + </blockTableStyle>
> + <initialize>
> + <paraStyle name="all" alignment="justify"/>
> + </initialize>
> + <paraStyle name="Standard" fontName="Helvetica"/>
> + <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
> + <paraStyle name="Header" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
> + <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
> + <paraStyle name="Table Contents" fontName="Helvetica"/>
> + <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
> + <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="Index" fontName="Helvetica"/>
> + <paraStyle name="Footer" fontName="Helvetica"/>
> + <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
> + <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
> + <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
> + <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_Bold_9_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
> + <images/>
> + </stylesheet>
> + <story>
> + <para style="terp_default_8">[[repeatIn(objects,'o')]]</para>
> + <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + <blockTable colWidths="253.0,59.0,223.0" style="Tableau1">
> + <tr>
> + <td>
> + <blockTable colWidths="253.0" style="Tableau2">
> + <tr>
> + <td>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + </tr>
> + <tr>
> + <td>
> + <para style="terp_default_9">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
> + <para style="terp_default_Bold_9">Shipping address :</para>
> + <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>
> + <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>
> + </td>
> + </tr>
> + </blockTable>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <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>
> + <para style="terp_default_9">[[ o.partner_id and display_address(o.partner_id) ]] </para>
> + <para style="terp_default_9">Tél. : [[ (o.partner_address_id and o.partner_address_id.phone) or removeParentNode('para') ]]</para>
> + <para style="terp_default_9">Fax : [[ (o.partner_address_id and o.partner_address_id.fax) or removeParentNode('para') ]]</para>
> + <para style="terp_default_9">TVA : [[ (o.partner_id and o.partner_id.vat) or removeParentNode('para') ]]</para>
> + </td>
> + </tr>
> + </blockTable>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + <para style="terp_header">[[ o.state=='draft' and removeParentNode('para') ]] Purchase Order Confirmation N° [[ o.name ]]</para>
> + <para style="terp_header">[[ o.state<>'draft' and removeParentNode('para') ]] Request for Quotation N° [[ o.name ]]</para>
> + <para style="terp_default_8">
> + <font color="white"> </font>
> + </para>
> + <blockTable colWidths="136.0,132.0,133.0,133.0" style="Header_Order_Reference_Tbl">
> + <tr>
> + <td>
> + <para style="terp_tblheader_General_Centre">Our Order Reference</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_General_Centre">Your Order Reference</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_General_Centre">Order Date</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_General_Centre">Validated By</para>
> + </td>
> + </tr>
> + </blockTable>
> + <blockTable colWidths="136.0,132.0,133.0,133.0" style="Content_Order_Reference_Table">
> + <tr>
> + <td>
> + <para style="terp_default_Centre_8">[[ o.name or '' ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_Centre_8">[[ o.partner_ref or '' ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_Centre_8">[[formatLang(o.date_order,date=True) ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_Centre_8">[[ (o.validator and o.validator.name) or '' ]]</para>
> + </td>
> + </tr>
> + </blockTable>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + <blockTable colWidths="163.0,77.0,64.0,64.0,51.0,54.0,61.0" repeatRows="1" style="Table_Header_Pur_ord_Line">
> + <tr>
> + <td>
> + <para style="terp_tblheader_Details">Description</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_Details">Taxes</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_Details_Centre">Date Req.</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_Details_Centre">Qty</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_Details_Right">Unit Price</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_Details_Right">% Discount</para>
> + </td>
> + <td>
> + <para style="terp_tblheader_Details_Right">Net Price</para>
> + </td>
> + </tr>
> + </blockTable>
> + <section>
> + <para style="terp_default_8">[[repeatIn(o.order_line,'line')]]</para>
> + <blockTable colWidths="162.0,77.0,64.0,64.0,51.0,54.0,61.0" style="Table_Order_Pur_line_Content">
> + <tr>
> + <td>
> + <para style="terp_default_9">[[ line.name ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_9">[[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_Centre_9">[[ formatLang( line.date_planned, date=True) ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">[[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] </para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">[[ formatLang(line.price_unit, digits=get_digits(dp='Account') ) ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">[[ '%.2f'%line.discount ]]</para>
should use formatLang with 'Discount' dp.
> + </td>
> + <td>
> + <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
> + </td>
> + </tr>
> + <tr>
> + <td>
> + <para style="terp_default_8_Italic">[[ line.notes or removeParentNode('tr') ]]</para>
> + </td>
> + <td>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_Centre_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + </tr>
> + </blockTable>
> + </section>
> + <blockTable colWidths="394.0,55.0,85.0" style="Table_All_Total_Detail">
> + <tr>
> + <td>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_9">Net Total :</para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
> + </td>
> + </tr>
> + <tr>
> + <td>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_9">Taxes :</para>
> + </td>
> + <td>
> + <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
> + </td>
> + </tr>
> + <tr>
> + <td>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </td>
> + <td>
> + <para style="terp_default_Bold_9">Total :</para>
> + </td>
> + <td>
> + <para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total, digits=get_digits(dp='Account') ) ]] [[ o.pricelist_id.currency_id. symbol ]]</para>
> + </td>
> + </tr>
> + </blockTable>
> + <para style="terp_default_8">
> + <font color="white"> </font>
> + </para>
> + <blockTable colWidths="535.0" style="Table_Outer_Notes">
> + <tr>
> + <td>
> + <para style="terp_default_9">[[ format(o.notes or '') ]]</para>
> + </td>
> + </tr>
> + </blockTable>
> + <para style="terp_default_9">
> + <font color="white"> </font>
> + </para>
> + </story>
> +</document>
> +
>
> === added file 'purchase_discount/report/order.sxw'
> Binary files purchase_discount/report/order.sxw 1970-01-01 00:00:00 +0000 and purchase_discount/report/order.sxw 2014-05-13 08:16:14 +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-05-13 08:16:14 +0000
> @@ -0,0 +1,11 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<openerp>
> + <data>
> + <report id="purchase.report_purchase_order"
> + name="purchase.order"
> + string="Print Orders"
> + model="purchase.order"
> + rml="purchase_discount/report/order.rml"
> + />
> + </data>
> +</openerp>
>
--
https://code.launchpad.net/~pedro.baeza/purchase-wkfl/7.0-purchase_discount/+merge/217030
Your team Purchase Core Editors is subscribed to branch lp:purchase-wkfl.
References