Merge pull request #2232 from expsa/samir-aladawi-petty-employee

[UPD] project_petty_invoice: add petty employee in project invoice
This commit is contained in:
SamirLADOUI-sa 2025-01-27 11:13:12 +01:00 committed by GitHub
commit a9948604fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -21,6 +21,11 @@ msgstr ""
msgid "Paid by Petty Cash"
msgstr "منصرفه من العهد"
#. module: project_petty_invoice
#: model:ir.model.fields,field_description:project_petty_invoice.field_project_invoice__petty_employee_id
msgid "Petty Cashier"
msgstr "موظف العهد"
#. module: project_petty_invoice
#: model:ir.model,name:project_petty_invoice.model_project_invoice
msgid "Project Invoice Request"

View File

@ -6,8 +6,18 @@ from odoo import models, fields
class ProjectInvoice(models.Model):
_inherit = "project.invoice"
is_petty_paid = fields.Boolean(string='Paid by Petty Cash', default=False)
petty_employee_id = fields.Many2one(
'hr.employee',
string='Petty Cashier',
domain="[('state', '=', 'open')]",
readonly=True,
states={'draft': [('readonly', False)]},
copy=False
)
def create_invoice(self):
res = super(ProjectInvoice, self).create_invoice()
self.invoice_id.is_petty_paid = self.is_petty_paid
self.invoice_id.petty_employee_id = self.petty_employee_id.id
return res

View File

@ -7,6 +7,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='plan_date']" position="after">
<field name="is_petty_paid"/>
<field name="petty_employee_id" attrs="{'invisible': [('is_petty_paid', '!=', True)]}"/>
</xpath>
</field>
</record>