Merge pull request #932 from expsa/project_test

Project test
This commit is contained in:
zainab2097 2024-09-01 17:38:32 +03:00 committed by GitHub
commit f832b93c79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 7 deletions

View File

@ -159,7 +159,6 @@ class ProjectInvoice(models.Model):
'move_type': 'out_invoice',
'currency_id': self.currency_id.id,
'ref': self.project_id.project_no,
'invoice_origin': self.project_id.name,
'partner_id': self.invoice_type == 'consultant' and self.project_id.consultant_id.id or self.project_id.partner_id.id ,
'partner_shipping_id': self.project_id.partner_id.id,
'partner_bank_id': self.company_id.partner_id.bank_ids.filtered(
@ -175,7 +174,6 @@ class ProjectInvoice(models.Model):
'move_type': 'in_invoice',
'currency_id': self.currency_id.id,
'ref': self.project_id.project_no,
'invoice_origin': self.project_id.name,
'partner_id': self.invoice_type == 'consultant' and self.project_id.consultant_id.id or self.project_id.partner_id.id ,
'partner_shipping_id': self.project_id.partner_id.id,
'partner_bank_id': self.company_id.partner_id.bank_ids.filtered(
@ -236,7 +234,7 @@ class ProjectInvoice(models.Model):
def action_set_to_draft(self):
self.ensure_one()
if self.invoice_id.state=='draft':
self.invoice_id=False
self.invoice_id.unlink()
self.state = 'draft'
else:
raise UserError(_("Kindly The invoice is not in draft state, so it cannot be unlinked."))
@ -289,7 +287,7 @@ class ProjectInvoiceLine(models.Model):
is_downpayment = fields.Boolean(related="order_line_id.is_downpayment", string="Is a down payment", store=True)
qty_invoiced = fields.Float(string='Invoiced Quantity', readonly=True, digits='Product Unit of Measure')
name = fields.Char()
account_id = fields.Many2one(comodel_name='account.account',related='project_invoice_id.project_id.category_id.account_id')
account_id = fields.Many2one(comodel_name='account.account',)
@api.depends("project_invoice_id")
def get_price_unit_value(self):
@ -358,8 +356,8 @@ class ProjectInvoiceLine(models.Model):
"""
self.ensure_one()
res = {
'name': self.name,
'account_id': self.account_id.id,
'name': self.name+'/'+self.project_invoice_id.project_id.name,
'account_id': self.project_invoice_id.project_id.category_id.account_id and self.project_invoice_id.project_id.category_id.account_id.id or False,
'product_id': self.product_id.id,
'product_uom_id': self.product_uom.id,
'quantity': self.product_uom_qty,

View File

@ -42,7 +42,7 @@
<field name="plan_payment_date" required="1"/>
<field name="actual_date" readonly="1"/>
<field name="actual_payment_date" readonly="1"/>
<field name="invoice_id" readonly="1" options="{'no_open': True}" attrs="{'invisible': [('invoice_id', '=', False)]}"/>
<field name="invoice_id" readonly="1" attrs="{'invisible': [('invoice_id', '=', False)]}"/>
</group>
</group>
<notebook>