Compare commits
	
		
			No commits in common. "663479e4a22944ffa62df388698a96ddcbd09925" and "3dffeeba003d7f2ee3ecb8328e6781f2673d71d5" have entirely different histories.
		
	
	
		
			663479e4a2
			...
			3dffeeba00
		
	
		
					 18 changed files with 174 additions and 17 deletions
				
			
		|  | @ -2,7 +2,7 @@ | ||||||
|     'name': 'Product Create Stock Picking', |     'name': 'Product Create Stock Picking', | ||||||
|     'category': 'Warehouse', |     'category': 'Warehouse', | ||||||
|     'summary': 'Add an action to create a stock picking from a selection of products.', |     'summary': 'Add an action to create a stock picking from a selection of products.', | ||||||
|     'version': "16.0.1.0.0", |     'version': '12.0.0.0.1', | ||||||
|     'description': """ |     'description': """ | ||||||
| 
 | 
 | ||||||
| Add an action to create a stock picking from a selection of products. | Add an action to create a stock picking from a selection of products. | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ from odoo import tools, models, fields, api, _ | ||||||
| class ProductTemplate(models.Model): | class ProductTemplate(models.Model): | ||||||
|     _inherit = "product.template" |     _inherit = "product.template" | ||||||
| 
 | 
 | ||||||
