diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-20 13:21:38 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-20 13:21:38 +0700 |
| commit | aeadcc9b170ae8585844d4b4986971ed028b7897 (patch) | |
| tree | f1d31704289a6a1b7edf65fa845d2d7057cd9b9e | |
| parent | 03ccb219d927400af96c4b39add257e78864b7f2 (diff) | |
add new role user to edit product
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/users.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/views/users.xml | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 2ce2c185..7effc109 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -75,7 +75,7 @@ class ProductTemplate(models.Model): @api.constrains('name', 'default_code') def _check_duplicate_product(self): for product in self: - if not self.env.user.is_purchasing_manager: + if not self.env.user.is_purchasing_manager and not self.env.user.is_editor_product: domain = [('default_code', '!=', False)] if product.product_variant_ids: @@ -353,8 +353,8 @@ class ProductProduct(models.Model): @api.constrains('name','default_code') def _check_duplicate_product(self): - if not self.env.user.is_purchasing_manager: - for product in self: + for product in self: + if not self.env.user.is_purchasing_manager and not self.env.user.is_editor_product: if product.write_date == product.create_date: domain = [ ('default_code', '!=', False), diff --git a/indoteknik_custom/models/users.py b/indoteknik_custom/models/users.py index 14fcae98..b90c0097 100644 --- a/indoteknik_custom/models/users.py +++ b/indoteknik_custom/models/users.py @@ -10,6 +10,7 @@ class Users(models.Model): is_leader = fields.Boolean(string='Leader', help='Berhak Approval SO Margin < 15 dan Approval PO') is_accounting = fields.Boolean(string='Accounting', help='Berhak Approval Internal Use') is_logistic_approver = fields.Boolean(string='Logistic Approver', help='Berhak Approval Penerimaan Barang') + is_editor_product = fields.Boolean(string='Editor Product', help='Berhak Mengedit Data Product') def notify_internal_users(self, message, title): users = self.search([('share', '=', False)]) diff --git a/indoteknik_custom/views/users.xml b/indoteknik_custom/views/users.xml index 25e7f90c..d67b4474 100644 --- a/indoteknik_custom/views/users.xml +++ b/indoteknik_custom/views/users.xml @@ -12,6 +12,7 @@ <field name="is_sales_manager"/> <field name="is_leader"/> <field name="is_logistic_approver"/> + <field name="is_editor_product"/> </field> </field> </record> |
