Skip to content

modify to be integrated with Odoo v8, just for test #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions magento.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@
</h3>
</group>
<group>
<label for="shop"/>
<label for="pricelist"/>
<h3>
<field name="shop" colspan="2"/>
<field name="pricelist" colspan="2"/>
</h3>
</group>
</group>
Expand Down
20 changes: 10 additions & 10 deletions magento_.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ class WebsiteStore(osv.Model):
'magento.instance.website', 'Website', required=True,
readonly=True,
),
shop=fields.many2one(
'sale.shop', 'Sales Shop',
help="Imported sales for this store will go into this shop",
pricelist=fields.many2one(
'product.pricelist', 'Product Pricelist',
help="Imported sales for this store will use the pricelist",
),
instance=fields.related(
'website', 'instance', type='many2one',
Expand Down Expand Up @@ -399,12 +399,12 @@ def export_tier_prices_to_magento(
# we donr have a product on tier, so we use the current
# product in loop for computing the price for this tier
price = pricelist_obj.price_get(
cursor, user, [store.shop.pricelist_id.id],
cursor, user, [store.pricelist.id],
magento_product.product.id,
tier.quantity, context={
'uom': store.website.default_product_uom.id
}
)[store.shop.pricelist_id.id]
)[store.pricelist.id]

price_data.append({
'qty': tier.quantity,
Expand Down Expand Up @@ -453,11 +453,11 @@ class WebsiteStoreView(osv.Model):
company=fields.related(
'store', 'company', type='many2one', relation='res.company',
string='Company', readonly=True
),
shop=fields.related(
'store', 'shop', type='many2one', relation='sale.shop',
string='Sales Shop', readonly=True,
),
),
pricelist=fields.related(
'store', 'pricelist', type='many2one', relation='product.pricelist',
string='Product Pricelist', readonly=True,
),
last_shipment_export_time=fields.datetime('Last Shipment Export Time'),
export_tracking_information=fields.boolean(
'Export tracking information', help='Checking this will make sure'
Expand Down
4 changes: 4 additions & 0 deletions partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ def find_or_create_address_as_partner_using_magento_data(
:param parent: Parent partner for this address partner.
:param context: Application context.
:return: Browse record of address created/found
"""

"""
for address in parent.child_ids + [parent]:
"""
for address in parent.child_ids:
if self.match_address_with_magento_data(
cursor, user, address, address_data
):
Expand Down
4 changes: 2 additions & 2 deletions product.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,11 +650,11 @@ def get_price(self, cursor, user, ids, name, _, context):
cursor, user, context['magento_store'], context=context
)
res[tier.id] = pricelist_obj.price_get(
cursor, user, [store.shop.pricelist_id.id], tier.product.id,
cursor, user, [store.pricelist.id], tier.product.id,
tier.quantity, context={
'uom': store.website.default_product_uom.id
}
)[store.shop.pricelist_id.id]
)[store.pricelist.id]
return res

_columns = dict(
Expand Down
11 changes: 5 additions & 6 deletions sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,19 @@ def create_using_magento_data(self, cursor, user, order_data, context):
store_view = store_view_obj.browse(
cursor, user, context['magento_store_view'], context
)
if not store_view.shop:
if not store_view.pricelist:
raise osv.except_osv(
_('Not Found!'),
_(
'Magento Store %s should have a shop configured.'
'Magento Store %s should have a pricelist configured.'
% store_view.store.name
)
)
if not store_view.shop.pricelist_id:
if not store_view.pricelist:
raise osv.except_osv(
_('Not Found!'),
_(
'Shop on store %s does not have a pricelist!'
'Store %s does not have a pricelist!'
% store_view.store.name
)
)
Expand Down Expand Up @@ -353,10 +353,9 @@ def create_using_magento_data(self, cursor, user, order_data, context):

sale_data = {
'name': instance.order_prefix + order_data['increment_id'],
'shop_id': store_view.shop.id,
'date_order': order_data['created_at'].split()[0],
'partner_id': partner.id,
'pricelist_id': store_view.shop.pricelist_id.id,
'pricelist_id': store_view.pricelist.id,
'currency_id': currency.id,
'partner_invoice_id': partner_invoice_address.id,
'partner_shipping_id': partner_shipping_address.id,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setup_defaults(self, txn):
website_obj = POOL.get('magento.instance.website')
store_obj = POOL.get('magento.website.store')
store_view_obj = POOL.get('magento.store.store_view')
shop_obj = POOL.get('sale.shop')
pricelist_obj = POOL.get('product.pricelist')
uom_obj = POOL.get('product.uom')

# Create two instances
Expand Down Expand Up @@ -98,13 +98,13 @@ def setup_defaults(self, txn):
'default_product_uom': self.uom_id,
})

shop = shop_obj.search(txn.cursor, txn.user, [], context=txn.context)
pricelist = pricelist_obj.search(txn.cursor, txn.user, [], context=txn.context)

self.store_id = store_obj.create(
txn.cursor, txn.user, {
'name': 'Store1',
'website': self.website_id1,
'shop': shop[0],
'pricelist': pricelist[0],
}, context=txn.context
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def test_0090_tier_prices(self):

pricelist_item_obj.create(txn.cursor, txn.user, {
'name': 'Test line',
'price_version_id': store.shop.pricelist_id.version_id[0].id,
'price_version_id': store.pricelist.version_id[0].id,
'product_id': product.id,
'min_quantity': 10,
'base': 1,
Expand Down