[FIX] account, pos_cash_rounding: company_id on cash rounding

- Create 2 companies C1 and C2
- Create a cash rounding method for C2, i.e. use an account of C2
- In the POS configuration of C1, choose the created cash rounding
  method

When closing the POS, entries will be booked in C1 and C2 => error.

We define a `company_id` field which is a related to the `account`
company.

opw-2223150
opw-2217718

closes odoo/odoo#48632

X-original-commit: a1feee5db2d6509c0af8f59812a8e8ce5b23c662
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-03-30 20:39:16 +00:00
parent 0eef278268
commit 2dc4ef69c1
2 changed files with 2 additions and 1 deletions
@@ -25,6 +25,7 @@ class AccountCashRounding(models.Model):
rounding_method = fields.Selection(string='Rounding Method', required=True,
selection=[('UP', 'UP'), ('DOWN', 'DOWN'), ('HALF-UP', 'HALF-UP')],
default='HALF-UP', help='The tie-breaking rule used for float rounding operations')
company_id = fields.Many2one('res.company', related='profit_account_id.company_id')
def round(self, amount):
"""Compute the rounding on the amount passed as parameter.
@@ -354,7 +354,7 @@
<div class="content-group mt16" attrs="{'invisible': [('cash_rounding', '=', False)]}">
<div class="row mt16">
<label string="Rounding Method" for="rounding_method" class="col-lg-3 o_light_label" />
<field name="rounding_method" attrs="{'required' : [('cash_rounding', '=', True)]}"/>
<field name="rounding_method" attrs="{'required' : [('cash_rounding', '=', True)]}" domain="[('company_id', '=', company_id)]"/>
</div>
</div>
</div>