vusca los impuestos en las cats padre si la opción general está habilitada
This commit is contained in:
		
							parent
							
								
									ac6cb6ab95
								
							
						
					
					
						commit
						932fe0fd45
					
				
					 1 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
					@ -22,8 +22,14 @@ class ProductProduct(models.Model):
 | 
				
			||||||
            vals['supplier_taxes_id'] = category.buy_tax_id
 | 
					            vals['supplier_taxes_id'] = category.buy_tax_id
 | 
				
			||||||
        elif template_id:
 | 
					        elif template_id:
 | 
				
			||||||
            template = self.env["product.template"].browse(template_id)
 | 
					            template = self.env["product.template"].browse(template_id)
 | 
				
			||||||
            category = template.categ_id
 | 
					            cat = template.categ_id
 | 
				
			||||||
            template.taxes_id = category.sell_tax_id
 | 
					            if not cat and self.env.user.company_id.use_parent_categories_to_determine_taxes:
 | 
				
			||||||
            template.supplier_taxes_id = category.buy_tax_id
 | 
					                while not cat.pos_categ_id and cat.parent_id:
 | 
				
			||||||
 | 
					                    cat = cat.parent_id
 | 
				
			||||||
 | 
					            if cat:
 | 
				
			||||||
 | 
					                template.taxes_id = cat.sell_tax_id
 | 
				
			||||||
 | 
					                template.supplier_taxes_id = cat.buy_tax_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return super(ProductProduct, self).create(vals)
 | 
					        return super(ProductProduct, self).create(vals)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue