[wip] Botón en el partner para realizar la liquidación
Funcionando hasta tener una lista de productos t las cantidades, hay que crear una factura de compra con ella.
This commit is contained in:
parent
53ad5dffb3
commit
fbda713b52
2 changed files with 71 additions and 2 deletions
|
@ -2,11 +2,13 @@
|
|||
# @author: Criptomart (<tech@criptomart.net>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
#import logging
|
||||
import logging
|
||||
|
||||
from collections import Counter
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
#_logger = logging.getLogger(__name__)
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
@ -29,6 +31,10 @@ class ResPartner(models.Model):
|
|||
string='Ubicación de depósito de compras',
|
||||
help="La ubicación que se usará para gestionar el material que éste proveedor nos deja en depósito."
|
||||
)
|
||||
deposit_buy_last_liquidation_date = fields.Date(
|
||||
string='Fecha de la última liquidación de compras',
|
||||
help="Cuándo se realizó la última liquidación de compras con éste proveedor."
|
||||
)
|
||||
|
||||
@api.onchange('deposit_sale_accept')
|
||||
def _onchange_deposit_sale_accept(self):
|
||||
|
@ -53,3 +59,19 @@ class ResPartner(models.Model):
|
|||
self.update({
|
||||
'deposit_buy_location_id': new_loc
|
||||
})
|
||||
|
||||
def make_liquidation_buy(self):
|
||||
_logger.warning("make_liquidation : %s" %self)
|
||||
search_vals = [
|
||||
('location_id', '=', self.deposit_buy_location_id.id),
|
||||
('location_dest_id', '=', self.env.ref('stock.stock_location_customers').id),
|
||||
]
|
||||
if self.deposit_buy_last_liquidation_date:
|
||||
search_vals += ('date', '>', self.deposit_buy_last_liquidation_date)
|
||||
_logger.warning("search_vals : %s" %search_vals)
|
||||
move_lines = self.env['stock.move.line'].search(search_vals)
|
||||
product_list = Counter()
|
||||
for mv in move_lines:
|
||||
product_list += {'id': mv.product_id.id, 'qty': mv.qty_done}
|
||||
_logger.warning("product_list : %s" %product_list)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue