Update project_invoice.py
This commit is contained in:
parent
bfc7f5c9ef
commit
a80ac1fabe
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue