[MERGE] forward port branch saas-14 up to 851c29ce0e
This commit is contained in:
@@ -135,7 +135,7 @@
|
||||
<th>Net Imposable</th>
|
||||
<th>Plafond s.s.</th>
|
||||
<th></th>
|
||||
<th>Coût Global Salarié</th>
|
||||
<th>Total versé par l'employeur</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -197,6 +197,12 @@ class PosOrder(models.Model):
|
||||
return InvoiceLine.sudo().create(inv_line)
|
||||
|
||||
def _create_account_move_line(self, session=None, move=None):
|
||||
def _flatten_tax_and_children(taxes):
|
||||
children = self.env['account.tax']
|
||||
for tax in taxes:
|
||||
children |= _flatten_tax_and_children(tax.children_tax_ids)
|
||||
return taxes + children
|
||||
|
||||
# Tricky, via the workflow, we only have one id in the ids variable
|
||||
"""Create a account move line of order grouped by products or not."""
|
||||
IrProperty = self.env['ir.property']
|
||||
@@ -278,6 +284,9 @@ class PosOrder(models.Model):
|
||||
name = name + ' (' + line.notice + ')'
|
||||
|
||||
# Create a move for the line for the order line
|
||||
# Just like for invoices, a group of taxes must be present on this base line
|
||||
# As well as its children
|
||||
base_line_tax_ids = _flatten_tax_and_children(line.tax_ids_after_fiscal_position).filtered(lambda tax: tax.type_tax_use in ['sale', 'none'])
|
||||
insert_data('product', {
|
||||
'name': name,
|
||||
'quantity': line.qty,
|
||||
@@ -286,7 +295,7 @@ class PosOrder(models.Model):
|
||||
'analytic_account_id': self._prepare_analytic_account(line),
|
||||
'credit': ((amount > 0) and amount) or 0.0,
|
||||
'debit': ((amount < 0) and -amount) or 0.0,
|
||||
'tax_ids': [(6, 0, line.tax_ids_after_fiscal_position.ids)],
|
||||
'tax_ids': [(6, 0, base_line_tax_ids.ids)],
|
||||
'partner_id': partner_id
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user