I did a task module
class task(models.Model):
_inherit = "project.task"
def _default_task_accounting_type_id(self):
domain = [('name', '=', 'Développement')]
return self.env['account.analytic.tag'].search(domain, limit=1)
task_accounting_type = fields.Many2one('account.analytic.tag', default=_default_task_accounting_type_id)
I want to have a different domain depending of task related project based on project name.
Something like:
def _default_task_accounting_type_id(self):
if self.project_id.???? == 'Marketing':
domain = [('name', '=', 'Développement')]
else:
domain = [('name', '=', 'Développement')]
return self.env['account.analytic.tag'].search(domain, limit=1)
How could I get the project name related to a task in my function?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilité
- Inventaire
- PoS
- Project
- MRP
Cette question a été signalée
3
Réponses
3491
Vues
self.project_id.name
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrirePublications associées | Réponses | Vues | Activité | |
---|---|---|---|---|
|
1
juin 23
|
3362 | ||
|
1
nov. 22
|
3649 | ||
Cannot create task
Résolu
|
|
2
juin 20
|
3866 | |
|
2
juil. 18
|
7373 | ||
|
4
juil. 18
|
8229 |
Hi hassan,
self.project_id.name does not work:
_logger.warning(str(type(self.project_id.name)))
--> gives <class 'bool'>
Do I miss something?
.models.models: <class 'bool'>
By the way I use odoo 13, and type(self.project_id)) is <class 'odoo.api.project.project'>