|
@ -33,63 +33,65 @@ class AccountMove(models.Model): |
|
|
"""Redefining the function to create new journal entries whenever |
|
|
"""Redefining the function to create new journal entries whenever |
|
|
journal discounts are provided. |
|
|
journal discounts are provided. |
|
|
""" |
|
|
""" |
|
|
if self.move_type == 'out_invoice': |
|
|
for move in self: |
|
|
for line in self.invoice_line_ids: |
|
|
if move.move_type == 'out_invoice': |
|
|
if line.discount > 0 and \ |
|
|
for line in move.invoice_line_ids: |
|
|
line.product_id.categ_id.customer_account_discount_id: |
|
|
if line.discount > 0 and \ |
|
|
debit_credit_value = abs( |
|
|
line.product_id.categ_id.customer_account_discount_id: |
|
|
float_round((line.price_subtotal - (line.quantity * line.price_unit)), |
|
|
debit_credit_value = abs( |
|
|
precision_digits= |
|
|
float_round((line.price_subtotal - (line.quantity * line.price_unit)), |
|
|
self.currency_id.decimal_places)) |
|
|
precision_digits= |
|
|
self.env['account.move.line'].create({ |
|
|
move.currency_id.decimal_places)) |
|
|
'move_id': self.id, |
|
|
move.env['account.move.line'].create({ |
|
|
'currency_id': self.currency_id.id, |
|
|
'move_id': move.id, |
|
|
'display_type': 'tax', |
|
|
'currency_id': move.currency_id.id, |
|
|
'name': line.name, |
|
|
'display_type': 'tax', |
|
|
'account_id': line.product_id.categ_id.customer_account_discount_id.id, |
|
|
'name': line.name, |
|
|
'journal_id': self.journal_id, |
|
|
'account_id': line.product_id.categ_id.customer_account_discount_id.id, |
|
|
'credit': 0, |
|
|
'journal_id': move.journal_id.id, |
|
|
'debit': debit_credit_value, |
|
|
'credit': 0, |
|
|
}) |
|
|
'debit': debit_credit_value, |
|
|
self.env['account.move.line'].create({ |
|
|
}) |
|
|
'move_id': self.id, |
|
|
move.env['account.move.line'].create({ |
|
|
'display_type': 'tax', |
|
|
'move_id': move.id, |
|
|
'currency_id': self.currency_id.id, |
|
|
'display_type': 'tax', |
|
|
'name': line.name, |
|
|
'currency_id': move.currency_id.id, |
|
|
'account_id': line.account_id.id, |
|
|
'name': line.name, |
|
|
'journal_id': self.journal_id, |
|
|
'account_id': line.account_id.id, |
|
|
'credit': debit_credit_value, |
|
|
'journal_id': move.journal_id.id, |
|
|
'debit': 0, |
|
|
'credit': debit_credit_value, |
|
|
}) |
|
|
'debit': 0, |
|
|
elif self.move_type == 'in_invoice': |
|
|
}) |
|
|
for line in self.invoice_line_ids: |
|
|
elif move.move_type == 'in_invoice': |
|
|
if line.discount > 0 and \ |
|
|
for line in move.invoice_line_ids: |
|
|
line.product_id.categ_id.vendor_account_discount_id: |
|
|
if line.discount > 0 and \ |
|
|
debit_credit_value = abs( |
|
|
line.product_id.categ_id.vendor_account_discount_id: |
|
|
float_round((line.price_subtotal - (line.quantity * line.price_unit)), |
|
|
debit_credit_value = abs( |
|
|
precision_digits= |
|
|
float_round((line.price_subtotal - (line.quantity * line.price_unit)), |
|
|
self.currency_id.decimal_places)) |
|
|
precision_digits= |
|
|
self.env['account.move.line'].with_context( |
|
|
move.currency_id.decimal_places)) |
|
|
check_move_validity=False).create({ |
|
|
move.env['account.move.line'].with_context( |
|
|
'move_id': self.id, |
|
|
check_move_validity=False).create({ |
|
|
|
|
|
'move_id': move.id, |
|
|
'display_type': 'tax', |
|
|
'display_type': 'tax', |
|
|
'name': line.name, |
|
|
'name': line.name, |
|
|
'account_id': line.product_id.categ_id.vendor_account_discount_id.id, |
|
|
'account_id': line.product_id.categ_id.vendor_account_discount_id.id, |
|
|
'journal_id': self.journal_id, |
|
|
'journal_id': move.journal_id.id, |
|
|
'currency_id': self.currency_id.id, |
|
|
'currency_id': move.currency_id.id, |
|
|
'credit': 0, |
|
|
'credit': 0, |
|
|
'debit': debit_credit_value, |
|
|
'debit': debit_credit_value, |
|
|
}) |
|
|
}) |
|
|
self.env['account.move.line'].with_context( |
|
|
move.env['account.move.line'].with_context( |
|
|
check_move_validity=False).create({ |
|
|
check_move_validity=False).create({ |
|
|
'move_id': self.id, |
|
|
'move_id': move.id, |
|
|
'display_type': 'tax', |
|
|
'display_type': 'tax', |
|
|
'name': line.name, |
|
|
'name': line.name, |
|
|
'account_id': line.account_id.id, |
|
|
'account_id': line.account_id.id, |
|
|
'journal_id': self.journal_id, |
|
|
'journal_id': move.journal_id.id, |
|
|
'currency_id': self.currency_id.id, |
|
|
'currency_id': move.currency_id.id, |
|
|
'credit': debit_credit_value, |
|
|
'credit': debit_credit_value, |
|
|
'debit': 0, |
|
|
'debit': 0, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
res = super(AccountMove, self).action_post() |
|
|
res = super(AccountMove, self).action_post() |
|
|
return res |
|
|
return res |
|
|