0

OpenERP製品ラベルを印刷するためにAerooレポートを書いています。

商品の名前、説明、画像、バーコードを印刷できましたが、価格に問題があります。製品の基本価格を税金なしで印刷できます。

<o.price>

しかし、税金と税金額も含めて価格を印刷する必要があります。どうすればこれを達成できますか?

編集:これは機能しますが、より良い方法である必要があります:

<o.list_price * ( 1 + sum([t.amount for t in o.taxes_id]))>

割引は考慮されていません

ありがとう、Lluís

4

1 に答える 1

1

モジュールの作成と、tax.compute_allを使用するproduct_productへのpvpメソッドの追加を解決しました

from osv import fields, osv

class product_product(osv.osv):
    _name = "product.product"
    _inherit = "product.product"

    def _pvp(self, cr, uid, ids, field_name, arg, context=None):
        """Return calculated PVP with taxes
        """
        res = {}
        tax_obj = self.pool.get('account.tax')
        for product in self.browse(cr, uid, ids, context):
            t = tax_obj.compute_all(cr, uid, product.taxes_id, product.list_price, 1)['total_included']
            res[product.id] = "{0:.2f}".format(t)
        return res

    _columns = {
        'pvp': fields.function(_pvp, type="string", method=True, string="PVP"),  # calculates PVP with taxes
    }

product_product()
于 2013-03-22T13:24:00.983 に答える