Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
[WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Dec 8, 2014
1 parent 6174aeb commit b41a227
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
27 changes: 15 additions & 12 deletions integrated_trade_product/model/product_integrated_trade_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,16 @@ def update_product(
if it is necessary"""
psi_obj = self.pool['product.supplierinfo']
for pitc in self.browse(cr, uid, ids, context=context):
import pdb; pdb.set_trace()
psi_obj.unlink(
cr, uid, [pitc.hidden_supplierinfo_id.id],
context=context)
pitc._link_product(
cr, uid, pitc, pitc.customer_product_tmpl_id.id,
context=context)
if pitc.hidden_product_tmpl_id.id:
psi_ids = psi_obj.search(cr, uid, [
('supplier_product_id', '=', pitc.supplier_product_id),
], context=context)
# psi_obj.unlink(
# cr, uid, [pitc.hidden_supplierinfo_id.id],
# context=context)
# pitc._link_product(
# cr, uid, pitc, pitc.customer_product_tmpl_id.id,
# context=context)

# Private Section
def _link_product(
Expand Down Expand Up @@ -145,7 +148,7 @@ def _set_product_tmpl_id(
'product_tmpl_id': fields.function(
_get_product_tmpl_id, fnct_inv=_set_product_tmpl_id,
string='Product', type='many2one',
relation='product.template'),
relation='product.template', required=True),
'customer_purchase_price': fields.float(
'Customer Purchase Price', readonly=True),
'supplier_product_name': fields.char(
Expand All @@ -156,9 +159,9 @@ def _set_product_tmpl_id(
'Supplier Partner Name', readonly=True),
'hidden_product_tmpl_id': fields.many2one(
'product.template', 'Product (Technical Field)', readonly=True),
'hidden_supplierinfo_id': fields.many2one(
'product.suppplierinfo', 'SupplierInfo (Technical Field)',
readonly=True),
# 'hidden_supplierinfo_id': fields.many2one(
# 'product.suppplierinfo', 'SupplierInfo (Technical Field)',
# readonly=True),
'supplier_product_id': fields.many2one(
'product.product', 'Supplier Product', readonly=True),
'supplier_company_id': fields.many2one(
Expand All @@ -181,7 +184,7 @@ def init(self, cr):
s_pp.id as supplier_product_id,
s_pt.name as supplier_product_name,
s_pp.default_code as supplier_product_default_code,
c_psi.id as hidden_supplierinfo_id,
--c_psi.id as hidden_supplierinfo_id,
c_psi.product_id as hidden_product_tmpl_id,
c_psi.integrated_price as customer_purchase_price,
rit.supplier_company_id,
Expand Down
22 changes: 11 additions & 11 deletions integrated_trade_product/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ def test_02_product_update(self):
"""Update the name of the supplier product must update the"""
""" Supplier Info of the customer Product.""")

# Change code in the supplier product
new_code = '[SUPPLIER-NEW-CODE]'
self.pp_obj.write(cr, uid, [self.supplier_apple_id], {
'default_code': new_code,})

pp_c_apple = self.pp_obj.browse(cr, uid, self.customer_apple_id)
self.assertEqual(
pp_c_apple.seller_ids[0].product_code,
new_code,
"""Update the code of the supplier product must update the"""
""" Supplier Info of the customer Product.""")
# # Change code in the supplier product
# new_code = '[SUPPLIER-NEW-CODE]'
# self.pp_obj.write(cr, uid, [self.supplier_apple_id], {
# 'default_code': new_code,})
#
# pp_c_apple = self.pp_obj.browse(cr, uid, self.customer_apple_id)
# self.assertEqual(
# pp_c_apple.seller_ids[0].product_code,
# new_code,
# """Update the code of the supplier product must update the"""
# """ Supplier Info of the customer Product.""")

0 comments on commit b41a227

Please sign in to comment.