Skip to content

Commit

Permalink
Merge 0bba326 into 56383df
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanRijnhart committed Aug 20, 2019
2 parents 56383df + 0bba326 commit d367d72
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 21 deletions.
61 changes: 46 additions & 15 deletions .travis.yml
@@ -1,38 +1,69 @@
language: python

python:
- "2.7"

sudo: false
cache: pip

python:
# For branches > 10.0, put `- "3.5"`
- "2.7.13"

addons:
# By default postgresql-9.1 is installed but there is issue related:
# https://github.com/OCA/maintainer-quality-tools/issues/432#issuecomment-281580935
# Better use higher PostgreSQL version
postgresql: "9.6"
apt:
# sources:
# Search your sources alias here:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow
- python-simplejson
- python-serial
# Search your packages here:
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
# For wkhtmltopdf, see the env section below

# Sometimes complicated website repos need Compass & SaSS:
#before_install:
# - rvm install ruby --latest
# - gem install bootstrap-sass
# - gem install compass --pre

env:
global:
- VERSION="10.0" TESTS="0" LINT_CHECK="0"
- VERSION="10.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
# Set this variable to some version existing as linux-generic build on
# https://github.com/wkhtmltopdf/wkhtmltopdf/releases
# if you need to install wkhtmltopdf
# - WKHTMLTOPDF_VERSION="0.12.5"
# Set the above to install a `wkhtmltopdf` version that is not the one provided
# by the `pov-wkhtmltopdf` repo.
# - PHANTOMJS_VERSION="latest"
# The above line controls the PhantomJS version that is used for JS testing.
# It is not necessary to include this value unless you are altering the default.
# Use `OS` to skip the PhantomJS upgrade & use the system version instead.
- WEBSITE_REPO="0"
# Use the above line to install dependencies that are required for website repos:
# * SASS & Bootstrap-SASS
# * Compass

matrix:
- LINT_CHECK="1"
# use this to install a standalone database to export .pot files
# - MAKEPOT="1"
# add MAKEPOT="1" to a TEST line to export .pot files from
# the test database after test success
- TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1"
- TESTS="1" ODOO_REPO="OCA/OCB"

virtualenv:
system_site_packages: true
# either use the two lines above or the two below. Don't change the default if
# it's not necessary (it is only necessary if modules in your repository can't
# be installed in the same database. And you get a huge speed penalty in your
# tests)
# - TESTS="1.0" ODOO_REPO="odoo/odoo" UNIT_TEST="1"
# - TESTS="1.0" ODOO_REPO="OCA/OCB" UNIT_TEST="1"

install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- git clone https://github.com/OCA/bank-payment.git -b ${VERSION} ${HOME}/bank-payment
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- pip install unidecode
- travis_install_nightly
- pip install anybox.testing.openerp # needed for testing account_invoice_line_sort

script:
- travis_run_tests
Expand Down
Expand Up @@ -20,6 +20,8 @@ def setUp(self):
self.product2 = self.env.ref('product.product_delivery_01')
self.prod_account = self.env.ref('account.demo_coffee_machine_account')
unit = self.env.ref('product.product_uom_unit')
self.currency = self.env.ref('base.GBP')
self.journal.write({'currency_id': self.currency.id})

self.invoice = self.invoice_model.create(
{'journal_id': self.journal.id,
Expand Down Expand Up @@ -81,6 +83,7 @@ def test_with_update_pricelist_supplierinfo_on_product_template(self):
product_id.product_tmpl_id.id),
])
self.assertEquals(len(supplierinfos1), 1)
self.assertEqual(supplierinfos1.currency_id, self.currency)

self.assertEquals(supplierinfos1.price, 400.0)

Expand Down
Expand Up @@ -33,11 +33,9 @@ def update_supplierinfo(self):
supplierinfo = line.supplierinfo_id
# Create supplierinfo if not exist
if not supplierinfo:
supplierinfo_vals = line._prepare_supplierinfo()
supplierinfo = supplierinfo_obj.create(supplierinfo_vals)
supplierinfo_obj.create(line._prepare_supplierinfo())
else:
supplierinfo.price = line.new_price
supplierinfo.min_qty = line.new_min_quantity
supplierinfo.write(line._prepare_supplierinfo_update())

# Mark the invoice as checked
self.invoice_id.write({'supplierinfo_ok': True})
Expand Down
Expand Up @@ -57,10 +57,18 @@ def _compute_price_variation(self):
@api.multi
def _prepare_supplierinfo(self):
self.ensure_one()
return {
vals = {
'product_tmpl_id': self.product_id.product_tmpl_id.id,
'name': self.wizard_id.invoice_id.supplier_partner_id.id,
'delay': 1,
}
vals.update(self._prepare_supplierinfo_update())
return vals

def _prepare_supplierinfo_update(self):
self.ensure_one()
return {
'min_qty': 0.0,
'price': self.new_price,
'delay': 1,
'currency_id': self.wizard_id.invoice_id.currency_id.id,
}

0 comments on commit d367d72

Please sign in to comment.