diff --git a/dev/scripts/interfaces/sst10_create_product.py b/dev/scripts/interfaces/sst10_create_product.py index 50de12b1..2fbe5859 100755 --- a/dev/scripts/interfaces/sst10_create_product.py +++ b/dev/scripts/interfaces/sst10_create_product.py @@ -38,7 +38,8 @@ values = { "assembly_line_ids": ["0000"], "list_price": 50.00, "can_be_sold_unconfigured": True, - 'image': "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", + "image": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", + "tax": "20% MwSt.",# oder "10% MwSt.", "0% MwSt." } product_obj = odoo.env['product.template'] diff --git a/ext/custom-addons/dp_custom/models/product.py b/ext/custom-addons/dp_custom/models/product.py index d6bae65a..3f10d981 100644 --- a/ext/custom-addons/dp_custom/models/product.py +++ b/ext/custom-addons/dp_custom/models/product.py @@ -120,13 +120,23 @@ class ProductTemplate(models.Model): _("Produktionslinie \'%s\' kann nicht zugeordnet werden") % assembly_line_code) vals['assembly_line_ids'] = [(6, 0, assembly_line_ids)] + if vals.get('tax', False): + if vals['tax'] not in ["20% MwSt.", "10% MwSt.", "0% MwSt."]: + raise ValidationError(_("Die Steuer \'%s\' ist nicht gültig.") % vals['tax']) + + tax = self.env['account.tax'].search([('name', '=', vals['tax'])]) + if tax: + vals['taxes_id'] = [(6, 0, [tax.id])] + else: + raise ValidationError(_("Die Steuer \'%s\' kann nicht zugeordnet werden") % vals['tax']) + return vals @api.model def _get_specified_fields(self): return ['default_code', 'name', 'length', 'width', 'thickness', 'surface', 'active', 'weight', 'is_internal', 'xcat_id', 'notes', 'material_type_id', 'intrastat_id', 'sale_ok', 'assembly_line_ids', 'list_price', - 'height', 'categ_id', 'can_be_sold_unconfigured', 'image'] + 'height', 'categ_id', 'can_be_sold_unconfigured', 'image', 'tax'] class ProductCategory(models.Model): diff --git a/setup/lib/environments.py b/setup/lib/environments.py index 3959ed8e..c11b2e87 100644 --- a/setup/lib/environments.py +++ b/setup/lib/environments.py @@ -40,9 +40,9 @@ ENVIRONMENTS = { 'br-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config = ConfigTZA()), 'br-glaser' : Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()), - 'aa' : Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config = ConfigTZA()), + 'aa' : Environment('http://localhost', '8080', 'tz-austria_2', 'admin', 'x', 'admin', config = ConfigTZA()), 'aa-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config = ConfigTZA()), - 'aa-glaser' : Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()), + 'aa-glaser' : Environment('http://localhost', '8080', 'tz-austria_2', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()), 'rw' : Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config = ConfigTZA()), 'rw-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config = ConfigTZA()),