Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
393 Vistas

Hello,


In the scope of a PROJECT margins and profitability report, is there a chance we can link a supplier invoice to a task or a project ?


Example :

  • I am providing a service, this is the project
  • To get the service done, need to buy 3 outsourced services
  • If I link the 3 invoices to the project, I know with precision the project cost

Thanks for your opinions :-)

Thomas

Avatar
Descartar
Mejor respuesta

Hi,

Please refer to the code below:

Python

from odoo import fields, models, _

class ProjectTask(models.Model):
_inherit = "project.task"

def action_view_invoice(self):
invoice = self.sale_order_id.invoice_ids
return {
'name': _('Invoice'),
'view_mode': 'list,form',
'res_model': 'account.move',
'type': 'ir.actions.act_window',
'domain': [('id', 'in', invoice.ids)],
}

XML

 <record id="view_task_form2" model="ir.ui.view">
<field name="name">project.task.view.form</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button
string="Invoice"
class="oe_stat_button"
name="action_view_invoice"
type="object"
icon="fa-dollar"/>
</xpath>
</field>
</record>


Hope it helps.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
ago 25
9
0
ago 25
28
0
ago 25
91
3
ago 25
150
4
ago 25
1085