commit
7c7539ce32
|
|
@ -29,7 +29,7 @@ class RentPayment(models.Model):
|
|||
user_id = fields.Many2one('res.users', string="Responsible")
|
||||
company_id = fields.Many2one('res.company', string="Company")
|
||||
due_date = fields.Date(string="Due Date")
|
||||
paid_date = fields.Date(string="Paid Date")
|
||||
paid_date = fields.Date(string="Paid Date",related='invoice_id.payment_id.date')
|
||||
payment_method = fields.Selection([('check', 'Bank Check'),
|
||||
('cash', 'Cash'),
|
||||
('transfer', 'Transfer')], string="Payment Method", default='transfer')
|
||||
|
|
@ -78,19 +78,36 @@ class RentPayment(models.Model):
|
|||
|
||||
def _prepare_invoice_values(self, payment, amount):
|
||||
self.renter_id.property_account_receivable_id = payment.contract_id.debit_account_id.id
|
||||
line_invoice=[]
|
||||
if amount>=0.00:
|
||||
line_invoice.append((0, 0, {
|
||||
'name':'قيمة الإيجار '+'- '+ payment.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': 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,
|
||||
'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,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.accrued_account_id.id,
|
||||
}))
|
||||
invoice_vals = {
|
||||
'ref': payment.name,
|
||||
'move_type': 'out_invoice',
|
||||
'invoice_origin': payment.code,
|
||||
'invoice_user_id': payment.user_id.id,
|
||||
'narration': payment.note,
|
||||
'partner_id': payment.contract_id.partner_id.id,
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'name': payment.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': amount,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.accrued_account_id.id,
|
||||
})],
|
||||
'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,
|
||||
|
|
@ -159,12 +176,12 @@ class RentPayment(models.Model):
|
|||
# tax_value = rec.tax_id.amount / 100
|
||||
# rec.tax_amount = rec.untaxed_amount * tax_value
|
||||
|
||||
@api.depends('amount', 'water_cost', 'service_cost')
|
||||
@api.depends('amount', 'water_cost', '')
|
||||
def get_untaxed_amount(self):
|
||||
for rec in self:
|
||||
rec.untaxed_amount = rec.amount + rec.water_cost + rec.service_cost
|
||||
rec.untaxed_amount = rec.amount + rec.water_cost + rec.
|
||||
|
||||
@api.depends('amount', 'water_cost', 'service_cost')
|
||||
@api.depends('amount', 'water_cost', '')
|
||||
def get_total_amount(self):
|
||||
for rec in self:
|
||||
rec.total_amount = rec.amount + rec.water_cost + rec.service_cost
|
||||
|
|
|
|||
Loading…
Reference in New Issue