work on laundary mgt

This commit is contained in:
sonal arora
2020-09-25 12:43:02 +05:30
parent 92794447bb
commit 13d1f6af28
10 changed files with 121 additions and 0 deletions

4
laundary_mgt/__init__.py Normal file
View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Laundary Management',
'version': '1.1',
'category': 'Sales/Sales',
'summary': 'Laundary Management',
'description': """
This module contains all the common features of Laundary Management.
""",
'depends': ['sale'],
'data': [
'security/ir.model.access.csv',
'data/ir_sequence_data.xml',
'views/sale_views.xml',
],
'demo': [
],
'qweb': [
],
'installable': True,
'auto_install': False
}

Binary file not shown.

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Sequences for sale.order -->
<record id="seq_sale_order_line" model="ir.sequence">
<field name="name">Sales Order Line</field>
<field name="code">sale.order.line</field>
<field name="prefix">Trac</field>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import sale

Binary file not shown.

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, timedelta
from functools import partial
from itertools import groupby
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import AccessError, UserError, ValidationError
from odoo.tools.misc import formatLang, get_lang
from odoo.osv import expression
from odoo.tools import float_is_zero, float_compare
from werkzeug.urls import url_encode
class SaleOrder(models.Model):
_inherit = 'sale.order'
check_trackcode = fields.Boolean(string='Check Track code', readonly=True, default=False, copy=False)
def action_generate_tracking_code(self):
for order in self:
order.check_trackcode = True
company_id = default=lambda self: self.env.company
seq_date = fields.Datetime.now()
for line in order.order_line:
line.tracking_code = self.env['ir.sequence'].next_by_code('sale.order.line', sequence_date=seq_date) or _('New')
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
_description = 'Sales Order Line'
wash_type = fields.Many2one('wash.type', string='Wash Type')
cloth_name = fields.Char(string='Cloth Name',copy=False)
tracking_code = fields.Char(string='Tracking Code',copy=False,readonly="1")
remark = fields.Text('Remark',copy=False)
upload_image = fields.Image("Upload Image")
class WashType(models.Model):
_name = 'wash.type'
_description = 'Wash Type'
name = fields.Char(string='Name')

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_wash_type,wash.type,model_wash_type,sales_team.group_sale_salesman,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_wash_type wash.type model_wash_type sales_team.group_sale_salesman 1 1 1 1

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_template_sale_tree_inheritt" model="ir.ui.view">
<field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr = "//header" position = "inside">
<button name="action_generate_tracking_code" type="object" string="Generate Tracking Code" attrs="{'invisible': ['|',('check_trackcode', '=', True),('state', '!=', 'sale')]}"/>
<field name="check_trackcode" invisible="1"/>
</xpath>
<xpath expr = "//notebook/page/field[@name = 'order_line']/tree/field[@name = 'name']" position = "after">
<field name="cloth_name"/>
<field name="wash_type"/>
<field name="tracking_code"/>
</xpath>
<xpath expr = "//notebook/page/field[@name='order_line']/tree/field[@name='price_subtotal']" position = "after">
<field name="upload_image"/>
</xpath>
</field>
</record>
</odoo>