{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/14054","repository_url":"https://api.github.com/repos/odoo/odoo","labels_url":"https://api.github.com/repos/odoo/odoo/issues/14054/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/14054/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/14054/events","html_url":"https://github.com/odoo/odoo/issues/14054","id":185936837,"number":14054,"title":"Version 9 Purchase modul has wrong rounding","user":{"login":"Derter","id":14194754,"avatar_url":"https://avatars.githubusercontent.com/u/14194754?v=3","gravatar_id":"","url":"https://api.github.com/users/Derter","html_url":"https://github.com/Derter","followers_url":"https://api.github.com/users/Derter/followers","following_url":"https://api.github.com/users/Derter/following{/other_user}","gists_url":"https://api.github.com/users/Derter/gists{/gist_id}","starred_url":"https://api.github.com/users/Derter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Derter/subscriptions","organizations_url":"https://api.github.com/users/Derter/orgs","repos_url":"https://api.github.com/users/Derter/repos","events_url":"https://api.github.com/users/Derter/events{/privacy}","received_events_url":"https://api.github.com/users/Derter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"qdp-odoo","id":7628598,"avatar_url":"https://avatars.githubusercontent.com/u/7628598?v=3","gravatar_id":"","url":"https://api.github.com/users/qdp-odoo","html_url":"https://github.com/qdp-odoo","followers_url":"https://api.github.com/users/qdp-odoo/followers","following_url":"https://api.github.com/users/qdp-odoo/following{/other_user}","gists_url":"https://api.github.com/users/qdp-odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/qdp-odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qdp-odoo/subscriptions","organizations_url":"https://api.github.com/users/qdp-odoo/orgs","repos_url":"https://api.github.com/users/qdp-odoo/repos","events_url":"https://api.github.com/users/qdp-odoo/events{/privacy}","received_events_url":"https://api.github.com/users/qdp-odoo/received_events","type":"User","site_admin":false},"assignees":[{"login":"qdp-odoo","id":7628598,"avatar_url":"https://avatars.githubusercontent.com/u/7628598?v=3","gravatar_id":"","url":"https://api.github.com/users/qdp-odoo","html_url":"https://github.com/qdp-odoo","followers_url":"https://api.github.com/users/qdp-odoo/followers","following_url":"https://api.github.com/users/qdp-odoo/following{/other_user}","gists_url":"https://api.github.com/users/qdp-odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/qdp-odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qdp-odoo/subscriptions","organizations_url":"https://api.github.com/users/qdp-odoo/orgs","repos_url":"https://api.github.com/users/qdp-odoo/repos","events_url":"https://api.github.com/users/qdp-odoo/events{/privacy}","received_events_url":"https://api.github.com/users/qdp-odoo/received_events","type":"User","site_admin":false}],"milestone":null,"comments":23,"created_at":"2016-10-28T14:25:53Z","updated_at":"2016-11-29T22:03:45Z","closed_at":"2016-11-25T16:21:19Z","body":"Impacted versions: 9 \n\nSteps to reproduce: taxes 19% not in price included, make a vendor bill, put one product with for exp. 707,02 and one with 66,39 \n\nCurrent behavior: 707,02+66,39*1,19=920,3579 price to pay: 920,35\n\nExpected behavior: 920,3579 should be price to pay 920,36\n\nVideo/Screenshot link (optional): \n![bildschirmfoto 2016-10-28 um 16 23 03](https://cloud.githubusercontent.com/assets/14194754/19809730/d5cac0ee-9d2a-11e6-920e-98bb49ed8b0b.png)\n"},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/263714328","html_url":"https://github.com/odoo/odoo/issues/14054#issuecomment-263714328","issue_url":"https://api.github.com/repos/odoo/odoo/issues/14054","id":263714328,"user":{"login":"gdgellatly","id":5093264,"avatar_url":"https://avatars.githubusercontent.com/u/5093264?v=3","gravatar_id":"","url":"https://api.github.com/users/gdgellatly","html_url":"https://github.com/gdgellatly","followers_url":"https://api.github.com/users/gdgellatly/followers","following_url":"https://api.github.com/users/gdgellatly/following{/other_user}","gists_url":"https://api.github.com/users/gdgellatly/gists{/gist_id}","starred_url":"https://api.github.com/users/gdgellatly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdgellatly/subscriptions","organizations_url":"https://api.github.com/users/gdgellatly/orgs","repos_url":"https://api.github.com/users/gdgellatly/repos","events_url":"https://api.github.com/users/gdgellatly/events{/privacy}","received_events_url":"https://api.github.com/users/gdgellatly/received_events","type":"User","site_admin":false},"created_at":"2016-11-29T22:03:45Z","updated_at":"2016-11-29T22:03:45Z","body":"@wtaferner \r\n\r\nThis is our code for rounding per supplier.  It expects round globally set as company policy, but you get the idea, just intercept precision and adjust.\r\n\r\n```python\r\nfrom openerp.osv import orm, fields\r\n\r\n\r\nclass AccountTax(orm.Model):\r\n    _inherit = 'account.tax'\r\n\r\n    def check_supplier_tax_precision(self, cr, uid, taxes, partner, precision):\r\n        \"\"\"\r\n\r\n        :param cr:\r\n        :param uid:\r\n        :param taxes: list of tax objects\r\n        :param partner: res.partner object\r\n        :param precision: integer representing rounding precision\r\n        :return:\r\n        \"\"\"\r\n        if precision is None:\r\n            precision = self.pool['decimal.precision'].precision_get(\r\n                cr, uid, 'Account')\r\n        for tax in taxes:\r\n            if (tax.type_tax_use == 'purchase' and partner and\r\n                    partner.tax_calc_method == 'round_per_line'):\r\n                precision = self.pool['decimal.precision'].precision_get(cr,\r\n                    uid, 'Account')\r\n                break\r\n        return precision\r\n\r\n    def compute_inv(self, cr, uid, taxes, price_unit, quantity, product=None,\r\n                    partner=None, precision=None):\r\n        \"\"\"\r\n\r\n        :param cr:\r\n        :param uid:\r\n        :param taxes: list of tax objects\r\n        :param price_unit:\r\n        :param quantity:\r\n        :param product:\r\n        :param partner: res.partner object\r\n        :param precision: integer representing rounding precision\r\n        :return: [ tax ]\r\n            tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2}\r\n            one tax for each tax id in IDS and their children\r\n        \"\"\"\r\n        precision = self.check_supplier_tax_precision(cr, uid, taxes, partner,\r\n                                                      precision)\r\n        return super(AccountTax, self).compute_inv(\r\n            cr, uid, taxes, price_unit, quantity, product=product,\r\n            partner=partner, precision=precision)\r\n\r\n    def _compute(self, cr, uid, taxes, price_unit, quantity, product=None,\r\n                 partner=None, precision=None):\r\n        \"\"\"\r\n\r\n        :param cr:\r\n        :param uid:\r\n        :param taxes: list of tax objects\r\n        :param price_unit:\r\n        :param quantity:\r\n        :param product:\r\n        :param partner: res.partner object\r\n        :param precision: integer representing rounding precision\r\n        :return: [ tax ]\r\n            tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2}\r\n            one tax for each tax id in IDS and their children\r\n        \"\"\"\r\n        precision = self.check_supplier_tax_precision(cr, uid, taxes, partner,\r\n                                                      precision)\r\n        return super(AccountTax, self)._compute(cr, uid, taxes, price_unit,\r\n            quantity, product=product, partner=partner, precision=precision)\r\n\r\n\r\nclass ResPartner(orm.Model):\r\n    _inherit = \"res.partner\"\r\n\r\n    _columns = {\r\n        'tax_calc_method': fields.selection(\r\n            [('round_per_line', 'Round per Line'),\r\n             ('round_globally', 'Round Globally'), ],\r\n            'Tax Calculation Rounding Method',\r\n            help=\"If you select 'Round per Line' : for each tax, the tax \"\r\n                 \"amount will first be computed and rounded for each \"\r\n                 \"PO/SO/invoice line and then these rounded amounts will be \"\r\n                 \"summed, leading to the total amount for that tax. If you \"\r\n                 \"select 'Round Globally': for each tax, the tax amount will \"\r\n                 \"be computed for each PO/SO/invoice line, then these amounts \"\r\n                 \"will be summed and eventually this total tax amount will be \"\r\n                 \"rounded. If you sell with tax included, you should choose \"\r\n                 \"'Round per line' because you certainly want the sum of your \"\r\n                 \"tax-included line subtotals to be equal to the total amount \"\r\n                 \"with taxes.\"),\r\n        }\r\n```"}}
{"actor":{"display_login":"gdgellatly"}}