Skip to content

Commit

Permalink
Merge branch '17.0' into 17.0-16.0-h-71549-mav-_IDh-fw
Browse files Browse the repository at this point in the history
  • Loading branch information
mav-adhoc committed Apr 19, 2024
2 parents 02818aa + c38620a commit e8b0c69
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 23 deletions.
15 changes: 12 additions & 3 deletions stock_batch_picking_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@ To configure this module, you need to:
Usage
=====

To use this module, you need to:

#. Go to ...
While creating a batch picking:
- Add the partner in the batch transfer, and then filter the transfers able to be selected according to it.
- Add the number of packages in the batch transfer
- For receipts, it add the supplier's shipping number.
- When pickings are selected while creating a new batch, we allow them to be unreserved and check availability.

While proccesing the batch picking:
- Add the possibility of processing stock.move.line from a list view.
- In the transfer lines it add information of the vouchers, from & to and source document, among others.
- Allow to unreserve everything from the batch.
- A smart button is added to go to the list view of associated transfers.
- When you click on a transfer (from the transfer tab) you see all the possible actions that would be seen by entering it directly, such as the possibility of printing the remittance.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
Expand Down
2 changes: 1 addition & 1 deletion stock_batch_picking_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Stock Usability with Batch Picking and stock vouchers',
'version': "16.0.1.0.0",
'version': "16.0.1.1.0",
'category': 'Warehouse Management',
'sequence': 14,
'summary': '',
Expand Down
17 changes: 17 additions & 0 deletions stock_batch_picking_ux/models/stock_batch_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ class StockPickingBatch(models.Model):
related='picking_ids.vouchers',
)

picking_count = fields.Integer(
string="# Transferencias", compute="_compute_picking_count",
)

notes = fields.Text(help="free form remarks")

def _compute_picking_count(self):
"""Calculate number of pickings."""
groups = self.env["stock.picking"].read_group(
domain=[("batch_id", "in", self.ids)],
fields=["batch_id"],
groupby=["batch_id"],
)
counts = {g["batch_id"][0]: g["batch_id_count"] for g in groups}
for batch in self:
batch.picking_count = counts.get(batch.id, 0)

@api.depends('picking_ids')
def _compute_picking_type_data(self):
for rec in self:
Expand Down
24 changes: 18 additions & 6 deletions stock_batch_picking_ux/views/stock_batch_picking_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,25 @@
<field name="arch" type="xml">

<button name="action_assign" position="after">
<button name="do_unreserve_picking" string="Unreserve all"
type="object"
attrs="{'invisible': [('state', 'not in', ['assigned', 'in_progress'])]}"/>
<button name="do_unreserve_picking" string="Unreserve all" type="object" attrs="{'invisible': [('state', 'not in', ['assigned', 'in_progress'])]}"/>
</button>

<button name="action_cancel" position="attributes">
<attribute name="groups">stock_ux.allow_picking_cancellation</attribute>
<attribute name="confirm">ATENCION! Al cancelar un picking batch todos los pickings relacionados también se van a cancelar. Seguro desea continuar?</attribute>
</button>

<field name="name" position="after">
<button name="add_picking_operation" class="oe_highlight oe_inline oe_right" type="object" string="Procesar cantidades" attrs="{'invisible': [('state', 'in', ['draft', 'cancel', 'done'])]}"/>
<button name="add_picking_operation" class="oe_highlight oe_inline oe_right" type="object" string="Procesar cantidades" attrs="{'invisible': [('state', 'in', ['draft', 'cancel', 'done'])]}"/>
</field>

<div name="button_box" position="after">
<div class="oe_button_box" name="button_box">
<button name="action_view_stock_picking" class="oe_stat_button" icon="fa-truck" type="object">
<field string="Pickings" name="picking_count" widget="statinfo" />
</button>
</div>
</div>

<field name="user_id" position="before">
<field name="voucher_required" invisible="1"/>
<!-- <field name="picking_type_id"/> -->
Expand All @@ -61,7 +66,7 @@
<!-- <field name="partner_id" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0}" domain="[('supplier','=',True)]"/> -->
<field name="voucher_number" attrs="{'invisible': [('picking_type_code','!=','incoming')], 'required': [('voucher_required','=',True)]}"/>
<field name="number_of_packages"/>
<!-- <field name="voucher_ids" attrs="{'invisible': [('picking_type_code','!=','incoming')]}" widget="many2many_tags" context="{'default_batch_picking': id}" domain="[('id', '=', False)]" options="{'create':True, 'create_edit':True}}"/> -->
<!-- <field name="voucher_ids" attrs="{'invisible': [('picking_type_code','!=','incoming')]}" widget="many2many_tags" context="{'default_batch_picking': id}" domain="[('id', '=', False)]" options="{'create':True, 'create_edit':True}}"/> -->
</field>

