mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
add #335 for commission analytic account
This commit is contained in:
committed by
Florian da Costa
parent
8de48a5b12
commit
ad04b89ab5
@@ -76,6 +76,12 @@ class AccountJournal(models.Model):
|
|||||||
"the refunds and one for the payments",
|
"the refunds and one for the payments",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
commission_analytic_account_id = fields.Many2one(
|
||||||
|
comodel_name="account.analytic.account",
|
||||||
|
string="Commission Analytic Account",
|
||||||
|
help="Choose an analytic account to be used on the commission line.",
|
||||||
|
)
|
||||||
|
|
||||||
def _prepare_counterpart_line(self, move, amount, date):
|
def _prepare_counterpart_line(self, move, amount, date):
|
||||||
if amount > 0.0:
|
if amount > 0.0:
|
||||||
account_id = self.default_debit_account_id.id
|
account_id = self.default_debit_account_id.id
|
||||||
@@ -179,6 +185,10 @@ class AccountJournal(models.Model):
|
|||||||
comm_values["debit"], company_currency
|
comm_values["debit"], company_currency
|
||||||
)
|
)
|
||||||
comm_values["currency_id"] = currency.id
|
comm_values["currency_id"] = currency.id
|
||||||
|
if self.commission_analytic_account_id:
|
||||||
|
comm_values.update(
|
||||||
|
{"analytic_account_id": self.commission_analytic_account_id.id}
|
||||||
|
)
|
||||||
move_line_obj.with_context(check_move_validity=False).create(
|
move_line_obj.with_context(check_move_validity=False).create(
|
||||||
comm_values
|
comm_values
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="commission_account_id" />
|
<field name="commission_account_id" />
|
||||||
|
<field name="commission_analytic_account_id" />
|
||||||
<field
|
<field
|
||||||
name="receivable_account_id"
|
name="receivable_account_id"
|
||||||
attrs="{'required': [('used_for_import', '=', True)]}"
|
attrs="{'required': [('used_for_import', '=', True)]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user