|  |     @api.multi | ||||||
|     def create_stock_picking(self): |     def create_stock_picking(self): | ||||||
|         picking_vals = self.env['stock.picking'].default_get(self.env['stock.picking']._fields.keys()) |         picking_vals = self.env['stock.picking'].default_get(self.env['stock.picking']._fields.keys()) | ||||||
|         picking_vals.update({ |         picking_vals.update({ | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
|     'name': 'Product Library', |     'name': 'Product Library', | ||||||
|     'category': 'Product', |     'category': 'Product', | ||||||
|     'summary': 'Add library related fields to product', |     'summary': 'Add library related fields to product', | ||||||
|     'version': "16.0.1.0.0", |     'version': '12.0.1.0.2', | ||||||
|     'description': """ |     'description': """ | ||||||
| 
 | 
 | ||||||
| Addon mejora de Odoo para librerías y tiendas de discos | Addon mejora de Odoo para librerías y tiendas de discos | ||||||
|  |  | ||||||
|  | @ -10,6 +10,7 @@ from odoo import models, fields, api | ||||||
| class ProductProduct(models.Model): | class ProductProduct(models.Model): | ||||||
|     _inherit = 'product.product' |     _inherit = 'product.product' | ||||||
| 
 | 
 | ||||||
|  |     @api.multi | ||||||
|     @api.depends('image') |     @api.depends('image') | ||||||
|     def _compute_has_image(self): |     def _compute_has_image(self): | ||||||
|         for product in self: |         for product in self: | ||||||
|  |  | ||||||
|  | @ -11,16 +11,16 @@ _logger = logging.getLogger(__name__) | ||||||
| class ProductTemplate(models.Model): | class ProductTemplate(models.Model): | ||||||
|     _inherit = "product.template" |     _inherit = "product.template" | ||||||
| 
 | 
 | ||||||
|     subtitle = fields.Char('Subtitulo') |     subtitle = fields.Char('Subtítulo') | ||||||
|     editorial = fields.Char('Editorial') |     editorial = fields.Char('Editorial') | ||||||
|     formato = fields.Char('Formato') |     formato = fields.Char('Formato') | ||||||
|     pais_edicion = fields.Char('Pais de edicion') |     pais_edicion = fields.Char('País de Edicion') | ||||||
|     colacion = fields.Char('Colacion') |     colacion = fields.Char('Colación') | ||||||
|     autor = fields.Char('Autor') |     autor = fields.Char('Autor') | ||||||
|     isbn = fields.Char('ISBN') |     isbn = fields.Char('ISBN') | ||||||
|     coleccion = fields.Char('Coleccion') |     coleccion = fields.Char('Colección') | ||||||
|     subcoleccion = fields.Char('Subcoleccion') |     subcoleccion = fields.Char('Subcolección') | ||||||
|     idioma = fields.Char('Idioma') |     idioma = fields.Char('Idioma') | ||||||
|     fecha_entrada = fields.Char('Fecha de entrada') |     fecha_entrada = fields.Char('Fecha de entrada') | ||||||
|     fecha_edicion = fields.Char('Fecha de edición') |     fecha_edicion = fields.Char('Fecha de edición') | ||||||
|     genero = fields.Char('Genero') |     genero = fields.Char('Género') | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| <?xml version="1.0"?> | <?xml version="1.0"?> | ||||||
| <odoo> | <openerp> | ||||||
|  |     <data> | ||||||
|         <record model="ir.ui.view" id="product_library_form_config"> |         <record model="ir.ui.view" id="product_library_form_config"> | ||||||
|             <field name="name">product.template.library.form</field> |             <field name="name">product.template.library.form</field> | ||||||
|             <field name="model">product.template</field> |             <field name="model">product.template</field> | ||||||
|  | @ -26,4 +27,5 @@ | ||||||
|               </field> |               </field> | ||||||
|             </field> |             </field> | ||||||
|         </record> |         </record> | ||||||
| </odoo> |      </data> | ||||||
|  | </openerp> | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
|     'name': 'Product Retail', |     'name': 'Product Retail', | ||||||
|     'category': 'Product', |     'category': 'Product', | ||||||
|     'summary': 'Gestiona productos en distribución / Venta a minoristas', |     'summary': 'Gestiona productos en distribución / Venta a minoristas', | ||||||
|     'version': "16.0.1.0.0", |     'version': '12.0.1.0.0', | ||||||
|     'description': """ |     'description': """ | ||||||
| 
 | 
 | ||||||
| Gestiona productos en distribución / Venta a minoristas | Gestiona productos en distribución / Venta a minoristas | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|     'name': 'Product Sequence', |     'name': 'Product Sequence', | ||||||
|     'version': "16.0.1.0.0", |     'version': '12.0.2.0.2', | ||||||
|     'author': "Zikzakmedia SL,Sodexis,Odoo Community Association (OCA)", |     'author': "Zikzakmedia SL,Sodexis,Odoo Community Association (OCA)", | ||||||
|     'website': 'https://github.com/OCA/product-attribute', |     'website': 'https://github.com/OCA/product-attribute', | ||||||
|     'license': 'AGPL-3', |     'license': 'AGPL-3', | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ class ProductCategory(models.Model): | ||||||
|         } |         } | ||||||
|         return vals |         return vals | ||||||
| 
 | 
 | ||||||
|  |     @api.multi | ||||||
|     def write(self, vals): |     def write(self, vals): | ||||||
|         prefix = vals.get("code_prefix") |         prefix = vals.get("code_prefix") | ||||||
|         if prefix: |         if prefix: | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ class ProductProduct(models.Model): | ||||||
|     default_code = fields.Char( |     default_code = fields.Char( | ||||||
|         required=True, |         required=True, | ||||||
|         default='/', |         default='/', | ||||||
|         tracking=True, |         track_visibility='onchange', | ||||||
|         help="Set to '/' and save if you want a new internal reference " |         help="Set to '/' and save if you want a new internal reference " | ||||||
|              "to be proposed." |              "to be proposed." | ||||||
|     ) |     ) | ||||||
|  | @ -35,6 +35,7 @@ class ProductProduct(models.Model): | ||||||
|             vals['default_code'] = sequence.next_by_id() |             vals['default_code'] = sequence.next_by_id() | ||||||
|         return super().create(vals) |         return super().create(vals) | ||||||
| 
 | 
 | ||||||
|  |     @api.multi | ||||||
|     def write(self, vals): |     def write(self, vals): | ||||||
|         """To assign a new internal reference, just write '/' on the field. |         """To assign a new internal reference, just write '/' on the field. | ||||||
|         Note this is up to the user, if the product category is changed, |         Note this is up to the user, if the product category is changed, | ||||||
|  | @ -54,6 +55,7 @@ class ProductProduct(models.Model): | ||||||
|             return True |             return True | ||||||
|         return super().write(vals) |         return super().write(vals) | ||||||
| 
 | 
 | ||||||
|  |     @api.multi | ||||||
|     def copy(self, default=None): |     def copy(self, default=None): | ||||||
|         if default is None: |         if default is None: | ||||||
|             default = {} |             default = {} | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								product_sequence/tests/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								product_sequence/tests/__init__.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | from . import test_product_sequence | ||||||
							
								
								
									
										140
									
								
								product_sequence/tests/test_product_sequence.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										140
									
								
								product_sequence/tests/test_product_sequence.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,140 @@ | ||||||
|  | # Copyright 2016 Sodexis | ||||||
|  | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||||||
|  | 
 | ||||||
|  | from odoo.tests.common import TransactionCase | ||||||
|  | from ..hooks import pre_init_hook | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class TestProductSequence(TransactionCase): | ||||||
|  |     """Tests for creating product with and without Product Sequence""" | ||||||
|  | 
 | ||||||
|  |     def setUp(self): | ||||||
|  |         super(TestProductSequence, self).setUp() | ||||||
|  |         self.product_product = self.env['product.product'] | ||||||
|  |         self.product_category = self.env['product.category'] | ||||||
|  |         self.product_template = self.env['product.template'].create({ | ||||||
|  |             'name': 'Demo Product', | ||||||
|  |         }) | ||||||
|  | 
 | ||||||
|  |     def test_product_create_with_default_code(self): | ||||||
|  |         product = self.product_product.create(dict( | ||||||
|  |             name="Apple", | ||||||
|  |             default_code='PROD01' | ||||||
|  |         )) | ||||||
|  |         self.assertEqual(product.default_code, 'PROD01') | ||||||
|  |         product_new = self.product_product.create(dict( | ||||||
|  |             name="Demo Apple", | ||||||
|  |             product_tmpl_id=self.product_template.id | ||||||
|  |         )) | ||||||
|  |         self.assertTrue(product_new.default_code) | ||||||
|  | 
 | ||||||
|  |     def test_product_create_without_default_code(self): | ||||||
|  |         product_1 = self.product_product.create(dict( | ||||||
|  |             name="Orange", | ||||||
|  |             default_code='/')) | ||||||
|  |         self.assertRegexpMatches(str(product_1.default_code), r'PR/*') | ||||||
|  | 
 | ||||||
|  |     def test_product_copy(self): | ||||||
|  |         product_2 = self.product_product.create(dict( | ||||||
|  |             name="Apple", | ||||||
|  |             default_code='PROD02' | ||||||
|  |         )) | ||||||
|  |         copy_product_2 = product_2.copy() | ||||||
|  |         self.assertEqual(copy_product_2.default_code, 'PROD02-copy') | ||||||
|  | 
 | ||||||
|  |     def test_pre_init_hook(self): | ||||||
|  |         product_3 = self.product_product.create(dict( | ||||||
|  |             name="Apple", | ||||||
|  |             default_code='PROD03' | ||||||
|  |         )) | ||||||
|  |         sql = "update product_product set default_code='/' where id=%s" | ||||||
|  |         self.cr.execute(sql, (product_3.id,)) | ||||||
|  |         product_3.invalidate_cache() | ||||||
|  |         self.assertEqual(product_3.default_code, '/') | ||||||
|  |         pre_init_hook(self.cr) | ||||||
|  |         product_3.invalidate_cache() | ||||||
|  |         self.assertEqual(product_3.default_code, '!!mig!!%s' % (product_3.id,)) | ||||||
|  | 
 | ||||||
|  |     def test_product_category_sequence(self): | ||||||
|  |         categ_grocery = self.product_category.create(dict( | ||||||
|  |             name="Grocery", | ||||||
|  |             code_prefix="GRO", | ||||||
|  |         )) | ||||||
|  |         self.assertTrue(categ_grocery.sequence_id) | ||||||
|  |         self.assertEqual(categ_grocery.sequence_id.prefix, "GRO") | ||||||
|  |         self.assertFalse(categ_grocery.sequence_id.company_id) | ||||||
|  |         product_3 = self.product_product.create(dict( | ||||||
|  |             name="Apple", | ||||||
|  |             categ_id=categ_grocery.id, | ||||||
|  |         )) | ||||||
|  |         self.assertEqual(product_3.default_code[:3], "GRO") | ||||||
|  |         self.assertEqual(product_3.product_tmpl_id.default_code[:3], "GRO") | ||||||
|  |         categ_electronics = self.product_category.create(dict( | ||||||
|  |             name="Electronics", | ||||||
|  |             code_prefix="ELE", | ||||||
|  |         )) | ||||||
|  |         product_3.write({'default_code': '/', | ||||||
|  |                          'categ_id': categ_electronics.id}) | ||||||
|  |         self.assertEqual(product_3.default_code[:3], "ELE") | ||||||
|  |         self.assertEqual(product_3.product_tmpl_id.default_code[:3], "ELE") | ||||||
|  | 
 | ||||||
|  |         product_4 = self.product_product.create(dict( | ||||||
|  |             name="Truck", | ||||||
|  |             default_code='PROD04' | ||||||
|  |         )) | ||||||
|  |         product_4.write({'default_code': '/'}) | ||||||
|  |         self.assertTrue(product_4.categ_id, 'Category is not set.') | ||||||
|  | 
 | ||||||
|  |         categ_car = self.product_category.create(dict( | ||||||
|  |             name="Car", | ||||||
|  |             code_prefix="CAR", | ||||||
|  |         )) | ||||||
|  |         product_3.product_tmpl_id.categ_id = categ_car | ||||||
|  |         product_3.product_tmpl_id.default_code = '/' | ||||||
|  |         product_3.refresh() | ||||||
|  |         self.assertEqual(product_3.default_code[:3], "CAR") | ||||||
|  |         self.assertEqual(product_3.product_tmpl_id.default_code[:3], "CAR") | ||||||
|  |         categ_car.write(dict( | ||||||
|  |             name="Bike", | ||||||
|  |             code_prefix="BIK", | ||||||
|  |         )) | ||||||
|  |         self.assertEqual(categ_car.sequence_id.prefix, "BIK") | ||||||
|  |         categ_car.sequence_id = False | ||||||
|  |         categ_car.write({'code_prefix': 'KIA'}) | ||||||
|  |         self.assertEqual(categ_car.sequence_id.prefix, "KIA") | ||||||
|  | 
 | ||||||
|  |     def test_product_parent_category_sequence(self): | ||||||
|  |         parent_categ = self.product_category.create(dict( | ||||||
|  |             name="Parents", | ||||||
|  |             code_prefix="PAR", | ||||||
|  |         )) | ||||||
|  |         categ = self.product_category.create(dict( | ||||||
|  |             name="Child", | ||||||
|  |             parent_id=parent_categ.id, | ||||||
|  |         )) | ||||||
|  | 
 | ||||||
|  |         product_anna = self.product_product.create(dict( | ||||||
|  |             name="Anna", | ||||||
|  |             categ_id=categ.id, | ||||||
|  |         )) | ||||||
|  |         self.assertEqual(product_anna.default_code[:2], "PR") | ||||||
|  |         self.assertEqual(product_anna.product_tmpl_id.default_code[:2], "PR") | ||||||
|  | 
 | ||||||
|  |         self.env.user.company_id.use_parent_categories_to_determine_prefix = True | ||||||
|  | 
 | ||||||
|  |         product_claudia = self.product_product.create(dict( | ||||||
|  |             name="Claudia", | ||||||
|  |             categ_id=categ.id, | ||||||
|  |         )) | ||||||
|  |         self.assertEqual(product_claudia.default_code[:3], "PAR") | ||||||
|  |         self.assertEqual(product_claudia.product_tmpl_id.default_code[:3], "PAR") | ||||||
|  | 
 | ||||||
|  |     def test_product_copy_with_default_values(self): | ||||||
|  |         product_2 = self.product_product.create(dict( | ||||||
|  |             name="Apple", | ||||||
|  |             default_code='PROD02' | ||||||
|  |         )) | ||||||
|  |         copy_product_2 = product_2.copy({ | ||||||
|  |             'default_code': 'product test sequence', | ||||||
|  |         }) | ||||||
|  |         self.assertEqual(copy_product_2.default_code, 'product test sequence') | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
|     "author": "ACSONE SA/NV, Odoo Community Association (OCA)", |     "author": "ACSONE SA/NV, Odoo Community Association (OCA)", | ||||||
|     "website": "https://github.com/OCA/product-attribute", |     "website": "https://github.com/OCA/product-attribute", | ||||||
|     "category": "Product", |     "category": "Product", | ||||||
|     "version": "16.0.1.0.0", |     "version": "12.0.2.0.2", | ||||||
|     "license": "AGPL-3", |     "license": "AGPL-3", | ||||||
|     "depends": ["sale", "product"], |     "depends": ["sale", "product"], | ||||||
|     "data": [ |     "data": [ | ||||||
|  |  | ||||||
							
								
								
									
										7
									
								
								product_state/migrations/12.0.2.0.0/post-migration.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								product_state/migrations/12.0.2.0.0/post-migration.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | # Copyright 2020 Tecnativa - Pedro M. Baeza | ||||||
|  | # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||||||
|  | from odoo.addons.product_state.hooks import post_init_hook | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def migrate(cr, version): | ||||||
|  |     post_init_hook(cr, False) | ||||||
|  | @ -129,6 +129,7 @@ | ||||||
|     <record model="ir.actions.act_window" id="action_product_state"> |     <record model="ir.actions.act_window" id="action_product_state"> | ||||||
|         <field name="name">State</field> |         <field name="name">State</field> | ||||||
|         <field name="res_model">product.state</field> |         <field name="res_model">product.state</field> | ||||||
|  |         <field name="view_type">form</field> | ||||||
|         <field name="view_mode">kanban,form,tree</field> |         <field name="view_mode">kanban,form,tree</field> | ||||||
|     </record> |     </record> | ||||||
|     <menuitem |     <menuitem | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| { | { | ||||||
|     "name": "Stock Picking Depósito", |     "name": "Stock Picking Depósito", | ||||||
|     "summary": "Permite la gestión de depósitos en el almacén y su facturación.", |     "summary": "Permite la gestión de depósitos en el almacén y su facturación.", | ||||||
|     "version": "16.0.1.0.0", |     "version": "12.0.1.0.1", | ||||||
|     "development_status": "Alpha", |     "development_status": "Alpha", | ||||||
|     "category": "Warehouse Management", |     "category": "Warehouse Management", | ||||||
|     "website": "https://criptomart.net", |     "website": "https://criptomart.net", | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| <odoo> | <odoo> | ||||||
|     <data>  |     <data noupdate="0">  | ||||||
| 
 | 
 | ||||||
|         <record id="wh_deposits" model="stock.warehouse"> |         <record id="wh_deposits" model="stock.warehouse"> | ||||||
|             <field name="name">Depósito Salidas</field> |             <field name="name">Depósito Salidas</field> | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
|         </function> |         </function> | ||||||
| 
 | 
 | ||||||
|     </data> |     </data> | ||||||
|     <data>  |     <data noupdate="0">  | ||||||
| 
 | 
 | ||||||
|         <record id="location_deposit_buy" model="stock.location"> |         <record id="location_deposit_buy" model="stock.location"> | ||||||
|             <field name="name">Depósitos Entradas</field> |             <field name="name">Depósitos Entradas</field> | ||||||
|  |  | ||||||
|  | @ -55,6 +55,7 @@ class ResPartner(models.Model): | ||||||
|                  }).id |                  }).id | ||||||
|          return super().create(vals) |          return super().create(vals) | ||||||
| 
 | 
 | ||||||
|  |      @api.multi | ||||||
|      def write(self, vals): |      def write(self, vals): | ||||||
|          if ( vals.get('deposit_sale_accept', False) == True ) and not self.deposit_sale_location_id: |          if ( vals.get('deposit_sale_accept', False) == True ) and not self.deposit_sale_location_id: | ||||||
|              vals['deposit_sale_location_id'] = self.env['stock.location'].create({ |              vals['deposit_sale_location_id'] = self.env['stock.location'].create({ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue