[MIG] product_cores: to 16, blocked by partner_id not save on test line 124

This commit is contained in:
Leo Pinedo
2022-10-24 22:07:04 +00:00
parent b8424b4b21
commit 9ea3284a8c
4 changed files with 13 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
{
'name': 'Product Cores',
'author': 'Hibou Corp. <hello@hibou.io>',
'version': '15.0.1.0.0',
'version': '16.0.1.0.0',
'category': 'Tools',
'license': 'OPL-1',
'summary': 'Charge customers core deposits.',
@@ -12,6 +12,7 @@ Charge customers core deposits.
""",
'website': 'https://hibou.io/',
'depends': [
'delivery',
'sale_stock',
'purchase_stock',
],

View File

@@ -48,7 +48,7 @@ class ProductProduct(models.Model):
product_core_id = fields.Many2one('product.product', string='Product Core')
def get_purchase_core_service(self, vendor):
seller_line = self.seller_ids.filtered(lambda l: l.name == vendor and l.product_core_service_id)
seller_line = self.seller_ids.filtered(lambda l: l.partner_id == vendor and l.product_core_service_id)
# only want to return the first one
for l in seller_line:
return l.product_core_service_id

View File

@@ -77,7 +77,7 @@ class TestProductCores(common.TransactionCase):
# Create a supplierinfo for this vendor with a core service product
self.env['product.supplierinfo'].create({
'name': self.vendor.id,
'partner_id': self.vendor.id,
'price': 10.0,
'product_core_service_id': self.product_core_service.id,
'product_tmpl_id': self.product.product_tmpl_id.id,
@@ -111,7 +111,7 @@ class TestProductCores(common.TransactionCase):
self.assertEqual(purchase.state, 'purchase')
self.assertEqual(len(purchase.picking_ids), 1)
self.assertEqual(len(purchase.picking_ids.move_line_ids), 1) # shouldn't have the service
purchase.picking_ids.move_line_ids.qty_done = purchase.picking_ids.move_line_ids.product_uom_qty
purchase.picking_ids.move_line_ids.qty_done = purchase.picking_ids.move_line_ids.reserved_uom_qty
purchase.picking_ids.button_validate()
purchase.flush()
@@ -195,13 +195,13 @@ class TestProductCores(common.TransactionCase):
sale.action_confirm()
self.assertTrue(sale.state in ('sale', 'done'))
self.assertEqual(len(sale.picking_ids), 1)
self.assertEqual(len(sale.picking_ids.move_lines), 1)
self.assertEqual(sale.picking_ids.move_lines.product_id, self.product)
self.assertEqual(len(sale.picking_ids.move_ids), 1)
self.assertEqual(sale.picking_ids.move_ids.product_id, self.product)
sale.picking_ids.action_assign()
self.assertEqual(so_line.product_uom_qty, sale.picking_ids.move_lines.reserved_availability)
for move_line in sale.picking_ids.mapped('move_lines.move_line_ids'):
move_line.qty_done = move_line.product_uom_qty
self.assertEqual(so_line.product_uom_qty, sale.picking_ids.move_ids.reserved_availability)
for move_line in sale.picking_ids.mapped('move_ids.move_line_ids'):
move_line.qty_done = move_line.reserved_uom_qty
sale.picking_ids.button_validate()
self.assertEqual(sale.picking_ids.state, 'done')
self.assertEqual(so_line.qty_delivered, so_line.product_uom_qty)
@@ -235,8 +235,8 @@ class TestProductCores(common.TransactionCase):
return_picking = sale.picking_ids.filtered(lambda p: p.state != 'done')
self.assertTrue(return_picking)
for move_line in return_picking.mapped('move_lines.move_line_ids'):
move_line.qty_done = move_line.product_uom_qty
for move_line in return_picking.mapped('move_ids.move_line_ids'):
move_line.qty_done = move_line.reserved_uom_qty
return_picking.button_validate()
self.assertTrue(all(l.qty_delivered == 0.0 for l in sale.order_line))

View File

@@ -49,7 +49,7 @@
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="product_core_service_id"/>
</xpath>
</field>