odoo/odoo#178656

Created by fw-bot
Merged at 0f631044340c430aa36e8e27f8b2c9348d1afb1a

Statuses:

label
odoo-dev:saas-17.4-17.0-opw-4105551-stock_picking_with_branch-guva-pzUu-fw
head
1a68063af138d35a3bdce9dbaf2e1022c50ab5b9
merged
10 months ago by Bugfix, Guillaume Vanleynseele (guva)
odoo/odoo
17.0 #176501
saas-17.1 #178643
saas-17.2 #178650
saas-17.4 #178656
18.0
saas-18.1
saas-18.2
saas-18.3
master #178811

[FW][FIX] stock_account: validate picking with branch company

We get an error when validating a stock picking with
a branch company

Steps:

  • Create a company C with a branch B
  • Set env.companies to both C and B, and env.company to either C or B
  • Create product P with company set as B, a standard_price > 0 and a
    product category set to 'Automated' and valuation != 'standard'
  • Make a stock picking from/to B for product P
  • Try to validate picking
    -> UserError: 'Incompatible companies on records'

This is because the account move is created with main company instead
of branch company.

opw-4105551

Forward-Port-Of: #176501