commit
dd2b1543f1
|
|
@ -82,22 +82,22 @@ class RentPayment(models.Model):
|
|||
if payment.amount>0.00:
|
||||
print('go on....')
|
||||
line_invoice.append((0, 0, {
|
||||
'name':'قيمة الإيجار '+'- '+ self.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': payment.amount,
|
||||
'name':'قيمة الإيجار '+' - '+payment.contract_id.name+'- '+ self.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': self.amount,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.accrued_account_id.id,
|
||||
}))
|
||||
if payment.water_cost>0.00:
|
||||
line_invoice.append((0, 0, {
|
||||
'name': 'تكلفة المياه'+' -'+payment.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': payment.water_cost,
|
||||
'name': 'تكلفة المياه'+' -'+self.name + ' - '+payment.contract_id.name +' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit':self.water_cost,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.accrued_account_id.id,
|
||||
}),)
|
||||
if payment.service_cost>0.00:
|
||||
line_invoice.append((0, 0, {
|
||||
'name':'قيمة الخدمات'+' - '+ payment.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': payment.service_cost,
|
||||
'name':'قيمة الخدمات'+' - '+ self.name+' - '+payment.contract_id.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': self.service_cost,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.accrued_account_id.id,
|
||||
}))
|
||||
|
|
@ -105,8 +105,8 @@ class RentPayment(models.Model):
|
|||
print('if 0000000')
|
||||
print(self.name)
|
||||
line_invoice.append((0, 0, {
|
||||
'name':self.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': amount,
|
||||
'name':self.name + ' - ' +payment.contract_id.name + ' - '+payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit':self.total_amount,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.accrued_account_id.id,
|
||||
}))
|
||||
|
|
@ -118,21 +118,8 @@ class RentPayment(models.Model):
|
|||
'narration': payment.note,
|
||||
'partner_id': payment.contract_id.partner_id.id or payment.contract_id.renter_id.id,
|
||||
'invoice_line_ids': line_invoice,
|
||||
'line_ids': [
|
||||
(0, 0, {
|
||||
'account_id': payment.contract_id.revenue_account_id.id,
|
||||
'debit': 0.0,
|
||||
'credit': amount,
|
||||
'name': payment.contract_id.name + ' - ' + payment.contract_id.seq + ' - ' + str(payment.contract_id.date),
|
||||
'quantity': 1
|
||||
}),
|
||||
(0, 0, {
|
||||
'account_id': payment.contract_id.debit_account_id.id,
|
||||
'debit': amount,
|
||||
'credit': 0.0,
|
||||
'quantity': 1
|
||||
})
|
||||
],
|
||||
|
||||
|
||||
# 'tax_ids': [(6, 0, [payment.tax_id.id])],
|
||||
}
|
||||
return invoice_vals
|
||||
|
|
@ -145,9 +132,9 @@ class RentPayment(models.Model):
|
|||
invoice = self.env['account.move'].sudo().create(invoice_vals).with_user(self.env.uid)
|
||||
|
||||
# Get the ID of the second line
|
||||
line_id = invoice.invoice_line_ids[1].id
|
||||
commands = [(2, line_id, 0)]
|
||||
invoice.write({'invoice_line_ids': commands})
|
||||
# line_id = invoice.invoice_line_ids[1].id
|
||||
# commands = [(2, line_id, 0)]
|
||||
# invoice.write({'invoice_line_ids': commands})
|
||||
|
||||
self.invoice_id = invoice.id
|
||||
self.write({'state': 'invoice'})
|
||||
|
|
|
|||
Loading…
Reference in New Issue