This question has been flagged
4530 Views

I have 3 different models, stock location, stock movement and agency, each agency has its own stock location in which it stores shipments logged in the stock when I check from the stock location tree view in the inventory management I can clearly see that there are movements towards the location of an agency, unfortunately I can’t see them in the agency module. the goal is to display in a tree view, the stock movement that correspond to the current agency

Thank you in advance for your help.

here is my code:

class Agency(models.Model):
    _name = "agency.agency"
    stock_location_id = fields.Many2one('stock.location', ondelete='set null', string="stock local")
    stock_move_ids = fields.One2many('stock.move', 'agence_id', string="Stock Move")

class StockMoveInherit(models.Model):
    _inherit = "stock.move"
    _name = "stock.move"     
    agence_id = fields.Many2one(agency.agency', string="Agence")

class LocationInherit(models.Model):     
    _inherit = "stock.location"
    _name = "stock.location" agence_id = fields.Many2one(agency.agency', string="Agence concernée")

XML
<record id="view_stock_page_inherit" model="ir.ui.view">
<field name="name">agency.stock.inherit</field>
<field name="model">agency.agency</field>
<field name="inherit_id" ref="agency.agencies_form_view"/>
<field name="arch" type="xml">
<page string="Gestion Stock">
<notebook colspan="4">
<page string="Nouvel arrivage">
<field name="stock_move_ids" widget="one2many_list">
<tree>
<field name="id"/>
<field name="product_id"/>
<field name="name"/>
<field name="location_id"/>
<field name="location_dest_id" widget="many2many_tags" domain="[('location_dest_id','=',stock_location_id)]"/>
<field name="date"/>
<field name="product_qty"/>
</tree>
</field>
</page>
Avatar
Discard