<field name="picking_ids" position="attributes">
Expand All @@ -81,7 +86,14 @@
<field name="picking_type_id" position="after">
<button name="action_done" string="Set all Done" type="object" icon="fa-check" attrs="{'invisible': [('state', 'not in', ['confirmed', 'assigned', 'waiting', 'partially_available'])]}"/>
</field>

<xpath expr="//notebook" position="inside">
<page string="Notes">
<field name="notes" colspan="4" nolabel="1"/>
</page>
</xpath>
</field>

</record>

</odoo>
3 changes: 2 additions & 1 deletion stock_orderpoint_manual_update/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Stock Orderpoint Manual Update',
'version': "16.0.1.1.0",
'version': "16.0.1.2.0",
'category': 'Warehouse Management',
'sequence': 14,
'summary': '',
Expand All @@ -30,6 +30,7 @@
],
'depends': [
'purchase_stock',
'stock_ux',
],
'data': [
'wizard/stock_warehouse_orderpoint_wizard_views.xml',
Expand Down
14 changes: 4 additions & 10 deletions stock_orderpoint_manual_update/models/stock_orderpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,10 @@ def _get_orderpoint_products(self):

return self.env['product.product'].search(domain)



class StockLocation(models.Model):
_inherit = "stock.location"

# Heredamos método search para filtrar las ubicaciones que se usan en _get_orderpoint_action().
# TODO: mejorar si Odoo mezcla PR: https://github.com/odoo/odoo/pull/150256
@api.model
def search(self, domain, offset=0, limit=None, order=None, count=False):
def _get_orderpoint_locations(self):
domain = [('replenish_location', '=', True)]
# Filter by locations
location_ids = self._context.get('filter_locations')
if location_ids:
domain.append(('id', 'in', location_ids))
return super().search(domain, offset=offset, limit=limit, order=order, count=count)
return self.env['stock.location'].search(domain)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class StockWarehouseOrderpointWizard(models.TransientModel):
product_ids = fields.Many2many('product.product', string='Product')
category_ids = fields.Many2many('product.category', string='Product Category')
supplier_ids = fields.Many2many('res.partner', string='Vendor', check_company=True)
filter_by_main_supplier = fields.Boolean(string="Filter by Main Vendor")
location_ids = fields.Many2many('stock.location', string="Location")

def action_confirm(self):
Expand All @@ -34,7 +35,9 @@ def _get_orderpoint_domain(self):
orderpoint_domain.append(('product_id', 'in', self.product_ids.ids))
if self.category_ids:
orderpoint_domain.append(('product_category_id', 'in', self.category_ids.ids))
if self.supplier_ids:
if self.filter_by_main_supplier:
orderpoint_domain.append(('supplier_id.partner_id', 'in', self.supplier_ids.ids))
elif self.supplier_ids:
orderpoint_domain.append(('product_id.seller_ids.partner_id', 'in', self.supplier_ids.ids))
if self.location_ids:
orderpoint_domain.append(('location_id', 'in', self.location_ids.ids))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</group>
<group col="2">
<field name="supplier_ids" widget="many2many_tags" context="{'res_partner_search_mode': 'supplier'}"></field>
<field name="filter_by_main_supplier" attrs="{'invisible': [('supplier_ids','=', [])]}"></field>
<field name="location_ids" widget="many2many_tags"/>
</group>
</group>
Expand Down
2 changes: 1 addition & 1 deletion stock_ux/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def action_done(self):
res = super().action_done()
for rec in self.with_context(mail_notify_force_send=False).filtered('picking_type_id.mail_template_id'):
try:
rec.message_post_with_template(rec.picking_type_id.mail_template_id.id)
rec.message_post_with_source(rec.picking_type_id.mail_template_id)
except Exception as error:
title = _(
"ERROR: Picking was not sent via email"
Expand Down
14 changes: 14 additions & 0 deletions stock_ux/views/stock_warehouse_orderpoint_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,18 @@
</field>
</record>

<record id="view_warehouse_orderpoint_chatter" model="ir.ui.view">
<field name="name">stock.warehouse.orderpoint.chatter</field>
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_form"/>
<field name="arch" type="xml">
<sheet position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</sheet>
</field>
</record>

</odoo>

0 comments on commit e8b0c69

Please sign in to comment.