Add update cost
This commit is contained in:
parent
c586e5cd76
commit
b22ce6d0a6
|
@ -5,7 +5,8 @@ from .purchase import (CreatePurchaseSuggestedStart, CreatePurchaseSuggested,
|
|||
CreatePurchaseRequestBySupplier, CreateRequestBySupplierStart,
|
||||
CreateRequestBySupplier, CreatePurchaseRequestBySupplierStart)
|
||||
from .product import (UpdateProductBySupplier, AddSupplierToProducts,
|
||||
AddSupplierToProductsStart, Product, Template)
|
||||
AddSupplierToProductsStart, Product, Template, UpdateCostPriceStart,
|
||||
UpdateCostPrice)
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -16,6 +17,7 @@ def register():
|
|||
CreatePurchaseSuggestedStart,
|
||||
CreatePurchaseRequestBySupplierStart,
|
||||
CreateRequestBySupplierStart,
|
||||
UpdateCostPriceStart,
|
||||
module='purchase_suggested', type_='model')
|
||||
Pool.register(
|
||||
AddSupplierToProducts,
|
||||
|
@ -23,4 +25,5 @@ def register():
|
|||
UpdateProductBySupplier,
|
||||
CreatePurchaseRequestBySupplier,
|
||||
CreateRequestBySupplier,
|
||||
UpdateCostPrice,
|
||||
module='purchase_suggested', type_='wizard')
|
||||
|
|
64
locale/es.po
64
locale/es.po
|
@ -33,13 +33,34 @@ msgstr "Tiempo de Stock"
|
|||
msgctxt ""
|
||||
"field:purchase_suggested.create_purchase_request_by_supplier.start,id:"
|
||||
msgid "ID"
|
||||
msgstr "UP"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt ""
|
||||
"field:purchase_suggested.create_purchase_request_by_supplier.start,party:"
|
||||
msgid "Party"
|
||||
msgstr "Terceros"
|
||||
|
||||
msgctxt "field:purchase_suggested.create_request_by_supplier.start,id:"
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "field:purchase_suggested.create_request_by_supplier.start,supplier:"
|
||||
msgid "Supplier"
|
||||
msgstr "Proveedor"
|
||||
|
||||
msgctxt ""
|
||||
"field:purchase_suggested.create_request_by_supplier.start,warehouse_location:"
|
||||
msgid "Warehouse Location"
|
||||
msgstr "Ubicación del Almacén"
|
||||
|
||||
msgctxt "field:purchase_suggested.update_cost_price.start,cost_price:"
|
||||
msgid "New Cost Price"
|
||||
msgstr "Nuevo Costo"
|
||||
|
||||
msgctxt "field:purchase_suggested.update_cost_price.start,id:"
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "help:purchase_suggested.create_order.start,historical_time:"
|
||||
msgid "In days"
|
||||
msgstr "En días"
|
||||
|
@ -48,7 +69,7 @@ msgctxt "help:purchase_suggested.create_order.start,time_stock:"
|
|||
msgid "In days"
|
||||
msgstr "En días"
|
||||
|
||||
msgctxt "model:ir.action,name:act_create_autorequest"
|
||||
msgctxt "model:ir.action,name:"
|
||||
msgid "Auto Request"
|
||||
msgstr "Auto Requisición"
|
||||
|
||||
|
@ -56,10 +77,18 @@ msgctxt "model:ir.action,name:act_create_purchase_suggested"
|
|||
msgid "Create Purchase Suggested"
|
||||
msgstr "Crear Compra Sugerida"
|
||||
|
||||
msgctxt "model:ir.action,name:act_create_request_by_supplier"
|
||||
msgid "Create Request By Supplier"
|
||||
msgstr "Crear Solicitud por Proveedor"
|
||||
|
||||
msgctxt "model:ir.action,name:act_product_add_supplier"
|
||||
msgid "Add Supplier"
|
||||
msgstr "Agregar Proveedor"
|
||||
|
||||
msgctxt "model:ir.action,name:act_product_update_cost_price"
|
||||
msgid "Update Cost Price"
|
||||
msgstr "Actualizar Costo"
|
||||
|
||||
msgctxt "model:ir.action,name:act_purchase_request_create"
|
||||
msgid "Create Purchase Requests"
|
||||
msgstr "Crear solicitudes de compra"
|
||||
|
@ -72,6 +101,10 @@ msgctxt "model:ir.ui.menu,name:menu_create_purchase_suggested"
|
|||
msgid "Create Purchase Suggested"
|
||||
msgstr "Crear Compra Sugerida"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_create_request_by_supplier"
|
||||
msgid "Create Request By Supplier"
|
||||
msgstr "Crear Solicitud por Proveedor"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_purchase_request_create"
|
||||
msgid "Create Purchase Requests"
|
||||
msgstr "Crear Solicitudes De Compra Por Proveedor"
|
||||
|
@ -89,6 +122,14 @@ msgctxt ""
|
|||
msgid "Create Purchase Request By Supplier"
|
||||
msgstr "Crear Solicitudes De Compra Por Proveedor"
|
||||
|
||||
msgctxt "model:purchase_suggested.create_request_by_supplier.start,name:"
|
||||
msgid "Create Request By Supplier Start"
|
||||
msgstr "Crear Solicitud por Proveedor"
|
||||
|
||||
msgctxt "model:purchase_suggested.update_cost_price.start,name:"
|
||||
msgid "Update Cost Price Start"
|
||||
msgstr "Actualizar Costo"
|
||||
|
||||
msgctxt "view:purchase_suggested.add_supplier.start:"
|
||||
msgid "Add Supplier"
|
||||
msgstr "Agregar Proveedor"
|
||||
|
@ -126,3 +167,22 @@ msgctxt ""
|
|||
"wizard_button:purchase_suggested.create_purchase_request_by_supplier,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt ""
|
||||
"wizard_button:purchase_suggested.create_request_by_supplier,start,create_:"
|
||||
msgid "Create"
|
||||
msgstr "Crear"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt ""
|
||||
"wizard_button:purchase_suggested.create_request_by_supplier,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
msgctxt "wizard_button:purchase_suggested.update_cost_price,start,accept:"
|
||||
msgid "Ok"
|
||||
msgstr "Aceptar"
|
||||
|
||||
msgctxt "wizard_button:purchase_suggested.update_cost_price,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
|
29
product.py
29
product.py
|
@ -9,7 +9,8 @@ from trytond.model import fields, ModelView
|
|||
|
||||
__all__ = [
|
||||
'UpdateProductBySupplier', 'AddSupplierToProductsStart',
|
||||
'AddSupplierToProducts', 'Product', 'Template',
|
||||
'AddSupplierToProducts', 'Product', 'Template', 'UpdateCostPrice',
|
||||
'UpdateCostPriceStart'
|
||||
]
|
||||
|
||||
|
||||
|
@ -114,3 +115,29 @@ class AddSupplierToProducts(Wizard):
|
|||
})
|
||||
ProductSupplier.create(suppliers_to_add)
|
||||
return 'end'
|
||||
|
||||
|
||||
class UpdateCostPriceStart(ModelView):
|
||||
'Update Cost Price Start'
|
||||
__name__ = 'purchase_suggested.update_cost_price.start'
|
||||
cost_price = fields.Numeric('New Cost Price', digits=(16, 4),
|
||||
required=True)
|
||||
|
||||
|
||||
class UpdateCostPrice(Wizard):
|
||||
'Update Cost Price'
|
||||
__name__ = 'purchase_suggested.update_cost_price'
|
||||
start = StateView('purchase_suggested.update_cost_price.start',
|
||||
'purchase_suggested.update_cost_price_start_view_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Ok', 'accept', 'tryton-ok', default=True),
|
||||
])
|
||||
accept = StateTransition()
|
||||
|
||||
def transition_accept(self):
|
||||
id = Transaction().context['active_id']
|
||||
Template = Pool().get('product.template')
|
||||
template = Template(id)
|
||||
for product in template.products:
|
||||
product.write([product], {'cost_price': self.start.cost_price})
|
||||
return 'end'
|
||||
|
|
15
product.xml
15
product.xml
|
@ -30,5 +30,20 @@ copyright notices and license terms. -->
|
|||
<field name="action" ref="act_product_add_supplier"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="update_cost_price_start_view_form">
|
||||
<field name="model">purchase_suggested.update_cost_price.start</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">update_cost_price_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="act_product_update_cost_price">
|
||||
<field name="name">Update Cost Price</field>
|
||||
<field name="wiz_name">purchase_suggested.update_cost_price</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="action_product_update_cost_price_keyword">
|
||||
<field name="keyword">form_action</field>
|
||||
<field name="model">product.template,-1</field>
|
||||
<field name="action" ref="act_product_update_cost_price"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=5.0.1
|
||||
version=5.0.2
|
||||
depends:
|
||||
product
|
||||
stock
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form >
|
||||
<label name="cost_price"/>
|
||||
<field name="cost_price"/>
|
||||
</form>
|
Loading…
Reference in New Issue