|
|
@ -37,14 +37,32 @@ class PosSession(models.Model): |
|
|
|
bank_payment_method_diffs=None): |
|
|
|
"""Call the parent class method using super() and creates |
|
|
|
analytic distribution model""" |
|
|
|
res = super(PosSession,self)._create_account_move(balancing_account, |
|
|
|
res = super()._create_account_move(balancing_account, |
|
|
|
amount_to_balance, |
|
|
|
bank_payment_method_diffs) |
|
|
|
self.pos_analytic_account_id = self.config_id.analytic_account_id |
|
|
|
for rec in self.move_id.line_ids: |
|
|
|
rec.write({ |
|
|
|
'analytic_distribution': { |
|
|
|
self.config_id.analytic_account_id.id: 100} |
|
|
|
}) |
|
|
|
if self.pos_analytic_account_id: |
|
|
|
self.env['account.analytic.distribution.model'].create([{ |
|
|
|
'analytic_distribution': {self.pos_analytic_account_id.id: 100} |
|
|
|
'analytic_distribution': { |
|
|
|
self.config_id.analytic_account_id.id: 100} |
|
|
|
}]) |
|
|
|
else: |
|
|
|
return False |
|
|
|
return res |
|
|
|
|
|
|
|
def _validate_session(self, balancing_account=False, amount_to_balance=0, |
|
|
|
bank_payment_method_diffs=None): |
|
|
|
res = super()._validate_session(balancing_account, amount_to_balance, |
|
|
|
bank_payment_method_diffs) |
|
|
|
ids = self.move_id.line_ids.open_reconcile_view() |
|
|
|
for rec in self.env['account.move.line'].search(ids['domain']): |
|
|
|
rec.write({ |
|
|
|
'analytic_distribution': { |
|
|
|
self.config_id.analytic_account_id.id: 100} |
|
|
|
}) |
|
|
|
return res |
|
|
|