diff --git a/product_catch_weight/__manifest__.py b/product_catch_weight/__manifest__.py index 535582f7..7502852d 100644 --- a/product_catch_weight/__manifest__.py +++ b/product_catch_weight/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Product Catch Weight', - 'version': '12.0.1.0.0', + 'version': '16.0.1.0.0', 'category': 'Warehouse', 'depends': [ 'sale_stock', diff --git a/product_catch_weight/models/account_invoice.py b/product_catch_weight/models/account_invoice.py index c6db156c..d4951a20 100644 --- a/product_catch_weight/models/account_invoice.py +++ b/product_catch_weight/models/account_invoice.py @@ -4,13 +4,12 @@ import logging _logger = logging.getLogger(__name__) -class AccountInvoiceLine(models.Model): - _inherit = 'account.invoice.line' +class AccountMoveLine(models.Model): + _name = "account.move.line" catch_weight = fields.Float(string='Catch Weight', digits=(10, 4), compute='_compute_price', store=True) catch_weight_uom_id = fields.Many2one('uom.uom', related='product_id.catch_weight_uom_id') - @api.one @api.depends('price_unit', 'discount', 'invoice_line_tax_ids', 'quantity', 'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id', 'invoice_id.date_invoice', 'invoice_id.date') diff --git a/product_catch_weight/models/stock.py b/product_catch_weight/models/stock.py index b96fa5bc..16e3faed 100644 --- a/product_catch_weight/models/stock.py +++ b/product_catch_weight/models/stock.py @@ -2,7 +2,7 @@ from odoo import api, fields, models class StockProductionLot(models.Model): - _inherit = 'stock.production.lot' + _inherit = 'stock.lot' catch_weight_ratio = fields.Float(string='Catch Weight Ratio', digits=(10, 6), compute='_compute_catch_weight_ratio') catch_weight = fields.Float(string='Catch Weight', digits=(10, 4)) diff --git a/product_catch_weight/models/stock_patch.py b/product_catch_weight/models/stock_patch.py index fca04e4f..adfaf554 100644 --- a/product_catch_weight/models/stock_patch.py +++ b/product_catch_weight/models/stock_patch.py @@ -42,7 +42,7 @@ def _action_done(self): # `use_create_lots` and `use_existing_lots`. if ml.lot_name and not ml.lot_id: lot_catch_weight = ml.catch_weight_uom_id._compute_quantity(ml.catch_weight, ml.product_id.catch_weight_uom_id, rounding_method='DOWN') - lot = self.env['stock.production.lot'].create( + lot = self.env['stock.lot'].create( {'name': ml.lot_name, 'product_id': ml.product_id.id, 'catch_weight': lot_catch_weight} ) ml.write({'lot_id': lot.id}) diff --git a/product_catch_weight/tests/test_catch_weight.py b/product_catch_weight/tests/test_catch_weight.py index 9a383ea3..8c1b9a09 100644 --- a/product_catch_weight/tests/test_catch_weight.py +++ b/product_catch_weight/tests/test_catch_weight.py @@ -35,7 +35,7 @@ class TestPicking(TransactionCase): # def test_creation(self): # self.productA.tracking = 'serial' - # lot = self.env['stock.production.lot'].create({ + # lot = self.env['stock.lot'].create({ # 'product_id': self.productA.id, # 'name': '123456789', # }) @@ -49,7 +49,7 @@ class TestPicking(TransactionCase): # self.productA.tracking = 'serial' # picking_pick, picking_pack, picking_ship = self.create_pick_pack_ship() # stock_location = self.env['stock.location'].browse(self.stock_location) - # lot = self.env['stock.production.lot'].create({ + # lot = self.env['stock.lot'].create({ # 'product_id': self.productA.id, # 'name': '123456789', # 'catch_weight_ratio': 0.8, @@ -58,7 +58,7 @@ class TestPicking(TransactionCase): def test_so_invoice(self): ref_weight = 45.0 - lot = self.env['stock.production.lot'].create({ + lot = self.env['stock.lot'].create({ 'product_id': self.product1.id, 'name': '123456789', 'catch_weight': ref_weight, @@ -89,12 +89,12 @@ class TestPicking(TransactionCase): def test_so_invoice2(self): ref_weight1 = 45.0 ref_weight2 = 51.0 - lot1 = self.env['stock.production.lot'].create({ + lot1 = self.env['stock.lot'].create({ 'product_id': self.product1.id, 'name': '1-low', 'catch_weight': ref_weight1, }) - lot2 = self.env['stock.production.lot'].create({ + lot2 = self.env['stock.lot'].create({ 'product_id': self.product1.id, 'name': '1-high', 'catch_weight': ref_weight2, diff --git a/product_catch_weight/views/stock_views.xml b/product_catch_weight/views/stock_views.xml index 1a580e0b..ca3c8d0a 100644 --- a/product_catch_weight/views/stock_views.xml +++ b/product_catch_weight/views/stock_views.xml @@ -1,8 +1,8 @@ - stock.production.lot.form.inherit - stock.production.lot + stock.lot.form.inherit + stock.lot